[commit: ghc] master: Build system: fix `make -j1` (#10973) (3340fe0)

git at git.haskell.org git at git.haskell.org
Sat Oct 17 09:18:54 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3340fe01bc6842c2cad53271541dce6699512ce0/ghc

>---------------------------------------------------------------

commit 3340fe01bc6842c2cad53271541dce6699512ce0
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Fri Oct 16 20:28:05 2015 +0200

    Build system: fix `make -j1` (#10973)
    
    There are multiple hacks all over the build system to account for the
    fact that the ghc package uses different build subdirectories
    (stage1/stage2) than the other packages (dist/dist-install).
    
    One such hack filtered on 'ghc%', with the intention of filtering the
    ghc package only. After renaming bin-package-db to ghc-boot
    (d2f9972a35ce05ceb8a78893e433ef1df06f73ef, Phab:D1313, #10796), ghc-boot
    also got caught in the hack, which broke the build when running without
    parallelism.
    
    This patch replaces the before mentioned hack by a different one, such
    that filtering on 'ghc%' is no longer necessary. See Note [inconsistent
    distdirs].
    
    Reviewed by: austin
    
    Differential Revision: https://phabricator.haskell.org/D1333


>---------------------------------------------------------------

3340fe01bc6842c2cad53271541dce6699512ce0
 rules/build-package-way.mk | 4 ++++
 rules/build-package.mk     | 8 ++++++++
 rules/build-prog.mk        | 7 +------
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index 2257821..2dc43ff 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -36,11 +36,15 @@ endif
 endif
 
 # Note [inconsistent distdirs]
+#
 # hack: the DEPS_LIBS mechanism assumes that the distdirs for packages
 # that depend on each other are the same, but that is not the case for
 # ghc where we use stage1/stage2 rather than dist/dist-install.
 # Really we should use a consistent scheme for distdirs, but in the
 # meantime we work around it by defining ghc-<ver>_dist-install_way_LIB:
+#
+# A similar hack is applied to the PROGRAM_DEP_LIB mechanism in
+# rules/build-package.mk.
 ifeq "$$($1_PACKAGE) $2" "ghc stage2"
 $$($1_$2_COMPONENT_ID)_dist-install_$3_LIB = $$($1_$2_$3_LIB)
 endif
diff --git a/rules/build-package.mk b/rules/build-package.mk
index b514102..688e1d2 100644
--- a/rules/build-package.mk
+++ b/rules/build-package.mk
@@ -135,6 +135,14 @@ $$(foreach way,$$($1_$2_WAYS),$$(eval \
 $1_$2_PROGRAM_DEP_LIB = $$($1_$2_v_LIB) $$($1_$2_dyn_LIB)
 $$($1_$2_COMPONENT_ID)_$2_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB)
 
+# See Note [inconsistent distdirs] in rules/build-package-way.mk.
+ifeq "$$($1_PACKAGE) $2" "ghc stage1"
+$$($1_$2_COMPONENT_ID)_dist-boot_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB)
+endif
+ifeq "$$($1_PACKAGE) $2" "ghc stage2"
+$$($1_$2_COMPONENT_ID)_dist-install_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB)
+endif
+
 # C and S files are possibly built the "dyn" way.
 ifeq "$$(BuildSharedLibs)" "YES"
 $(call c-objs,$1,$2,dyn)
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 52036c6..2a2049b 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -190,12 +190,7 @@ ifneq "$$(BINDIST)" "YES"
 # necessarily set when this part of the makefile is read
 $1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \
     $$(foreach dep,$$($1_$2_DEP_COMPONENT_IDS),\
-        $$(if $$(filter ghc%,$$(dep)),\
-            $(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\
-            $(if $(filter 1,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
-            $(if $(filter 2,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
-            $$(error Bad build stage)))),\
-        $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)))
+        $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB))
 
 $1_$2_PROG_NEEDS_C_WRAPPER = NO
 $1_$2_PROG_INPLACE = $$($1_$2_PROG)



More information about the ghc-commits mailing list