summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-13 15:38:21 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-16 03:13:10 -0500
commit3e94b5a7ebddf156f00599c6bd2e9ba1af437a6c (patch)
tree7c4baf6a8c660cce215a79634a545991f073b4c3 /rules
parent85f2c0ba760377e68673d9efb336ac762e04683c (diff)
downloadhaskell-3e94b5a7ebddf156f00599c6bd2e9ba1af437a6c.tar.gz
Make: Get rid of `BUILD_.*_INCLUDE_DIRS`
First, we improve some of the rules around -I include dirs, and CPP opts. Then, we just specify the RTS's include dirs normally (locally per the package and in the package conf), and then everything should work normally. The primops.txt.pp rule needs no extra include dirs at all, as it no longer bakes in a target platfom. Reverts some of the extra stage arguments I added in 05419e55cab272ed39790695f448b311f22669f7, as they are no longer needed.
Diffstat (limited to 'rules')
-rw-r--r--rules/build-package-way.mk2
-rw-r--r--rules/build-prog.mk2
-rw-r--r--rules/distdir-opts.mk14
-rw-r--r--rules/distdir-way-opts.mk6
-rw-r--r--rules/hs-suffix-way-rules-srcdir.mk8
-rw-r--r--rules/hs-suffix-way-rules.mk4
-rw-r--r--rules/manual-package-config.mk13
7 files changed, 25 insertions, 24 deletions
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index c1b95032ac..abc55c80c5 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,$4)
+$(call hs-suffix-way-rules,$1,$2,$3)
$(call hs-objs,$1,$2,$3)
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 84d717e6b6..7973ecd38e 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),$3)
+$(call hs-suffix-way-rules,$1,$2,$$($1_$2_PROGRAM_WAY))
$(call c-objs,$1,$2,$$($1_$2_PROGRAM_WAY))
$(call hs-objs,$1,$2,$$($1_$2_PROGRAM_WAY))
diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk
index fe329c1d31..ebe56c1fd5 100644
--- a/rules/distdir-opts.mk
+++ b/rules/distdir-opts.mk
@@ -32,14 +32,22 @@ $1_$2_DIST_GCC_CC_OPTS = \
$$(CONF_CC_OPTS_STAGE$3) \
$$($1_$2_DIST_CC_OPTS)
+$1_$2_DIST_INCLUDE_DIRS = \
+ $$($1_$2_INCLUDE_DIRS) \
+ $$($1_INCLUDE_DIRS)
+
+$1_$2_DIST_CPP_OPTS = \
+ $$(foreach dir,$$(filter-out /%,$$($1_$2_DIST_INCLUDE_DIRS)),-I$1/$$(dir)) \
+ $$(foreach dir,$$(filter /%,$$($1_$2_DIST_INCLUDE_DIRS)),-I$$(dir)) \
+ $$($1_$2_CPP_OPTS) \
+ $$($1_CPP_OPTS)
+
$1_$2_DIST_CC_OPTS = \
$$(SRC_CC_OPTS) \
$$($1_CC_OPTS) \
-I$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \
- $$(foreach dir,$$(filter-out /%,$$($1_$2_INCLUDE_DIRS)),-I$1/$$(dir)) \
- $$(foreach dir,$$(filter /%,$$($1_$2_INCLUDE_DIRS)),-I$$(dir)) \
+ $$($1_$2_DIST_CPP_OPTS) \
$$($1_$2_CC_OPTS) \
- $$($1_$2_CPP_OPTS) \
$$($1_$2_CC_INC_FLAGS) \
$$($1_$2_DEP_CC_OPTS) \
$$(SRC_CC_WARNING_OPTS)
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index a0dba3a1fe..098af4f8da 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -126,10 +126,8 @@ $1_$2_$3_MOST_HC_OPTS = \
-I$1/$2/build \
-i$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \
-I$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \
- $$(foreach dir,$$(filter-out /%,$$($1_$2_INCLUDE_DIRS)),-I$1/$$(dir)) \
- $$(foreach dir,$$(filter /%,$$($1_$2_INCLUDE_DIRS)),-I$$(dir)) \
- $$(foreach inc,$$($1_$2_INCLUDE),-\#include "$$(inc)") \
- $$(foreach opt,$$($1_$2_CPP_OPTS),-optP$$(opt)) \
+ $$(foreach dir,$$(filter -I%,$$($1_$2_DIST_CPP_OPTS)),$$(dir)) \
+ $$(foreach opt,$$(filter-out -I%,$$($1_$2_DIST_CPP_OPTS)),-optP$$(opt)) \
$$(if $$($1_PACKAGE),-optP-include \
-optP$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h) \
$$($1_$2_$4_DEP_OPTS) \
diff --git a/rules/hs-suffix-way-rules-srcdir.mk b/rules/hs-suffix-way-rules-srcdir.mk
index f9ab09107a..7223b553ba 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, $5 = stage
+# args: $1 = dir, $2 = distdir, $3 = way, $4 = srcdir
ifneq "$$(BINDIST)" "YES"
@@ -35,17 +35,15 @@ $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_$5_H_CONFIG) $$(includes_$5_H_PLATFORM) | $$$$(dir $$$$@)/.
+$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc | $$$$(dir $$$$@)/.
$$(call cmd,$1_$2_CC) \
$$($1_$2_$3_ALL_CC_OPTS) \
- $$(addprefix -I,$$(BUILD_$5_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_$5_H_CONFIG) $$(includes_$5_H_PLATFORM)
+$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc
$$(call cmd,$1_$2_CC) \
$$($1_$2_$3_ALL_CC_OPTS) \
- $$(addprefix -I,$$(BUILD_$5_INCLUDE_DIRS)) \
-x c -c $$< -o $$@ \
$$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@)))
diff --git a/rules/hs-suffix-way-rules.mk b/rules/hs-suffix-way-rules.mk
index daf1da4926..286e04eee7 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, $4 = stage
+define hs-suffix-way-rules # args: $1 = dir, $2 = distdir, $3 = way
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),$4)))
+ $$(eval $$(call hs-suffix-way-rules-srcdir,$1,$2,$3,$$(dir))))
ifneq "$$(BINDIST)" "YES"
diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk
index dcd0e758bc..a9993d9fae 100644
--- a/rules/manual-package-config.mk
+++ b/rules/manual-package-config.mk
@@ -15,15 +15,13 @@ define manual-package-config
# args:
# $1 = dir
# $2 = distdir
-# $3 = stage
-$(call trace, manual-package-config($1, $2, $3))
-$(call profStart, manual-package-config($1, $2, $3))
+$(call trace, manual-package-config($1, $2))
+$(call profStart, manual-package-config($1, $2))
$1/$2/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(dir $$$$@)/.
$$(HS_CPP) -P \
-DTOP='"$$(TOP)"' \
- $$($1_PACKAGE_CPP_OPTS) \
- $$(addprefix -I,$$(BUILD_$3_INCLUDE_DIRS)) \
+ $$($1_$2_PACKAGE_CPP_OPTS) \
-x c $$< -o $$@.raw
grep -v '^#pragma GCC' $$@.raw | \
sed -e 's/""//g' -e 's/:[ ]*,/: /g' > $$@
@@ -38,11 +36,10 @@ $1/$2/package.conf.install : $1/package.conf.in | $$$$(dir $$$$@)/.
-DINSTALLING \
-DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/$1"' \
-DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/$1/include"' \
- $$($1_PACKAGE_CPP_OPTS) \
- $$(addprefix -I,$$(BUILD_$3_INCLUDE_DIRS)) \
+ $$($1_$2_PACKAGE_CPP_OPTS) \
-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, $2, $3))
+$(call profEnd, manual-package-config($1))
endef