[bcl] Enable parallel build for parts of the 4.5 class libs/tools.
authorZoltan Varga <vargaz@gmail.com>
Sat, 28 Feb 2015 00:46:29 +0000 (19:46 -0500)
committerZoltan Varga <vargaz@gmail.com>
Sat, 28 Feb 2015 00:46:29 +0000 (19:46 -0500)
mcs/build/executable.make
mcs/build/library.make
mcs/build/rules.make
mcs/class/Makefile
mcs/class/System.ServiceModel/Makefile
mcs/tools/Makefile
mcs/tools/tuner/Makefile

index 82f888dc7563f1d8db803c64c3fd69dab5d6376d..a7bc74f44acb43e6fe6765e3f7b016029a6a0f52 100644 (file)
@@ -166,3 +166,6 @@ $(makefrag): $(topdir)/build/executable.make $(depsdir)/.stamp
 doc-update-local:
        @:
 
+# 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)
index e4127f4549376c798435cfbcc817575c84ee7f07..207fdd477f882480c553ffab7f003d6340c1e9ad 100644 (file)
@@ -8,6 +8,10 @@
 # All the dep files now land in the same directory so we
 # munge in the library name to keep the files from clashing.
 
+# All dependent libs become dependent dirs for parallel builds
+# Have to rename to handle differences between assembly/directory names
+DEP_LIBS=$(subst System.Xml,System.XML,$(subst System.Windows.Forms,Managed.Windows.Forms,$(LIB_REFS)))
+
 sourcefile = $(LIBRARY).sources
 
 # If the directory contains the per profile include file, generate list file.
@@ -345,3 +349,6 @@ $(the_libdir)/.doc-stamp: $(the_lib)
        $(MDOC_UP)
        @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)
index 645a90d7dc9adca539659d8dc3db14d1ebc3f740..5f211f480a63f20ffe1ed9757869c289d71a963c 100644 (file)
@@ -156,6 +156,12 @@ ifndef PROFILE_SUBDIRS
 PROFILE_SUBDIRS = $(SUBDIRS)
 endif
 
+# These subdirs can be built in parallel
+PROFILE_PARALLEL_SUBDIRS := $($(PROFILE)_PARALLEL_SUBDIRS)
+ifndef PROFILE_PARALLEL_SUBDIRS
+PROFILE_PARALLEL_SUBDIRS = $(PARALLEL_SUBDIRS)
+endif
+
 ifndef FRAMEWORK_VERSION_MAJOR
 FRAMEWORK_VERSION_MAJOR = $(basename $(FRAMEWORK_VERSION))
 endif
@@ -167,8 +173,60 @@ endif
        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
 
+#
+# Parallel build support
+#
+# The variable $(PROFILE)_PARALLEL_SUBDIRS should be set to the list of directories
+# which could be built in parallel. These directories are built after the directories in
+# $(PROFILE)_SUBDIRS.
+# Parallel building is currently only supported for the 'all' target.
+#
+# Each directory's Makefile may define DEP_LIBS and DEP_DIRS to specify the libraries and
+# directories it depends on.
+#
+# It would be nice to reduce the duplication between DEP_LIBS and LIB_MCS_FLAGS, but
+# there are too many special cases
+# (System.Windows.Forms/Managed.Windows.Forms,System.Xml/System.XML) etc.
+ifneq ($(PROFILE_PARALLEL_SUBDIRS),)
+dep_dirs = .dep_dirs-$(PROFILE)
+$(dep_dirs):
+       @echo "Creating $@..."
+       list='$(PROFILE_PARALLEL_SUBDIRS)'; \
+       echo > $@; \
+       for d in $$list; do \
+               $(MAKE) -C $$d gen-deps DEPS_TARGET_DIR=$$d DEPS_FILE=$(abspath $@); \
+       done
+-include $(dep_dirs)
+endif
+
+.PHONY: gen-deps
+# The gen-deps target is in library.make/executable.make so it can pick up
+# DEP_LIBS/DEP_DIRS
+
+clean-dep-dir:
+       $(RM) $(dep_dirs)
+
+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
index 8200c5d5e59cb0dc6ef5a491e8754bae86570a58..08c96719ec5e351c18ed1bcb4e912e959e98f211 100644 (file)
@@ -84,8 +84,7 @@ net_4_5_dirs := \
        System.Core                     \
        Mono.Security                   \
        System.Security                 \
