diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | compiler/Makefile | 27 | ||||
-rw-r--r-- | ghc/Makefile | 45 | ||||
-rw-r--r-- | mk/compiler-ghc.mk | 59 | ||||
-rw-r--r-- | mk/sub-makefile.mk | 3 | ||||
-rw-r--r-- | rules/build-dependencies.mk | 4 | ||||
-rw-r--r-- | rules/build-package-data.mk | 2 | ||||
-rw-r--r-- | rules/include-dependencies.mk | 12 |
8 files changed, 81 insertions, 73 deletions
@@ -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 +ifneq "$(OMIT_PHASE_0)" "YES" @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 diff --git a/compiler/Makefile b/compiler/Makefile index 639076a0bb..f099ab718b 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -16,32 +16,9 @@ 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) -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." diff --git a/ghc/Makefile b/ghc/Makefile index 46301a4e50..62207dc563 100644 --- a/ghc/Makefile +++ b/ghc/Makefile @@ -11,49 +11,6 @@ # ----------------------------------------------------------------------------- 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 index 0000000000..5b63241935 --- /dev/null +++ b/mk/compiler-ghc.mk @@ -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." diff --git a/mk/sub-makefile.mk b/mk/sub-makefile.mk index b69122d6ff..fdaf830eef 100644 --- a/mk/sub-makefile.mk +++ b/mk/sub-makefile.mk @@ -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 \ - 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) diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk index 3aa176cf05..e6d493ccf7 100644 --- a/rules/build-dependencies.mk +++ b/rules/build-dependencies.mk @@ -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 -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. @@ -69,7 +69,7 @@ endif 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. diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index dcffee6110..86f9323859 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -64,6 +64,7 @@ $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS) 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 @@ -78,6 +79,7 @@ ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO" endif endif endif +endif PACKAGE_DATA_MKS += $1/$2/package-data.mk diff --git a/rules/include-dependencies.mk b/rules/include-dependencies.mk index b93311075f..ad1c230f4f 100644 --- a/rules/include-dependencies.mk +++ b/rules/include-dependencies.mk @@ -17,7 +17,17 @@ $(call profStart, include-dependencies($1,$2,$3)) # $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) |