Merge pull request #822 from carlosmn/asp-pc
[mono.git] / mcs / build / library.make
index 15961b762cccfb8ee8c021d26f4f23ff7a706466..fdd94d023f316a4b56d93dc229d2641a7e75a2cd 100644 (file)
@@ -17,11 +17,24 @@ PROFILE_excludes = $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources)
 sourcefile = $(depsdir)/$(PROFILE)_$(LIBRARY).sources
 library_CLEAN_FILES += $(sourcefile)
 
+ifdef EXTENSION_MODULE
+EXTENSION_include = $(wildcard $(topdir)/../../mono-extensions/mcs/$(thisdir)/$(PROFILE)_$(LIBRARY).sources)
+else
+EXTENSION_include = $(wildcard $(PROFILE)_opt_$(LIBRARY).sources)
+endif
+
+
+ifdef EXTENSION_MODULE
+EXTENSION_exclude = $(wildcard $(topdir)/../../mono-extensions/mcs/$(thisdir)/$(PROFILE)_$(LIBRARY).exclude.sources)
+else
+EXTENSION_exclude = $(wildcard $(PROFILE)_opt_$(LIBRARY).exclude.sources)
+endif
+
 # Note, gensources.sh can create a $(sourcefile).makefrag if it sees any '#include's
 # We don't include it in the dependencies since it isn't always created
-$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(topdir)/build/gensources.sh
+$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(topdir)/build/gensources.sh $(EXTENSION_include)
        @echo Creating the per profile list $@ ...
-       $(SHELL) $(topdir)/build/gensources.sh $@ $(PROFILE_sources) $(PROFILE_excludes)
+       $(SHELL) $(topdir)/build/gensources.sh $@ '$(PROFILE_sources)' '$(PROFILE_excludes)' '$(EXTENSION_include)' '$(EXTENSION_exclude)'
 endif
 
 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
@@ -47,7 +60,11 @@ else
 lib_dir = lib
 endif
 
+ifdef LIBRARY_SUBDIR
+the_libdir = $(topdir)/class/$(lib_dir)/$(PROFILE)/$(LIBRARY_SUBDIR)/
+else
 the_libdir = $(topdir)/class/$(lib_dir)/$(PROFILE)/
+endif
 ifdef LIBRARY_NEEDS_POSTPROCESSING
 build_libdir = fixup/$(PROFILE)/
 else
@@ -66,9 +83,10 @@ library_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_lib
 ifdef NO_SIGN_ASSEMBLY
 SN = :
 else
-sn = $(topdir)/class/lib/basic/sn.exe
-SN = $(Q) MONO_PATH="$(topdir)/class/lib/basic$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn)
-SNFLAGS = -q
+ifeq ("$(SN)","")
+sn = $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/sn.exe
+SN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn) -q
+endif
 endif
 
 ifeq ($(PLATFORM), win32)
@@ -90,17 +108,24 @@ else
 is_boot=false
 endif
 
-csproj-local: 
+csproj-local: csproj-library csproj-test
+
+# to overcome the issues with circular dependencies, we'll create csprojs with a counter increment. 
+# This is more amenable for use in VS solutions to reference projects rather than transient dll files in the build process.
+csproj-library:
        config_file=`basename $(LIBRARY) .dll`-$(PROFILE).input; \
-       echo $(thisdir):$$config_file >> $(topdir)/../mono/msvc/scripts/order; \
+       for counter in 1 2 3 4 5 ; do if test -f $(topdir)/../msvc/scripts/inputs/$$config_file ; then config_file=`basename $(LIBRARY) .dll`-$(PROFILE)-$$counter.input; fi ; done ;\
+       echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
        (echo $(is_boot); \
-       echo $(MCS);    \
        echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
        echo $(LIBRARY_NAME); \
        echo $(BUILT_SOURCES_cmdline); \
        echo $(build_lib); \
-       echo $(response)) > $(topdir)/../mono/msvc/scripts/inputs/$$config_file
+       echo $(FRAMEWORK_VERSION); \
+       echo $(PROFILE); \
+       echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
 
+csproj-test:
 
 install-local: all-local
 test-local: all-local
@@ -178,6 +203,19 @@ include $(topdir)/build/tests.make
 
 ifdef HAVE_CS_TESTS
 DISTFILES += $(test_sourcefile)
+
+csproj-test:
+       config_file=`basename $(LIBRARY) .dll`-tests-$(PROFILE).input; \
+       echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
+       (echo false; \
+       echo $(USE_MCS_FLAGS) -r:$(the_assembly) $(TEST_MCS_FLAGS); \
+       echo $(test_lib); \
+       echo $(BUILT_SOURCES_cmdline); \
+       echo $(test_lib); \
+       echo $(FRAMEWORK_VERSION); \
+       echo $(PROFILE); \
+       echo $(test_response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
+
 endif
 
 # make dist will collect files in .sources files from all profiles
@@ -223,12 +261,12 @@ $(the_lib): $(the_libdir)/.stamp
 
 $(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir:=/.stamp)
        $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
-       $(SN) $(SNFLAGS) -R $@ $(LIBRARY_SNK)
+       $(Q) $(SN) -R $@ $(LIBRARY_SNK)
 
 ifdef LIBRARY_USE_INTERMEDIATE_FILE
 $(the_lib): $(build_lib)
        $(Q) cp $(build_lib) $@
-       $(SN) $(SNFLAGS) -v $@
+       $(Q) $(SN) -v $@
        $(Q) test ! -f $(build_lib).mdb || mv $(build_lib).mdb $@.mdb
        $(Q) test ! -f $(build_lib:.dll=.pdb) || mv $(build_lib:.dll=.pdb) $(the_lib:.dll=.pdb)
 endif
@@ -236,7 +274,7 @@ endif
 library_CLEAN_FILES += $(PROFILE)_aot.log
 
 ifdef PLATFORM_AOT_SUFFIX
-Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] $(notdir $(@))";)
+Q_AOT=$(if $(V),,@echo "AOT     [$(PROFILE)] $(notdir $(@))";)
 $(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib)
        $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version --debug $(the_lib)
 endif
@@ -252,7 +290,7 @@ endif
 makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
 library_CLEAN_FILES += $(makefrag)
 $(makefrag): $(sourcefile)
-       @echo Creating $@ ...
+#      @echo Creating $@ ...
        @sed 's,^,$(build_lib): ,' $< >$@
        @if test ! -f $(sourcefile).makefrag; then :; else \
           cat $(sourcefile).makefrag >> $@ ; \
@@ -290,10 +328,10 @@ $(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag
 ## Documentation stuff
 
 Q_MDOC_UP=$(if $(V),,@echo "MDOC-UP [$(PROFILE)] $(notdir $(@))";)
+# net_2_0 is needed because monodoc is only compiled in that profile
 MDOC_UP  =$(Q_MDOC_UP) \
-               MONO_PATH="$(topdir)/class/lib/net_4_0$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
-               $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe update --delete            \
-                       -o Documentation/en $(the_lib)
+               MONO_PATH="$(topdir)/class/lib/$(DEFAULT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/$(DEFAULT_PROFILE)/mdoc.exe \
+               update --delete -o Documentation/en $(the_lib)
 
 doc-update-local: $(the_libdir)/.doc-stamp