[build] Roslyn switch
[mono.git] / mcs / build / library.make
index 1df98aeea1f035eb5e187138f58761eaccab60be..2f5b845ec5dfb3c446bff13433f6956d93dfb2be 100644 (file)
 # Have to rename to handle differences between assembly/directory names
 DEP_LIBS=$(patsubst System.Xml,System.XML,$(LIB_REFS))
 
-LIB_MCS_FLAGS += $(patsubst %,-r:%.dll,$(LIB_REFS))
+_FILTER_OUT = $(foreach x,$(2),$(if $(findstring $(1),$(x)),,$(x)))
+
+LIB_REFS_FULL = $(call _FILTER_OUT,=, $(LIB_REFS))
+LIB_REFS_ALIAS = $(filter-out $(LIB_REFS_FULL),$(LIB_REFS))
+
+LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(LIB_REFS_FULL))
+LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE)/,$(LIB_REFS_ALIAS)))
 
 sourcefile = $(LIBRARY).sources
 
@@ -29,24 +35,11 @@ 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 $(EXTENSION_include)
+$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(topdir)/build/gensources.sh
        @echo Creating the per profile list $@ ...
-       $(SHELL) $(topdir)/build/gensources.sh $@ '$(PROFILE_sources)' '$(PROFILE_excludes)' '$(EXTENSION_include)' '$(EXTENSION_exclude)'
+       $(SHELL) $(topdir)/build/gensources.sh $@ '$(PROFILE_sources)' '$(PROFILE_excludes)'
 endif
 
 PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
@@ -79,12 +72,10 @@ the_libdir_base = $(topdir)/class/$(lib_dir)/$(PROFILE)/
 endif
 
 ifdef RESOURCE_STRINGS
-ifdef BOOTSTRAP_PROFILE
-ifneq (basic, $(BUILD_TOOLS_PROFILE))
+ifneq (basic, $(PROFILE))
 RESOURCE_STRINGS_FILES += $(RESOURCE_STRINGS:%=--resourcestrings:%)
 endif
 endif
-endif
 
 #
 # The bare directory contains the plain versions of System and System.Xml
@@ -141,7 +132,7 @@ endif
 csproj-local: csproj-library csproj-test
 
 intermediate_clean=$(subst /,-,$(intermediate))
-csproj-library: 
+csproj-library:
        config_file=`basename $(LIBRARY) .dll`-$(intermediate_clean)$(PROFILE).input; \
        case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; esac; \
        echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
@@ -152,6 +143,7 @@ csproj-library:
        echo $(build_lib); \
        echo $(FRAMEWORK_VERSION); \
        echo $(PROFILE); \
+       echo $(RESOURCE_DEFS); \
        echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
 
 csproj-test:
@@ -174,12 +166,14 @@ install-local:
        $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
        $(INSTALL_LIB) $(the_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME)
        test ! -f $(the_lib).mdb || $(INSTALL_LIB) $(the_lib).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
+       test ! -f $(the_lib:.dll=.pdb) || $(INSTALL_LIB) $(the_lib:.dll=.pdb) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME:.dll=.pdb)
+
 ifdef PLATFORM_AOT_SUFFIX
        test ! -f $(aot_lib) || $(INSTALL_LIB) $(aot_lib) $(DESTDIR)$(LIBRARY_INSTALL_DIR)
 endif
 
 uninstall-local:
-       -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb
+       -rm -f $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME) $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME).mdb $(DESTDIR)$(LIBRARY_INSTALL_DIR)/$(LIBRARY_NAME:.dll=.pdb)
 
 else
 
@@ -223,7 +217,28 @@ clean-local:
 test-local run-test-local run-test-ondotnet-local:
        @:
 
-DISTFILES = $(wildcard *$(LIBRARY)*.sources) $(EXTRA_DISTFILES)
+#
+# RESOURCES_DEFS is a list of ID,FILE pairs separated by spaces
+# for each of those, generate a rule that produces ID.resource from
+# FILE using the resgen tool, adds the generated file to CLENA_FILES and
+# passes the resource to the compiler
+#
+ccomma = ,
+define RESOURCE_template
+$(1).resources: $(2)
+       $(RESGEN) "$$<" "$$@"
+
+GEN_RESOURCE_DEPS += $(1).resources
+GEN_RESOURCE_FLAGS += -resource:$(1).resources
+CLEAN_FILES += $(1).resources
+DIST_LISTED_RESOURCES += $(2)
+endef
+
+ifdef RESOURCE_DEFS
+$(foreach pair,$(RESOURCE_DEFS), $(eval $(call RESOURCE_template,$(word 1, $(subst $(ccomma), ,$(pair))), $(word 2, $(subst $(ccomma), ,$(pair))))))
+endif
+
+DISTFILES = $(wildcard *$(LIBRARY)*.sources) $(EXTRA_DISTFILES) $(DIST_LISTED_RESOURCES)
 
 ASSEMBLY      = $(LIBRARY)
 ASSEMBLY_EXT  = .dll
@@ -243,6 +258,7 @@ csproj-test:
        echo $(test_lib); \
        echo $(FRAMEWORK_VERSION); \
        echo $(PROFILE); \
+       echo ""; \
        echo $(test_response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
 
 endif
@@ -253,6 +269,7 @@ dist-local: dist-default
        for f in `$(topdir)/tools/removecomments.sh $(wildcard *$(LIBRARY).sources)` $(TEST_FILES) ; do \
          case $$f in \
          ../*) : ;; \
+         *.g.cs) : ;; \
          *) dest=`dirname "$$f"` ; \
             case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
             cp -p "$$f" $(distdir)/$$dest || exit 1 ;; \
@@ -281,12 +298,12 @@ endif
 
 $(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)
-       $(Q) $(SN) -R $@ $(LIBRARY_SNK)
+$(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir:=/.stamp) $(GEN_RESOURCE_DEPS)
+       $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(GEN_RESOURCE_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response)
 ifdef RESOURCE_STRINGS_FILES
        $(Q) $(STRING_REPLACER) $(RESOURCE_STRINGS_FILES) $@
 endif
+       $(Q) $(SN) -R $@ $(LIBRARY_SNK)
 
 ifdef LIBRARY_USE_INTERMEDIATE_FILE
 $(the_lib): $(build_lib)
@@ -299,8 +316,6 @@ endif
 library_CLEAN_FILES += $(PROFILE)_aot.log
 
 ifdef PLATFORM_AOT_SUFFIX
-Q_AOT=$(if $(V),,@echo "AOT     [$(PROFILE)] $(notdir $(@))";)
-
 $(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib)
        $(Q_AOT) MONO_PATH='$(the_libdir_base)' > $(PROFILE)_$(LIBRARY_NAME)_aot.log 2>&1 $(RUNTIME) $(AOT_BUILD_FLAGS) --debug $(the_lib)