Fix "make 1" etc following the build system changes
authorIan Lynagh <igloo@earth.li>
Thu, 27 Jan 2011 00:17:39 +0000 (00:17 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 27 Jan 2011 00:17:39 +0000 (00:17 +0000)
The logic is now in mk/compiler-ghc.mk rather than being duplicated in
ghc/Makefile and compiler/Makefile.

Makefile
compiler/Makefile
ghc/Makefile
mk/compiler-ghc.mk [new file with mode: 0644]
mk/sub-makefile.mk
rules/build-dependencies.mk
rules/build-package-data.mk
rules/include-dependencies.mk

index 0d53a15..8166e55 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -60,8 +60,10 @@ REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framewor
 # it does nothing if we specify a target that already exists.
 .PHONY: $(REALGOALS)
 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
 # it does nothing if we specify a target that already exists.
 .PHONY: $(REALGOALS)
 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
+ifneq "$(OMIT_PHASE_0)" "YES"
        @echo "===--- building phase 0"
        $(MAKE) -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
        @echo "===--- building phase 0"
        $(MAKE) -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
+endif
 ifneq "$(OMIT_PHASE_1)" "YES"
        @echo "===--- building phase 1"
        $(MAKE) -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
 ifneq "$(OMIT_PHASE_1)" "YES"
        @echo "===--- building phase 1"
        $(MAKE) -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
index 639076a..f099ab7 100644 (file)
 default_to_ghc : all_ghc
 
 dir = compiler
 default_to_ghc : all_ghc
 
 dir = compiler
-TOP = ..
-SPEC_TARGETS = 1 2 3
-include $(TOP)/mk/sub-makefile.mk
+
+include ../mk/compiler-ghc.mk
 
 all_ghc :
        +$(TOPMAKE) all_ghc $(EXTRA_MAKE_OPTS)
 
 
 all_ghc :
        +$(TOPMAKE) all_ghc $(EXTRA_MAKE_OPTS)
 
-FAST_MAKE_OPTS += compiler_stage1_NO_BUILD_DEPS=YES compiler_stage2_NO_BUILD_DEPS=YES compiler_stage3_NO_BUILD_DEPS=YES
-
-.PHONY: 1 2 3
-
-1:
-       +$(TOPMAKE) stage=1 all_ghc_stage1 $(FAST_MAKE_OPTS) NO_STAGE1_DEPS=YES NO_STAGE2_DEPS=YES
-
-2:
-       +$(TOPMAKE) stage=2 all_ghc_stage2 $(FAST_MAKE_OPTS) NO_STAGE2_DEPS=YES
-
-3:
-       +$(TOPMAKE) stage=3 all_ghc_stage3 $(FAST_MAKE_OPTS) NO_STAGE3_DEPS=YES
-
-.PHONY: extra-help
-help : extra-help
-extra-help :
-       @echo "  make 1"
-       @echo "  make 2"
-       @echo "  make 3"
-       @echo
-       @echo "     Build the stage 1, 2 or 3 GHC respectively, omitting dependencies"
-       @echo "     and initial phases for speed."
index 46301a4..62207dc 100644 (file)
 # -----------------------------------------------------------------------------
 
 dir = ghc
 # -----------------------------------------------------------------------------
 
 dir = ghc
-TOP = ..
-SPEC_TARGETS = 1 2 3
-include $(TOP)/mk/sub-makefile.mk
 
 
-FAST_MAKE_OPTS += compiler_stage1_NO_BUILD_DEPS=YES \
-                  compiler_stage2_NO_BUILD_DEPS=YES \
-                  compiler_stage3_NO_BUILD_DEPS=YES \
-                  ghc_stage1_NO_BUILD_DEPS=YES \
-                  ghc_stage2_NO_BUILD_DEPS=YES \
-                  ghc_stage3_NO_BUILD_DEPS=YES
+include ../mk/compiler-ghc.mk
 
 
-.PHONY: 1 2 3
-
-1:
-       +$(TOPMAKE) stage=1 all_ghc_stage1 $(FAST_MAKE_OPTS) NO_STAGE1_DEPS=YES NO_STAGE2_DEPS=YES
-
-2:
-       +$(TOPMAKE) stage=2 all_ghc_stage2 $(FAST_MAKE_OPTS) NO_STAGE2_DEPS=YES
-
-3:
-       +$(TOPMAKE) stage=3 all_ghc_stage3 $(FAST_MAKE_OPTS) NO_STAGE3_DEPS=YES
-
-
-# 'make re2' rebuilds stage2, removing the old executable first.  Useful for
-# something like 'make re2 GhcDebugged=YES'.
-
-.PHONY: re1 re2 re3
-re1:
-       $(RM) stage1/build/tmp/ghc-stage1
-       $(MAKE) 1
-re2:
-       $(RM) stage2/build/tmp/ghc-stage2
-       $(MAKE) 2
-re3:
-       $(RM) stage3/build/tmp/ghc-stage3
-       $(MAKE) 3
-
-.PHONY: extra-help
-help : extra-help
-extra-help :
-       @echo "  make 1"
-       @echo "  make 2"
-       @echo "  make 3"
-       @echo
-       @echo "     Build the stage 1, 2 or 3 GHC respectively, omitting dependencies"
-       @echo "     and initial phases for speed."
diff --git a/mk/compiler-ghc.mk b/mk/compiler-ghc.mk
new file mode 100644 (file)
index 0000000..5b63241
--- /dev/null
@@ -0,0 +1,59 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2009 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
+#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
+#
+# -----------------------------------------------------------------------------
+
+dir = ghc
+TOP = ..
+SPEC_TARGETS = 1 2 3
+include $(TOP)/mk/sub-makefile.mk
+
+FAST_MAKE_OPTS += compiler_stage1_NO_BUILD_DEPS=YES \
+                  compiler_stage2_NO_BUILD_DEPS=YES \
+                  compiler_stage3_NO_BUILD_DEPS=YES \
+                  ghc_stage1_NO_BUILD_DEPS=YES \
+                  ghc_stage2_NO_BUILD_DEPS=YES \
+                  ghc_stage3_NO_BUILD_DEPS=YES
+
+.PHONY: 1 2 3
+
+1:
+       +$(TOPMAKE) stage=1 all_ghc_stage1 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage1 ghc_stage1"
+
+2:
+       +$(TOPMAKE) stage=2 all_ghc_stage2 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage2 ghc_stage2" NO_STAGE2_DEPS=YES
+
+3:
+       +$(TOPMAKE) stage=3 all_ghc_stage3 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage3 ghc_stage3" NO_STAGE3_DEPS=YES
+
+
+# 'make re2' rebuilds stage2, removing the old executable first.  Useful for
+# something like 'make re2 GhcDebugged=YES'.
+
+.PHONY: re1 re2 re3
+re1:
+       $(RM) $(TOP)/ghc/stage1/build/tmp/ghc-stage1
+       $(MAKE) 1
+re2:
+       $(RM) $(TOP)/ghc/stage2/build/tmp/ghc-stage2
+       $(MAKE) 2
+re3:
+       $(RM) $(TOP)/ghc/stage3/build/tmp/ghc-stage3
+       $(MAKE) 3
+
+.PHONY: extra-help
+help : extra-help
+extra-help :
+       @echo "  make 1"
+       @echo "  make 2"
+       @echo "  make 3"
+       @echo
+       @echo "     Build the stage 1, 2 or 3 GHC respectively, omitting dependencies"
+       @echo "     and initial phases for speed."
index b69122d..fdaf830 100644 (file)
@@ -22,7 +22,8 @@ FAST_MAKE_OPTS =\
   $(dir)_dist_NO_BUILD_DEPS=YES \
   $(dir)_dist-boot_NO_BUILD_DEPS=YES \
   $(dir)_dist-install_NO_BUILD_DEPS=YES \
   $(dir)_dist_NO_BUILD_DEPS=YES \
   $(dir)_dist-boot_NO_BUILD_DEPS=YES \
   $(dir)_dist-install_NO_BUILD_DEPS=YES \
-  OMIT_PHASE_1=YES OMIT_PHASE_2=YES OMIT_PHASE_3=YES
+  NO_GENERATED_MAKEFILE_RULES=YES \
+  OMIT_PHASE_0=YES OMIT_PHASE_1=YES
 
 ifneq "$(filter fast,$(MAKECMDGOALS))" ""
 EXTRA_MAKE_OPTS += $(FAST_MAKE_OPTS)
 
 ifneq "$(filter fast,$(MAKECMDGOALS))" ""
 EXTRA_MAKE_OPTS += $(FAST_MAKE_OPTS)
index 3aa176c..e6d493c 100644 (file)
@@ -25,7 +25,7 @@ $1_$2_C_FILES_DEPS = $$(filter-out $$($1_$2_C_FILES_NODEPS),$$($1_$2_C_FILES))
 $1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$(filter-out v,$$($1_$2_WAYS)),-dep-suffix $$(way))
 $1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps
 
 $1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$(filter-out v,$$($1_$2_WAYS)),-dep-suffix $$(way))
 $1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps
 