-       System.Configuration            \
-       I18N                            \
+       System.Configuration    \
        $(resgen_dir)                   \
        System.Drawing                  \
        System.Transactions             \
@@ -105,33 +104,19 @@ net_4_5_dirs := \
        System.Configuration.Install    \
        System.Management               \
        System.Data.OracleClient        \
-       Microsoft.VisualC               \
        Cscompmgd                       \
-       PEAPI                           \
        Commons.Xml.Relaxng             \
-       Novell.Directory.Ldap           \
-       Mono.Security.Win32             \
-       System.DirectoryServices        \
-       System.DirectoryServices.Protocols      \
-       RabbitMQ.Client                 \
        Mono.Messaging                  \
        System.Messaging                \
-       Mono.Messaging.RabbitMQ         \
        System.ServiceProcess           \
        System.Drawing.Design           \
        System.Design                   \
        ICSharpCode.SharpZipLib         \
-       Mono.Http                       \
-       Mono.Cairo                      \
        IBM.Data.DB2                    \
        CustomMarshalers                \
-       Mono.Cecil                      \
-       Mono.Cecil.Mdb                  \
-       Mono.Debugger.Soft              \
        SystemWebTestShim                       \
        System.Xml.Linq                 \
        System.Runtime.Serialization    \
-       System.Data.DataSetExtensions   \
        System.Data.Linq                \
        System.Web.Abstractions         \
        System.Web.Routing              \
@@ -141,18 +126,10 @@ net_4_5_dirs := \
        System.Web.Extensions           \
        System.Web.Extensions.Design    \
        System.Web.DynamicData          \
-       Mono.C5                         \
-       Mono.Management                 \
-       Mono.Options                    \
-       Mono.Simd                       \
-       Mono.Tasklets                   \
-       System.Dynamic                  \
        Mono.CSharp                     \
        System.Net                      \
        System.Json             \
-       System.Numerics         \
        Microsoft.CSharp        \
-       System.Windows.Forms.DataVisualization  \
        System.Xaml \
        WindowsBase \
        System.ServiceModel.Activation \
@@ -160,7 +137,41 @@ net_4_5_dirs := \
        System.ServiceModel.Discovery \
        System.Runtime.Caching \
        System.Runtime.DurableInstancing \
+       Microsoft.Web.Infrastructure \
+       System.ServiceModel.Web \
+       System.Net.Http \
+       System.Net.Http.WebRequest \
+       System.Web.Razor \
+       System.Web.WebPages.Deployment \
+       System.Web.WebPages \
+       System.Web.WebPages.Razor \
+       System.Web.Mvc3 \
+       System.Net.Http.Formatting \
+       System.Web.Http \
+       System.Web.Http.SelfHost \
+       System.Web.Http.WebHost
+
+# These are the subdirs which depends on libs in net_4_5_dirs
+# or have proper dependencies between each other
+net_4_5_parallel_dirs := \
+       PEAPI                           \
+       I18N                            \
+       Mono.Http                       \
+       Mono.Cairo                      \
+       Mono.Cecil                      \
+       Mono.Cecil.Mdb                  \
+       Mono.Debugger.Soft              \
+       Mono.C5                         \
+       Mono.Management                 \
+       Mono.Options                    \
+       Mono.Simd                       \
+       Mono.Tasklets                   \
+       Mono.CodeContracts \
        Mono.Parallel \
+       Mono.Security.Win32             \
+       Mono.Messaging.RabbitMQ         \
+       System.Dynamic                  \
+       System.Windows.Forms.DataVisualization  \
        System.Reactive.Interfaces \
        System.Reactive.Core \
        System.Reactive.Linq \
@@ -172,32 +183,25 @@ net_4_5_dirs := \
        System.Reactive.Observable.Aliases \
        System.Reactive.Experimental \
        System.Reactive.Debugger \
