X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fbuild%2Frules.make;h=8fce9aea29e32dc90ef41c0220c83099733445c5;hb=411a37af27905eaa44dac1a31f6387a11c0b0244;hp=e2ed20ae03d8c53c019548831a226072c296a015;hpb=22dd4418234f293312118f66dd5bb45fc2836cfc;p=mono.git diff --git a/mcs/build/rules.make b/mcs/build/rules.make index e2ed20ae03d..8fce9aea29e 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -9,6 +9,7 @@ empty := space := $(empty) $(empty) +_FILTER_OUT = $(foreach x,$(2),$(if $(findstring $(1),$(x)),,$(x))) # given $(thisdir), we compute the path to the top directory # @@ -22,16 +23,22 @@ VERSION = 0.93 Q=$(if $(V),,@) # echo -e "\\t" does not work on some systems, so use 5 spaces -Q_MCS=$(if $(V),,@echo "MCS [$(intermediate)$(PROFILE)] $(notdir $(@))";) +Q_MCS=$(if $(V),,@echo "$(if $(MCS_MODE),MCS,CSC) [$(intermediate)$(PROFILE_DIRECTORY)] $(notdir $(@))";) +Q_AOT=$(if $(V),,@echo "AOT [$(intermediate)$(PROFILE_DIRECTORY)] $(notdir $(@))";) ifndef BUILD_TOOLS_PROFILE +ifeq ($(PROFILE),basic) +BUILD_TOOLS_PROFILE = basic +else BUILD_TOOLS_PROFILE = build endif +endif -USE_MCS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS) +USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS) USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS) USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) $(CPPFLAGS) CSCOMPILE = $(Q_MCS) $(MCS) $(USE_MCS_FLAGS) +CSC_RUNTIME_FLAGS = --aot-path=$(abspath $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)) --gc-params=nursery-size=64m BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS) CCOMPILE = $(CC) $(USE_CFLAGS) BOOT_COMPILE = $(Q_MCS) $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS) @@ -41,20 +48,20 @@ INSTALL_BIN = $(INSTALL) -c -m 755 INSTALL_LIB = $(INSTALL_BIN) MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs INTERNAL_MBAS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mbas/mbas.exe -INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/mcs.exe -INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe -INTERNAL_CSC = $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION) +INTERNAL_CSC_LOCATION = $(CSC_LOCATION) + +# Using CSC_SDK_PATH_DISABLED for sanity check that all references have path specified +INTERNAL_CSC = CSC_SDK_PATH_DISABLED= $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_RUNTIME_FLAGS) $(INTERNAL_CSC_LOCATION) -RESGEN_EXE = $(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)resgen.exe -INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(RESGEN_EXE) -RESGEN = MONO_PATH="$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_RESGEN) +RESGEN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resgen.exe STRING_REPLACER = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/cil-stringreplacer.exe +ILASM = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/ilasm.exe + depsdir = $(topdir)/build/deps # Make sure these propagate if set manually -export PLATFORM export PROFILE export MCS export MCS_FLAGS @@ -73,31 +80,18 @@ export RESGEN default: all # Get initial configuration. pre-config is so that the builder can -# override PLATFORM or PROFILE +# override BUILD_PLATFORM or PROFILE include $(topdir)/build/config-default.make -include $(topdir)/build/pre-config.make -include $(topdir)/build/config.make -# Default PLATFORM and PROFILE if they're not already defined. - -ifndef PLATFORM -ifeq ($(OS),Windows_NT) -ifneq ($(V),) -$(info *** Assuming PLATFORM is 'win32'.) -endif -PLATFORM = win32 -else -ifneq ($(V),) -$(info *** Assuming PLATFORM is 'linux'.) -endif -PLATFORM = linux -endif -endif - # Platform config -include $(topdir)/build/platforms/$(PLATFORM).make +include $(topdir)/build/platforms/$(BUILD_PLATFORM).make + +PROFILE_PLATFORM = $(if $(PLATFORMS),$(if $(filter $(PLATFORMS),$(HOST_PLATFORM)),$(HOST_PLATFORM),$(error Unknown platform "$(HOST_PLATFORM)" for profile "$(PROFILE)"))) +PROFILE_DIRECTORY = $(PROFILE)$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM)) ifdef PLATFORM_CORLIB corlib = $(PLATFORM_CORLIB) @@ -116,24 +110,17 @@ endif include $(topdir)/build/profiles/$(PROFILE).make -# If the profile is using nunit-lite, use it -ifdef NUNIT_LITE -TEST_HARNESS=$(topdir)/class/lib/$(PROFILE)/nunit-lite-console.exe +ifdef BCL_OPTIMIZE +PROFILE_MCS_FLAGS += -optimize endif -# Make sure propagates -export TEST_HARNESS +ifdef MCS_MODE +INTERNAL_CSC_LOCATION = $(topdir)/class/lib/$(BOOTSTRAP_PROFILE)/mcs.exe -# If the profile is using nunit-lite, use it -ifdef NUNIT_LITE -TEST_HARNESS=$(topdir)/class/lib/$(PROFILE)/nunit-lite-console.exe +ifdef PLATFORM_DEBUG_FLAGS +PLATFORM_DEBUG_FLAGS = /debug:full endif -# Make sure propagates -export TEST_HARNESS - -ifdef BCL_OPTIMIZE -PROFILE_MCS_FLAGS += -optimize endif # Design: @@ -143,7 +130,7 @@ endif # For this to be done safely, we really need two passes. This # ensures that all of the .dlls are compiled before trying to # aot them. Because we want this to be the -# default target for some profiles(mobile_static) we have a +# default target for some profiles(testing_aot_full) we have a # two-level build system. The do-all-aot target is what # gets invoked at the top-level when someone tries to build with aot. # It will invoke the do-all target, and will set TOP_LEVEL_DO for this @@ -179,7 +166,6 @@ STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update $(STD_TARGETS): %: do-% ifdef PLATFORM_AOT_SUFFIX -AOT_PROFILE_ASSEMBLIES = $(shell cd $(topdir)/class/lib/$(PROFILE)/ && find . | grep -E '(dll|exe)$$' | grep -v -E 'bare|plaincore|secxml|Facades' | sed 's:\./::g' | tr '\n' ' ') do-all-aot: $(MAKE) do-all TOP_LEVEL_DO=do-all @@ -190,18 +176,26 @@ do-all-aot: # be able to evaluate the .dylibs to make ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","") -AOT_PROFILE_ASSEMBLIES_CMD = cd $(topdir)/class/lib/$(PROFILE)/ && find . | grep -E '(dll|exe)$$' | grep -v -E 'bare|plaincore|secxml|Facades|ilasm' | sed 's:\./::g' | tr '\n' ' ' -AOT_PROFILE_ASSEMBLIES_CMD_SAFE = $(AOT_PROFILE_ASSEMBLIES_CMD) || true -AOT_PROFILE_ASSEMBLIES = $(shell $(AOT_PROFILE_ASSEMBLIES_CMD_SAFE)) +AOT_PROFILE_ASSEMBLIES := $(sort $(patsubst .//%,%,$(filter-out %.dll.dll %.exe.dll %bare% %plaincore% %secxml% %Facades% %ilasm%,$(filter %.dll %.exe,$(wildcard $(topdir)/class/lib/$(PROFILE)/*))))) # This can run in parallel .PHONY: aot-all-profile -aot-all-profile: $(patsubst %,$(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_ASSEMBLIES)) +ifdef AOT_BUILD_FLAGS +aot-all-profile: $(patsubst %,%$(PLATFORM_AOT_SUFFIX),$(AOT_PROFILE_ASSEMBLIES)) +else +aot-all-profile: + echo AOT_BUILD_FLAGS not set, skipping AOT. +endif + +%.dll$(PLATFORM_AOT_SUFFIX): %.dll + @ mkdir -p $<_bitcode_tmp + $(Q_AOT) MONO_PATH="$(dir $<)" $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$<_bitcode_tmp --verbose $< > $@.aot-log + @ rm -rf $<_bitcode_tmp -$(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUFFIX): $(topdir)/class/lib/$(PROFILE)/% - @ mkdir -p $(topdir)/class/lib/$(PROFILE)/$*_bitcode_tmp - @echo "AOT [$(PROFILE)] AOT $* " && cd $(topdir)/class/lib/$(PROFILE)/ && MONO_PATH="." $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$*_bitcode $* >> $(PROFILE)-aot.log - @ rm -rf $(topdir)/class/lib/$(PROFILE)/$*_bitcode_tmp +%.exe$(PLATFORM_AOT_SUFFIX): %.exe + @ mkdir -p $<_bitcode_tmp + $(Q_AOT) MONO_PATH="$(dir $<)" $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$<_bitcode_tmp --verbose $< > $@.aot-log + @ rm -rf $<_bitcode_tmp endif #ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","") @@ -222,37 +216,34 @@ csproj: do-csproj # be listed _before_ including rules.make. However, the default # SUBDIRS list can come after, so don't use the eager := syntax when # using the defaults. -PROFILE_SUBDIRS := $($(PROFILE)_SUBDIRS) -ifndef PROFILE_SUBDIRS -PROFILE_SUBDIRS = $(SUBDIRS) -endif +PROFILE_SUBDIRS = $(or $($(PROFILE)_SUBDIRS),$(SUBDIRS)) # These subdirs can be built in parallel -PROFILE_PARALLEL_SUBDIRS := $($(PROFILE)_PARALLEL_SUBDIRS) -ifndef PROFILE_PARALLEL_SUBDIRS -PROFILE_PARALLEL_SUBDIRS = $(PARALLEL_SUBDIRS) -endif +PROFILE_PARALLEL_SUBDIRS = $(or $($(PROFILE)_PARALLEL_SUBDIRS),$(PARALLEL_SUBDIRS)) ifndef FRAMEWORK_VERSION_MAJOR FRAMEWORK_VERSION_MAJOR = $(basename $(FRAMEWORK_VERSION)) endif %-recursive: - @set . $$MAKEFLAGS; final_exit=:; \ + @set . $$MAKEFLAGS; \ case $$2 in --unix) shift ;; esac; \ case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \ - list='$(PROFILE_SUBDIRS)'; for d in $$list ; do \ - (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \ - done; \ - if [ $* = "all" -a -n "$(PROFILE_PARALLEL_SUBDIRS)" ]; then \ - $(MAKE) do-all-parallel ENABLE_PARALLEL_SUBDIR_BUILD=1 || { final_exit="exit 1"; $$dk; } ; \ - else \ - list='$(PROFILE_PARALLEL_SUBDIRS)'; for d in $$list ; do \ - (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \ - done; \ - fi; \ + final_exit=:; \ + $(foreach subdir,$(PROFILE_SUBDIRS),$(MAKE) -C $(subdir) $* || { final_exit="exit 1"; $$dk; };) \ + $(if $(PROFILE_PARALLEL_SUBDIRS), \ + $(if $(filter $*,all), \ + $(MAKE) $(PROFILE_PARALLEL_SUBDIRS) ENABLE_PARALLEL_SUBDIR_BUILD=1 || { final_exit="exit 1"; $$dk; };, \ + $(foreach subdir,$(PROFILE_PARALLEL_SUBDIRS),$(MAKE) -C $(subdir) $* || { final_exit="exit 1"; $$dk; };))) \ $$final_exit +ifdef ENABLE_PARALLEL_SUBDIR_BUILD +.PHONY: $(PROFILE_PARALLEL_SUBDIRS) +$(PROFILE_PARALLEL_SUBDIRS): + @set . $$MAKEFLAGS; \ + $(MAKE) -C $@ all +endif + # # Parallel build support # @@ -285,16 +276,6 @@ clean-dep-dir: clean-local: clean-dep-dir -ifdef ENABLE_PARALLEL_SUBDIR_BUILD -.PHONY: do-all-parallel $(PROFILE_PARALLEL_SUBDIRS) - -do-all-parallel: $(PROFILE_PARALLEL_SUBDIRS) - -$(PROFILE_PARALLEL_SUBDIRS): - @set . $$MAKEFLAGS; \ - cd $@ && $(MAKE) -endif - ifndef DIST_SUBDIRS DIST_SUBDIRS = $(SUBDIRS) $(DIST_ONLY_SUBDIRS) endif @@ -335,6 +316,8 @@ dist-default: ## Documentation stuff -Q_MDOC =$(if $(V),,@echo "MDOC [$(PROFILE)] $(notdir $(@))";) +Q_MDOC =$(if $(V),,@echo "MDOC [$(PROFILE_DIRECTORY)] $(notdir $(@))";) MDOC =$(Q_MDOC) MONO_PATH="$(topdir)/class/lib/$(DEFAULT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/class/lib/$(DEFAULT_PROFILE)/mdoc.exe +Q_MDOC_UP=$(if $(V),,@echo "MDOC-UP [$(PROFILE_DIRECTORY)] $(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