-ifneq "$$($1_$2_NO_BUILD_DEPS)" "YES"
+ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES"
 
 # Some of the Haskell files (e.g. utils/hsc2hs/Main.hs) (directly or
 # indirectly) include the generated includes files.
 
 # Some of the Haskell files (e.g. utils/hsc2hs/Main.hs) (directly or
 # indirectly) include the generated includes files.
@@ -69,7 +69,7 @@ endif
        echo "$1_$2_depfile_c_asm_EXISTS = YES" >> $$@.tmp
        mv $$@.tmp $$@
 
        echo "$1_$2_depfile_c_asm_EXISTS = YES" >> $$@.tmp
        mv $$@.tmp $$@
 
-endif # $1_$2_NO_BUILD_DEPS
+endif # NO_GENERATED_MAKEFILE_RULES
 
 # Note sed magic above: mkdependC can't do -odir stuff, so we have to
 # munge the dependencies it generates to refer to the correct targets.
 
 # Note sed magic above: mkdependC can't do -odir stuff, so we have to
 # munge the dependencies it generates to refer to the correct targets.
index dcffee6..86f9323 100644 (file)
@@ -64,6 +64,7 @@ $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS)
 endif
 
 ifneq "$$(BINDIST)" "YES"
 endif
 
 ifneq "$$(BINDIST)" "YES"
+ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES"
 $1/$2/inplace-pkg-config : $1/$2/package-data.mk
 $1/$2/build/autogen/cabal_macros.h : $1/$2/package-data.mk
 
 $1/$2/inplace-pkg-config : $1/$2/package-data.mk
 $1/$2/build/autogen/cabal_macros.h : $1/$2/package-data.mk
 
@@ -78,6 +79,7 @@ ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO"
 endif
 endif
 endif
 endif
 endif
 endif
+endif
 
 PACKAGE_DATA_MKS += $1/$2/package-data.mk
 
 
 PACKAGE_DATA_MKS += $1/$2/package-data.mk
 
index b933110..ad1c230 100644 (file)
@@ -17,7 +17,17 @@ $(call profStart, include-dependencies($1,$2,$3))
 # $2 = distdir
 # $3 = GHC stage to use (0 == bootstrapping compiler)
 
 # $2 = distdir
 # $3 = GHC stage to use (0 == bootstrapping compiler)
 
-ifneq "$$(NO_INCLUDE_DEPS)" "YES"
+$1_$2_INCLUDE_DEPFILES = YES
+ifeq "$$(NO_INCLUDE_DEPS)" "YES"
+$1_$2_INCLUDE_DEPFILES = NO
+endif
+ifneq "$$(ONLY_DEPS_FOR)" ""
+ifeq "$$(filter $1_$2,$$(ONLY_DEPS_FOR))" ""
+$1_$2_INCLUDE_DEPFILES = NO
+endif
+endif
+
+ifeq "$$($1_$2_INCLUDE_DEPFILES)" "YES"
 ifneq "$$(strip $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS))" ""
 ifneq "$$(NO_STAGE$3_DEPS)" "YES"
 include $$($1_$2_depfile_haskell)
 ifneq "$$(strip $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS))" ""
 ifneq "$$(NO_STAGE$3_DEPS)" "YES"
 include $$($1_$2_depfile_haskell)