X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fbuild%2Flibrary.make;h=2b9c75cf414491ea9051fb03ff62e354b1c9ca83;hb=411a37af27905eaa44dac1a31f6387a11c0b0244;hp=c8379b22f68bb9a101f37d998cc07f648be647b2;hpb=883a0ae745bf33b35d44bb730d5714936a2141f7;p=mono.git diff --git a/mcs/build/library.make b/mcs/build/library.make index c8379b22f68..2b9c75cf414 100644 --- a/mcs/build/library.make +++ b/mcs/build/library.make @@ -18,41 +18,29 @@ # Have to rename to handle differences between assembly/directory names DEP_LIBS=$(patsubst System.Xml,System.XML,$(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 - -# If the directory contains the per profile include file, generate list file. -PROFILE_sources := $(wildcard $(PROFILE)_$(LIBRARY).sources) -ifdef PROFILE_sources -PROFILE_excludes = $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources) -sourcefile = $(depsdir)/$(PROFILE)_$(LIBRARY).sources -library_CLEAN_FILES += $(sourcefile) +ifdef TARGET_NET_REFERENCE +# System.*.dll references come from the TARGET_NET_REFERENCE dir, others from the profile dir +LIB_REFS_MONO_FULL = $(call _FILTER_OUT,System,$(LIB_REFS_FULL)) +LIB_REFS_MONO_ALIAS = $(call _FILTER_OUT,System,$(LIB_REFS_ALIAS)) -# 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 - @echo Creating the per profile list $@ ... - $(SHELL) $(topdir)/build/gensources.sh $@ '$(PROFILE_sources)' '$(PROFILE_excludes)' -endif +LIB_REFS_SYSTEM_FULL = $(filter-out $(LIB_REFS_MONO_FULL),$(LIB_REFS_FULL)) +LIB_REFS_SYSTEM_ALIAS = $(filter-out $(LIB_REFS_MONO_ALIAS),$(LIB_REFS_ALIAS)) -PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes) +LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_SYSTEM_FULL)) +LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/,$(LIB_REFS_SYSTEM_ALIAS))) -ifndef PLATFORM_excludes -ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD)) -response = $(sourcefile) -endif +LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_MONO_FULL)) +LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_MONO_ALIAS))) +else +LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_FULL)) +LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_ALIAS))) endif -ifndef response -response = $(depsdir)/$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).response -library_CLEAN_FILES += $(response) +ifdef KEYFILE +KEYFILE_MCS_FLAGS += /keyfile:$(KEYFILE) endif ifndef LIBRARY_NAME @@ -65,17 +53,12 @@ else lib_dir = lib endif -ifdef LIBRARY_SUBDIR -the_libdir_base = $(topdir)/class/$(lib_dir)/$(PROFILE)/$(LIBRARY_SUBDIR)/ -else -the_libdir_base = $(topdir)/class/$(lib_dir)/$(PROFILE)/ -endif +the_libdir_base = $(topdir)/class/$(lib_dir)/$(PROFILE_DIRECTORY)/$(if $(LIBRARY_SUBDIR),$(LIBRARY_SUBDIR)/) ifdef RESOURCE_STRINGS -ifdef BOOTSTRAP_PROFILE -ifneq (basic, $(BUILD_TOOLS_PROFILE)) +ifneq (basic, $(PROFILE)) RESOURCE_STRINGS_FILES += $(RESOURCE_STRINGS:%=--resourcestrings:%) -endif +IL_REPLACE_FILES += $(IL_REPLACE:%=--ilreplace:%) endif endif @@ -112,7 +95,7 @@ SN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARA endif endif -ifeq ($(PLATFORM), win32) +ifeq ($(BUILD_PLATFORM), win32) GACDIR = `cygpath -w $(mono_libdir)` GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)` test_flags += -d:WINDOWS @@ -136,15 +119,16 @@ csproj-local: csproj-library csproj-test intermediate_clean=$(subst /,-,$(intermediate)) csproj-library: config_file=`basename $(LIBRARY) .dll`-$(intermediate_clean)$(PROFILE).input; \ - case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; esac; \ + case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; *"legacy"*) config_file=legacy_$$config_file;; esac; \ echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \ (echo $(is_boot); \ - echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \ + echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(KEYFILE_MCS_FLAGS); \ echo $(LIBRARY_NAME); \ echo $(BUILT_SOURCES_cmdline); \ echo $(build_lib); \ echo $(FRAMEWORK_VERSION); \ echo $(PROFILE); \ + echo $(RESOURCE_DEFS); \ echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file csproj-test: @@ -167,12 +151,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 @@ -216,7 +202,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 @@ -236,6 +243,7 @@ csproj-test: echo $(test_lib); \ echo $(FRAMEWORK_VERSION); \ echo $(PROFILE); \ + echo ""; \ echo $(test_response)) > $(topdir)/../msvc/scripts/inputs/$$config_file endif @@ -243,7 +251,7 @@ endif # make dist will collect files in .sources files from all profiles dist-local: dist-default subs=' ' ; \ - for f in `$(topdir)/tools/removecomments.sh $(wildcard *$(LIBRARY).sources)` $(TEST_FILES) ; do \ + for f in `$(topdir)/tools/removecomments.sh $(filter-out $(wildcard *_test.dll.sources) $(wildcard *_xtest.dll.sources) $(wildcard *exclude.sources),$(wildcard *.sources))` $(TEST_FILES) ; do \ case $$f in \ ../*) : ;; \ *.g.cs) : ;; \ @@ -273,14 +281,56 @@ endif # The library -$(the_lib): $(the_libdir)/.stamp +# If the directory contains the per profile include file, generate list file. +PROFILE_sources := $(firstword $(if $(PROFILE_PLATFORM),$(wildcard $(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY).sources)) $(wildcard $(PROFILE)_$(LIBRARY).sources) $(wildcard $(LIBRARY).sources)) +PROFILE_excludes = $(firstword $(if $(PROFILE_PLATFORM),$(wildcard $(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY).exclude.sources)) $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources)) -$(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) +# 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 = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).sources +$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(topdir)/build/gensources.sh $(depsdir)/.stamp + $(SHELL) $(topdir)/build/gensources.sh $@ '$(PROFILE_sources)' '$(PROFILE_excludes)' + +library_CLEAN_FILES += $(sourcefile) + +response = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).response +$(response): $(sourcefile) $(topdir)/build/library.make $(depsdir)/.stamp + $(PLATFORM_CHANGE_SEPARATOR_CMD) <$(sourcefile) >$@ + +library_CLEAN_FILES += $(response) + +makefrag = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).makefrag +$(makefrag): $(sourcefile) $(topdir)/build/library.make $(depsdir)/.stamp +# @echo Creating $@ ... + @sed 's,^,$(build_lib): ,' $< >$@ + @if test ! -f $(sourcefile).makefrag; then :; else \ + cat $(sourcefile).makefrag >> $@ ; \ + echo '$@: $(sourcefile).makefrag' >> $@; \ + echo '$(sourcefile).makefrag:' >> $@; fi + +library_CLEAN_FILES += $(makefrag) + +ifndef NO_BUILD +all-local: $(makefrag) +endif + +-include $(makefrag) + +$(the_lib): $(the_libdir)/.stamp $(if $(PROFILE_PLATFORM),$(if $(filter $(HOST_PLATFORM),$(BUILD_PLATFORM)),$(topdir)/class/$(lib_dir)/$(PROFILE)/.stamp)) + +ifdef PROFILE_PLATFORM +$(topdir)/class/$(lib_dir)/$(PROFILE)/.stamp: | $(topdir)/class/$(lib_dir)/$(PROFILE)-$(HOST_PLATFORM)/.stamp + $(if $(filter $(HOST_PLATFORM),$(BUILD_PLATFORM)),$(if $(filter $(BUILD_PLATFORM),win32),CYGWIN=winsymlinks:nativestrict) ln -s $(abspath $(topdir)/class/$(lib_dir)/$(PROFILE)-$(BUILD_PLATFORM)) $(abspath $(topdir)/class/$(lib_dir)/$(PROFILE))) +endif + +ifndef NO_BUILD + +$(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir)/.stamp $(GEN_RESOURCE_DEPS) $(MODULE_DEPS) + $(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(KEYFILE_MCS_FLAGS) $(GEN_RESOURCE_FLAGS) -target:library -out:$@ $(BUILT_SOURCES_cmdline) @$(response) ifdef RESOURCE_STRINGS_FILES - $(Q) $(STRING_REPLACER) $(RESOURCE_STRINGS_FILES) $@ + $(Q) $(STRING_REPLACER) $(RESOURCE_STRINGS_FILES) $(IL_REPLACE_FILES) $@ endif + $(Q) $(SN) -R $@ $(LIBRARY_SNK) ifdef LIBRARY_USE_INTERMEDIATE_FILE $(the_lib): $(build_lib) @@ -290,69 +340,40 @@ $(the_lib): $(build_lib) $(Q) test ! -f $(build_lib:.dll=.pdb) || mv $(build_lib:.dll=.pdb) $(the_lib:.dll=.pdb) endif -library_CLEAN_FILES += $(PROFILE)_aot.log +endif -ifdef PLATFORM_AOT_SUFFIX -Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] $(notdir $(@))";) +library_CLEAN_FILES += $(PROFILE)_$(LIBRARY_NAME)_aot.log +ifdef PLATFORM_AOT_SUFFIX $(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) all-local-aot: $(the_lib)$(PLATFORM_AOT_SUFFIX) endif - -makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).makefrag -library_CLEAN_FILES += $(makefrag) -$(makefrag): $(sourcefile) -# @echo Creating $@ ... - @sed 's,^,$(build_lib): ,' $< >$@ - @if test ! -f $(sourcefile).makefrag; then :; else \ - cat $(sourcefile).makefrag >> $@ ; \ - echo '$@: $(sourcefile).makefrag' >> $@; \ - echo '$(sourcefile).makefrag:' >> $@; fi - -ifneq ($(response),$(sourcefile)) - -ifdef PLATFORM_excludes -$(response): $(sourcefile) $(PLATFORM_excludes) - @echo Filtering $(sourcefile) to $@ ... - @sort $(sourcefile) $(PLATFORM_excludes) | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@ -else -$(response): $(sourcefile) - @echo Converting $(sourcefile) to $@ ... - @cat $(sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@ -endif - -endif - --include $(makefrag) - # for now, don't give any /lib flags or set MONO_PATH, since we # give a full path to the assembly. ## Include corcompare stuff include $(topdir)/build/corcompare.make -all-local: $(makefrag) $(test_makefrag) $(btest_makefrag) -ifneq ($(response),$(sourcefile)) -$(response): $(topdir)/build/library.make $(depsdir)/.stamp +ifndef NO_BUILD +all-local: $(test_makefrag) $(btest_makefrag) endif -$(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp -## Documentation stuff +$(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp -Q_MDOC_UP=$(if $(V),,@echo "MDOC-UP [$(PROFILE)] $(notdir $(@))";) -MDOC_UP =$(Q_MDOC_UP) \ - MONO_PATH="$(topdir)/class/lib/$(DEFAULT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/$(DEFAULT_PROFILE)/mdoc.exe \ - update --delete -o Documentation/en $(the_lib) +## Documentation stuff doc-update-local: $(the_libdir)/.doc-stamp $(the_libdir)/.doc-stamp: $(the_lib) - $(MDOC_UP) + $(MDOC_UP) $(the_lib) @echo "doc-stamp" > $@ # Need to be here so it comes after the definition of DEP_DIRS/DEP_LIBS gen-deps: @echo "$(DEPS_TARGET_DIR): $(DEP_DIRS) $(DEP_LIBS)" >> $(DEPS_FILE) + +update-corefx-sr: $(RESX_RESOURCE_STRING) + MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resx2sr.exe $(RESX_RESOURCE_STRING) >corefx/SR.cs