[mcs] Add platform specific files (#4837)
authorLudovic Henry <ludovic@xamarin.com>
Thu, 11 May 2017 23:19:09 +0000 (19:19 -0400)
committerGitHub <noreply@github.com>
Thu, 11 May 2017 23:19:09 +0000 (19:19 -0400)
* [mcs] Rework %-recursive target to explicitely list subdirectories

* [mcs] Rename PLATFORM to BUILD_PLATFORM

* [mcs] Add platform specific files

This is to support adding corefx platform specific files. To do that, we now support `mcs/class/corlib/linux_net_4_x_corlib.dll.sources` for example, on top of `mcs/class/corlib/net_4_x_corlib.dll.sources` and `mcs/class/corlib/corlib.dll.sources`.

The 3 platforms that are supported are: `linux`, `darwin` and `win32`.

* [mcs] Build cross-platform bcl in separate folder

12 files changed:
configure.ac
mcs/build/README.configury
mcs/build/README.makefiles
mcs/build/config-default.make
mcs/build/executable.make
mcs/build/library.make
mcs/build/profiles/net_4_x.make
mcs/build/profiles/xbuild_12.make
mcs/build/rules.make
mcs/class/System.Web.Extensions/Makefile
mcs/tools/mdoc/Makefile
mcs/tools/mono-service/Makefile

index 25c905871588f56aceb8e91bbb1a38ef4d5e5798..508f575b460b6b000d90c6f1328026029a50c8f4 100644 (file)
@@ -4555,7 +4555,19 @@ fi
     echo "MONO_CORLIB_VERSION = $MONO_CORLIB_VERSION" >> $mcs_topdir/build/config.make
 
     if test x$host_darwin = xyes; then
-      echo "PLATFORM = darwin" >> $mcs_topdir/build/config.make
+      echo "BUILD_PLATFORM = darwin" >> $mcs_topdir/build/config.make
+    elif test x$host_win32 = xyes; then
+      echo "BUILD_PLATFORM = win32" >> $mcs_topdir/build/config.make
+    else
+      echo "BUILD_PLATFORM = linux" >> $mcs_topdir/build/config.make
+    fi
+
+    if test x$host_darwin = xyes; then
+      echo "HOST_PLATFORM ?= darwin" >> $mcs_topdir/build/config.make
+    elif test x$host_win32 = xyes; then
+      echo "HOST_PLATFORM ?= win32" >> $mcs_topdir/build/config.make
+    else
+      echo "HOST_PLATFORM ?= linux" >> $mcs_topdir/build/config.make
     fi
 
     if test "x$PLATFORM_AOT_SUFFIX" != "x"; then
index 52732e6bdade99f0e877272a7198dc2290f3e488..7fbd1bcb10a8dcf4eacf5200fafa25a6a887176a 100644 (file)
@@ -6,12 +6,12 @@ Peter Williams <peter@newton.cx>
 It's pretty easy. You can create two files in this directory to tweak
 settings: pre-config.make and config.make.
 
-pre-config.make is included before $(PLATFORM).make and
+pre-config.make is included before $(BUILD_PLATFORM).make and
 $(PROFILE).make, so you can set either of these variables if you want
 to change the default.
 
 Just about any other change should go in config.make, which is
-included after $(PLATFORM).make and $(PROFILE).make, so you can use
+included after $(BUILD_PLATFORM).make and $(PROFILE).make, so you can use
 the values defined in those files if you wish. For example,
 
     MCS_FLAGS = $(DEFAULT_MCS_FLAGS) /my-experimental-optimizer-flag
index f5b95a5a32e011e5a092d80d945a1136cbf634ff..9453d4e0b91fc3d29eb80b7e7461352ce21018de 100644 (file)
@@ -119,8 +119,8 @@ Configuration variables are given defaults in `config-default.make';
 `rules.make' optionally includes `$(topdir)/build/config.make', so you
 can customize your build without CVS trying to commit your modified
 `config-default.make' all the time.  Platform-specific variables are
-defined in `$(topdir)/build/platforms/$(PLATFORM).make', where
-$(PLATFORM) is detected in config-default.make. (Currently, the only
+defined in `$(topdir)/build/platforms/$(BUILD_PLATFORM).make', where
+$(BUILD_PLATFORM) is detected in config-default.make. (Currently, the only
 choices are linux.make and win32.make.)
 
 The best way to learn what the configuration variables are is to read
index 40d2c6f1c758d2a32a23caf2f1be29e0a52be328..6120d57882fc985bd47050aa3fe50a1ff09a068e 100644 (file)
@@ -10,7 +10,7 @@
 CODEPAGE = 65001
 
 RUNTIME_FLAGS =
-TEST_HARNESS = $(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-lite-console.exe
+TEST_HARNESS = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/$(PARENT_PROFILE)nunit-lite-console.exe
 PLATFORM_DEBUG_FLAGS = /debug:portable
 MCS_FLAGS = 
 MBAS_FLAGS = -debug
@@ -24,7 +24,7 @@ mono_libdir = $(exec_prefix)/lib
 sysconfdir = $(prefix)/etc
 #RUNTIME = mono
 RUNTIME = false
-TEST_RUNTIME = MONO_PATH="./$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
+TEST_RUNTIME = MONO_PATH="./$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/$(PROFILE_DIRECTORY)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
 
 # In case you want to add MCS_FLAGS, this lets you not have to
 # keep track of the default value
index 1a9ffab0e7f5d774e95bc328d436941d260fc7c0..902697219b4e6b84bb791bc4a74fab9239f32e6f 100644 (file)
@@ -19,7 +19,7 @@ executable_CLEAN_FILES += $(response)
 endif
 
 ifndef the_libdir
-the_libdir = $(topdir)/class/lib/$(PROFILE)/
+the_libdir = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/
 ifdef PROGRAM_USE_INTERMEDIATE_FILE
 build_libdir = $(the_libdir)tmp/
 else
@@ -42,8 +42,8 @@ executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_
 
 makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
 
-MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(LIB_REFS))
-MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.exe,$(EXE_REFS))
+MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS))
+MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.exe,$(EXE_REFS))
 
 ifndef NO_BUILD
 all-local: $(the_lib) $(PROGRAM_config)
@@ -117,7 +117,12 @@ ifndef PROGRAM_COMPILE
 PROGRAM_COMPILE = $(CSCOMPILE)
 endif
 
-$(the_lib): $(the_libdir)/.stamp
+$(the_lib): $(the_libdir)/.stamp $(if $(PROFILE_PLATFORM),$(if $(filter $(HOST_PLATFORM),$(BUILD_PLATFORM)),$(topdir)/class/lib/$(PROFILE)/.stamp))
+
+ifdef PROFILE_PLATFORM
+$(topdir)/class/lib/$(PROFILE)/.stamp: | $(topdir)/class/lib/$(PROFILE)-$(HOST_PLATFORM)/.stamp
+       $(if $(filter $(HOST_PLATFORM),$(BUILD_PLATFORM)),$(if $(filter $(BUILD_PLATFORM),win32),CYGWIN=winsymlinks:nativestrict) ln -s $(abspath $(topdir)/class/lib/$(PROFILE)-$(BUILD_PLATFORM)) $(abspath $(topdir)/class/lib/$(PROFILE)))
+endif
 
 $(build_lib): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) $(build_libdir:=/.stamp)
        $(PROGRAM_COMPILE) $(MCS_REFERENCES) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
index 2e04a3a359555c76695cc522937ee4ddce2c1b30..6f3e0a8c2d2a4f460a8ba4669874d98068726a01 100644 (file)
@@ -23,37 +23,8 @@ _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)
-
-# 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
-
-PLATFORM_excludes := $(wildcard $(LIBRARY).$(PLATFORM)-excludes)
-
-ifndef PLATFORM_excludes
-ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
-response = $(sourcefile)
-endif
-endif
-
-ifndef response
-response = $(depsdir)/$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).response
-library_CLEAN_FILES += $(response)
-endif
+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)))
 
 ifndef LIBRARY_NAME
 LIBRARY_NAME = $(LIBRARY)
@@ -65,11 +36,7 @@ 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
 ifneq (basic, $(PROFILE))
@@ -110,7 +77,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
@@ -296,11 +263,51 @@ 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))
+
+# 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)
+$(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) $@
@@ -317,7 +324,7 @@ endif
 
 endif
 
-library_CLEAN_FILES += $(PROFILE)_aot.log
+library_CLEAN_FILES += $(PROFILE)_$(LIBRARY_NAME)_aot.log
 
 ifdef PLATFORM_AOT_SUFFIX
 $(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib)
@@ -326,33 +333,6 @@ $(the_lib)$(PLATFORM_AOT_SUFFIX): $(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.
 
@@ -360,25 +340,17 @@ endif
 include $(topdir)/build/corcompare.make
 
 ifndef NO_BUILD
-all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
+all-local: $(test_makefrag) $(btest_makefrag)
 endif
 
-ifneq ($(response),$(sourcefile))
-$(response): $(topdir)/build/library.make $(depsdir)/.stamp
-endif
-$(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp
+$(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp
 
 ## Documentation stuff
 
-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)
-
 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
index a63c7a29e951fbd05b75728a00f2756f5ea68ea8..a4965ddc99e02086fa9fe30fd368932b7d883595 100644 (file)
@@ -5,12 +5,14 @@ BOOTSTRAP_PROFILE = build
 BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC)
 MCS = $(BOOTSTRAP_MCS)
 
+PLATFORMS = darwin linux win32
+
 # nuttzing!
 
 profile-check:
        @:
 
-DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
+DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll
 PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -d:MULTIPLEX_OS -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
 
 FRAMEWORK_VERSION = 4.5
index c54c946c5040170262fc51edc2ddb377abd3d33d..b73af545a679fb4dbb0844eadf48d8cb4bc13118 100644 (file)
@@ -2,8 +2,8 @@
 
 include $(topdir)/build/profiles/net_4_x.make
 
-PARENT_PROFILE = ../net_4_x/
-DEFAULT_REFERENCES = -r:$(topdir)/class/lib/net_4_x/mscorlib.dll
+PARENT_PROFILE = ../net_4_x$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM))/
+DEFAULT_REFERENCES = -r:$(topdir)/class/lib/net_4_x$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM))/mscorlib.dll
 PROFILE_MCS_FLAGS += -d:XBUILD_12
 
 XBUILD_VERSION = 12.0
index 2ddd55efb21edfc8960cf68fe601fde37ea590dc..7e1ee2124c10012f0cd1b60c8d9502eba006d407 100644 (file)
@@ -22,8 +22,8 @@ VERSION = 0.93
 
 Q=$(if $(V),,@)
 # echo -e "\\t" does not work on some systems, so use 5 spaces
-Q_MCS=$(if $(V),,@echo "$(if $(MCS_MODE),MCS,CSC)     [$(intermediate)$(PROFILE)] $(notdir $(@))";)
-Q_AOT=$(if $(V),,@echo "AOT     [$(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
 BUILD_TOOLS_PROFILE = build
@@ -56,7 +56,6 @@ depsdir = $(topdir)/build/deps
 
 # Make sure these propagate if set manually
 
-export PLATFORM
 export PROFILE
 export MCS
 export MCS_FLAGS
@@ -75,31 +74,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)
@@ -224,37 +210,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
 #
@@ -287,16 +270,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
@@ -337,6 +310,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
index dc21bcf31c1cea9773e28c1c19748bab0f7657a4..9660692d0db17f64e0ad6b4cc43c76ad8dbbdaae 100644 (file)
@@ -86,7 +86,7 @@ $(STANDALONE_TEST_ASSEMBLY): $(the_assembly) Test/standalone-tests/Consts.cs
        $(CSCOMPILE) $(STANDALONE_TEST_MCS_FLAGS) -out:$@ -target:library @System.Web.Extensions_standalone_test.dll.sources
 
 Test/standalone-tests/Consts.cs: Test/standalone-tests/Consts.cs.in
-ifeq ($(PLATFORM), win32)
+ifeq ($(BUILD_PLATFORM), win32)
        @sed 's,@SystemWebExtensionsClassDir@,$(shell cygpath -a -m .),' $< > $@
 else
        @sed 's,@SystemWebExtensionsClassDir@,$(shell pwd),' $< > $@
index 4c8bfb4208b9bea42447c8fa4c9ad77f6d0d2935..d0f83022fbc7f17257cfa7f370b8e23b96a5c5ba 100644 (file)
@@ -62,7 +62,7 @@ MONO = \
 
 DIFF = diff -rup
 DIFF_QUIET = diff --brief
-ifeq ($(PLATFORM), win32)
+ifeq ($(BUILD_PLATFORM), win32)
 DIFF = diff -rupZ
 DIFF_QUIET = diff --brief -Z
 endif
index cdca30fb3fbe5489a9eb10852ebb1d49e7a3b639..e27822addc65e0fda8465c0975549a93b25bc035 100644 (file)
@@ -14,7 +14,7 @@ LIB_REFS = System.ServiceProcess Mono.Posix System
 # Copied from library.make
 
 # -- begin --
-ifeq ($(PLATFORM), win32)
+ifeq ($(BUILD_PLATFORM), win32)
 GACDIR = `cygpath -w $(mono_libdir)`
 GACROOT = `cygpath -w $(DESTDIR)$(mono_libdir)`
 test_flags += -d:WINDOWS