diff options
author | John Ericson <git@JohnEricson.me> | 2019-05-08 02:52:35 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-04 21:44:29 -0400 |
commit | 05419e55cab272ed39790695f448b311f22669f7 (patch) | |
tree | b3f652d4eb27c0ad6108edd6bca5fc73e165981a /rules | |
parent | ec93d2a90a2d4f189feafd21575b9e9ba5ba9a5d (diff) | |
download | haskell-05419e55cab272ed39790695f448b311f22669f7.tar.gz |
Per stage headers, ghc_boot_platform.h -> stage 0 ghcplatform.h
The generated headers are now generated per stage, which means we can
skip hacks like `ghc_boot_platform.h` and just have that be the stage 0
header as proper. In general, stages are to be embraced: freely generate
everything in each stage but then just build what you depend on, and
everything is symmetrical and efficient. Trying to avoid stages because
bootstrapping is a mind bender just creates tons of bespoke
mini-mind-benders that add up to something far crazier.
Hadrian was pretty close to this "stage-major" approach already, and so
was fairly easy to fix. Make needed more work, however: it did know
about stages so at least there was a scaffold, but few packages except
for the compiler cared, and the compiler used its own counting system.
That said, make and Hadrian now work more similarly, which is good for
the transition to Hadrian. The merits of embracing stage aside, the
change may be worthy for easing that transition alone.
Diffstat (limited to 'rules')
-rw-r--r-- | rules/build-dependencies.mk | 4 | ||||
-rw-r--r-- | rules/build-package-way.mk | 2 | ||||
-rw-r--r-- | rules/build-prog.mk | 2 | ||||
-rw-r--r-- | rules/hs-suffix-way-rules-srcdir.mk | 22 | ||||
-rw-r--r-- | rules/hs-suffix-way-rules.mk | 4 | ||||
-rw-r--r-- | rules/manual-package-config.mk | 19 |
6 files changed, 35 insertions, 18 deletions
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk index 3a7491fe51..de580a7379 100644 --- a/rules/build-dependencies.mk +++ b/rules/build-dependencies.mk @@ -30,7 +30,7 @@ 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. -$$($1_$2_depfile_haskell) : $$(includes_H_CONFIG) $$(includes_H_PLATFORM) +$$($1_$2_depfile_haskell) : $$(includes_$3_H_CONFIG) $$(includes_$3_H_PLATFORM) $$($1_$2_depfile_haskell) : $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS) $$$$($1_$2_HC_MK_DEPEND_DEP) | $$$$(dir $$$$@)/. $$(call removeFiles,$$@.tmp) @@ -65,7 +65,7 @@ endif $$@.tmp2 > $$@ # Some of the C files (directly or indirectly) include the generated # includes files. -$$($1_$2_depfile_c_asm) : $$(includes_H_CONFIG) $$(includes_H_PLATFORM) +$$($1_$2_depfile_c_asm) : $$(includes_$3_H_CONFIG) $$(includes_$3_H_PLATFORM) $$($1_$2_depfile_c_asm) : $$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES) $$($1_$2_CMM_FILES) | $$$$(dir $$$$@)/. $$(call removeFiles,$$@.tmp) diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk index 187d9c848d..e5601403cc 100644 --- a/rules/build-package-way.mk +++ b/rules/build-package-way.mk @@ -16,7 +16,7 @@ $(call trace, build-package-way($1,$2,$3)) $(call profStart, build-package-way($1,$2,$3)) $(call distdir-way-opts,$1,$2,$3,$4) -$(call hs-suffix-way-rules,$1,$2,$3) +$(call hs-suffix-way-rules,$1,$2,$3,$4) $(call hs-objs,$1,$2,$3) diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 5d5f0e3ca3..0528c15fc9 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -178,7 +178,7 @@ endif $$(foreach dir,$$($1_$2_HS_SRC_DIRS),\ $$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$$(dir)))) -$(call hs-suffix-way-rules,$1,$2,$$($1_$2_PROGRAM_WAY)) +$(call hs-suffix-way-rules,$1,$2,$$($1_$2_PROGRAM_WAY),$3) $(call c-objs,$1,$2,$$($1_$2_PROGRAM_WAY)) $(call hs-objs,$1,$2,$$($1_$2_PROGRAM_WAY)) diff --git a/rules/hs-suffix-way-rules-srcdir.mk b/rules/hs-suffix-way-rules-srcdir.mk index 78c1be18f4..1d01f95219 100644 --- a/rules/hs-suffix-way-rules-srcdir.mk +++ b/rules/hs-suffix-way-rules-srcdir.mk @@ -12,7 +12,7 @@ define hs-suffix-way-rules-srcdir -# args: $1 = dir, $2 = distdir, $3 = way, $4 = srcdir +# args: $1 = dir, $2 = distdir, $3 = way, $4 = srcdir, $5 = stage ifneq "$$(BINDIST)" "YES" @@ -35,11 +35,21 @@ $1/$2/build/%.$$($3_hcsuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) # XXX: for some reason these get used in preference to the direct # .hs->.o rule, I don't know why --SDM -$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc includes/ghcautoconf.h includes/ghcplatform.h | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) -x c -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc includes/ghcautoconf.h includes/ghcplatform.h - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) -x c -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) +$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc $$(includes_$5_H_CONFIG) $$(includes_$5_H_PLATFORM) | $$$$(dir $$$$@)/. + $$(call cmd,$1_$2_CC) \ + $$($1_$2_$3_ALL_CC_OPTS) \ + $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) \ + -I$$(BUILD_$5_INCLUDE_DIR) \ + -x c -c $$< -o $$@ \ + $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) + +$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc $$(includes_$5_H_CONFIG) $$(includes_$5_H_PLATFORM) + $$(call cmd,$1_$2_CC) \ + $$($1_$2_$3_ALL_CC_OPTS) \ + $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) \ + -I$$(BUILD_$5_INCLUDE_DIR) \ + -x c -c $$< -o $$@ \ + $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) # $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_hcsuf) # $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ diff --git a/rules/hs-suffix-way-rules.mk b/rules/hs-suffix-way-rules.mk index 286e04eee7..daf1da4926 100644 --- a/rules/hs-suffix-way-rules.mk +++ b/rules/hs-suffix-way-rules.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- -define hs-suffix-way-rules # args: $1 = dir, $2 = distdir, $3 = way +define hs-suffix-way-rules # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage ifeq "$3 $$($1_$2_DYNAMIC_TOO)" "dyn YES" # We only want this rule to be used for Haskell sources, not for @@ -106,7 +106,7 @@ else # [1] https://www.gnu.org/software/make/manual/make.html#Implicit-Rule-Search $$(foreach dir,$$($1_$2_HS_SRC_DIRS),\ - $$(eval $$(call hs-suffix-way-rules-srcdir,$1,$2,$3,$$(dir)))) + $$(eval $$(call hs-suffix-way-rules-srcdir,$1,$2,$3,$$(dir),$4))) ifneq "$$(BINDIST)" "YES" diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk index 2fc6dea5d3..64d6f1aec6 100644 --- a/rules/manual-package-config.mk +++ b/rules/manual-package-config.mk @@ -11,15 +11,20 @@ # ----------------------------------------------------------------------------- -define manual-package-config # args: $1 = dir -$(call trace, manual-package-config($1)) -$(call profStart, manual-package-config($1)) +define manual-package-config +# args: +# $1 = dir +# $2 = stage +$(call trace, manual-package-config($1, $2)) +$(call profStart, manual-package-config($1, $2)) $1/dist/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(dir $$$$@)/. $$(HS_CPP) -P \ -DTOP='"$$(TOP)"' \ $$($1_PACKAGE_CPP_OPTS) \ - -x c $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) $$< -o $$@.raw + $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) \ + -I$$(BUILD_$2_INCLUDE_DIR) \ + -x c $$< -o $$@.raw grep -v '^#pragma GCC' $$@.raw | \ sed -e 's/""//g' -e 's/:[ ]*,/: /g' > $$@ @@ -34,9 +39,11 @@ $1/dist/package.conf.install: | $$$$(dir $$$$@)/. -DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))"' \ -DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/include"' \ $$($1_PACKAGE_CPP_OPTS) \ - -x c $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) $1/package.conf.in -o $$@.raw + $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) \ + -I$$(BUILD_$2_INCLUDE_DIR) \ + -x c $1/package.conf.in -o $$@.raw grep -v '^#pragma GCC' $$@.raw | \ sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$$@ -$(call profEnd, manual-package-config($1)) +$(call profEnd, manual-package-config($1, $2)) endef |