-       Microsoft.Web.Infrastructure \
-       WebMatrix.Data \
-       System.ServiceModel.Web \
        System.Data.Services.Client     \
        System.Data.Services \
-       System.Json.Microsoft \
        System.Data.Entity \
-       monodoc \
+       System.Data.DataSetExtensions   \
+       System.Json.Microsoft \
        System.Threading.Tasks.Dataflow \
        System.ComponentModel.Composition.4.5 \
-       System.Net.Http \
-       System.Net.Http.WebRequest \
-       System.Web.Razor \
-       System.Web.WebPages.Deployment \
-       System.Web.WebPages \
-       System.Web.WebPages.Razor \
-       System.Web.Mvc3 \
-       System.Net.Http.Formatting \
-       System.Web.Http \
-       System.Web.Http.SelfHost \
-       System.Web.Http.WebHost \
-       Mono.CodeContracts \
        System.IO.Compression \
        System.IO.Compression.FileSystem \
        System.Windows \
        System.Xml.Serialization \
+       System.Numerics         \
+       Novell.Directory.Ldap           \
+       System.DirectoryServices        \
+       System.DirectoryServices.Protocols      \
+       RabbitMQ.Client                 \
+       Microsoft.VisualC               \
+       WebMatrix.Data \
+       monodoc \
        $(pcl_facade_dirs)
 
 xbuild_2_0_dirs := \
@@ -218,7 +222,8 @@ mobile_static_SUBDIRS := $(mobile_static_dirs)
 mobile_SUBDIRS := $(mobile_dynamic_dirs)
 xammac_SUBDIRS := $(xammac_dirs)
 net_4_0_SUBDIRS := reference-assemblies
-net_4_5_SUBDIRS := $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
+net_4_5_SUBDIRS := $(net_4_5_dirs) $(xbuild_4_0_dirs)
+net_4_5_PARALLEL_SUBDIRS := $(net_4_5_parallel_dirs) aot-compiler
 xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
 xbuild_14_SUBDIRS := $(xbuild_4_0_dirs)
 
index 0ef8e6e2811a72a8312f225f1f9250b607b2e9de..fd5d3a0700b3e512e9680ddfbb54e25261ec087e 100644 (file)
@@ -40,10 +40,11 @@ LIB_MCS_FLAGS += /r:System.Web.ApplicationServices.dll
 activation = $(the_libdir_base)System.ServiceModel.Activation.dll
 servicemodel_deps = $(activation)
 
-ifneq (plainservice/,$(intermediate))
 LIB_REFS += System.ServiceModel.Activation
-LIB_MCS_FLAGS += -define:HAS_ACTIVATION -r:System.ServiceModel.Activation.dll
 LIB_REFS += System.Web.ApplicationServices
+
+ifneq (plainservice/,$(intermediate))
+LIB_MCS_FLAGS += -define:HAS_ACTIVATION -r:System.ServiceModel.Activation.dll
 LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll
 endif
 endif
index afb9ddc89bf6b5dac17d5952cd4728bae6c98aa2..e0cd94e8cbf6fabead2dca9f8c88e9c964dd224d 100644 (file)
@@ -48,7 +48,8 @@ net_4_5_dirs := \
        symbolicate
 
 build_SUBDIRS = gacutil security culevel
-net_4_5_SUBDIRS := $(net_4_5_dirs)
+net_4_5_SUBDIRS = gacutil
+net_4_5_PARALLEL_SUBDIRS = $(net_4_5_dirs)
 
 SUBDIRS = $(basic_SUBDIRS) $(net_4_5_dirs)
 
index b3de3da911736990e4d7f8fbe7df40bc3248825b..bfc24a16c459ce42a05b821a4e7ef530b6024f46 100644 (file)
@@ -1,5 +1,6 @@
 thisdir = tools/tuner
 SUBDIRS =
+DEP_DIRS = linker
 include ../../build/rules.make
 
 CECIL = $(topdir)/class/lib/$(PROFILE)/Mono.Cecil.dll