summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-06-20 09:02:34 +0200
committerBen Gamari <ben@smart-cactus.org>2016-06-30 20:02:23 +0200
commit0701db125eb32ed0a518d962c9e4ee279e3296fd (patch)
treeed9102cd788355570475234673106c3afd33f933 /rules
parentb8b3e30a6eedf9f213b8a718573c4827cfa230ba (diff)
downloadhaskell-0701db125eb32ed0a518d962c9e4ee279e3296fd.tar.gz
Updates to handle new Cabal
Specifically per-component macros and multiple libraries. Contains Cabal submodule update. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, bgamari Reviewed By: austin, bgamari Subscribers: hvr, thomie Differential Revision: https://phabricator.haskell.org/D2059
Diffstat (limited to 'rules')
-rw-r--r--rules/build-package-data.mk2
-rw-r--r--rules/distdir-opts.mk6
-rw-r--r--rules/distdir-way-opts.mk17
-rw-r--r--rules/hs-sources.mk2
-rw-r--r--rules/hs-suffix-way-rules.mk4
5 files changed, 21 insertions, 10 deletions
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 89b742c613..e340c8bd43 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -113,7 +113,7 @@ $1_$2_CONFIGURE_OPTS += $$(if $$(HAPPY),--with-happy="$$(HAPPY)")
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/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h : $1/$2/package-data.mk
# This rule configures the package, generates the package-data.mk file
# for our build system, and registers the package for use in-place in
diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk
index e411559b59..0d60f99fe6 100644
--- a/rules/distdir-opts.mk
+++ b/rules/distdir-opts.mk
@@ -35,7 +35,7 @@ $1_$2_DIST_GCC_CC_OPTS = \
$1_$2_DIST_CC_OPTS = \
$$(SRC_CC_OPTS) \
$$($1_CC_OPTS) \
- -I$1/$2/build/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)) \
$$($1_$2_CC_OPTS) \
@@ -75,8 +75,8 @@ $1_$2_ALL_HSC2HS_OPTS = \
--cflag=-D__GLASGOW_HASKELL__=$$(if $$(filter 0,$3),$$(GhcCanonVersion),$$(ProjectVersionInt)) \
$$($1_$2_HSC2HS_CC_OPTS) \
$$($1_$2_HSC2HS_LD_OPTS) \
- --cflag=-I$1/$2/build/autogen \
- $$(if $$($1_PACKAGE),--cflag=-include --cflag=$1/$2/build/autogen/cabal_macros.h) \
+ --cflag=-I$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \
+ $$(if $$($1_PACKAGE),--cflag=-include --cflag=$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h) \
$$($$(basename $$<)_HSC2HS_OPTS) \
$$(EXTRA_HSC2HS_OPTS)
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index 66c00afc73..31329f5826 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -122,13 +122,16 @@ $1_$2_$3_MOST_HC_OPTS = \
$$(if $$($1_PACKAGE),$$($4_THIS_UNIT_ID) $$($1_$2_COMPONENT_ID))) \
$$(if $$($1_PACKAGE),-hide-all-packages) \
-i $$(if $$($1_$2_HS_SRC_DIRS),$$(foreach dir,$$($1_$2_HS_SRC_DIRS),-i$1/$$(dir)),-i$1) \
- -i$1/$2/build -i$1/$2/build/autogen \
- -I$1/$2/build -I$1/$2/build/autogen \
+ -i$1/$2/build \
+ -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)) \
- $$(if $$($1_PACKAGE),-optP-include -optP$1/$2/build/autogen/cabal_macros.h) \
+ $$(if $$($1_PACKAGE),-optP-include \
+ -optP$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h) \
$$($1_$2_$4_DEP_OPTS) \
$$($1_$2_HC_OPTS) \
$$(CONF_HC_OPTS_STAGE$4) \
@@ -140,6 +143,14 @@ $1_$2_$3_MOST_HC_OPTS = \
$$(SRC_HC_WARNING_OPTS_STAGE$4) \
$$(EXTRA_HC_OPTS)
+# What is going on with $1_EXECUTABLE? Recent version of Cabal
+# place the cabal_macros.h for executables in build/exename/autogen
+# rather than the traditional build/autogen. This is Right(TM)
+# thing to do, but we have to accommodate it. Usually, it suffices
+# to look in the PROGNAME, but for ghc the PROGNAME is ghc-stage1
+# while Cabal puts it in 'ghc', so we $1_EXECUTABLE is for that
+# case.
+
$1_$2_$3_MOST_DIR_HC_OPTS = \
$$($1_$2_$3_MOST_HC_OPTS) \
-odir $1/$2/build -hidir $1/$2/build -stubdir $1/$2/build
diff --git a/rules/hs-sources.mk b/rules/hs-sources.mk
index 2e77d02a20..20c286dcbe 100644
--- a/rules/hs-sources.mk
+++ b/rules/hs-sources.mk
@@ -28,7 +28,7 @@ endif
$1_$2_HS_SRCS := $$(foreach file,$$($1_$2_SLASH_MODS),\
$$(firstword \
$$(wildcard \
- $$(foreach dir,$$($1_$2_HS_SRC_DIRS) $2/build/autogen,\
+ $$(foreach dir,$$($1_$2_HS_SRC_DIRS) $2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen,\
$1/$$(dir)/$$(file).hs $1/$$(dir)/$$(file).lhs)) \
$1/$2/build/$$(file).hs))
diff --git a/rules/hs-suffix-way-rules.mk b/rules/hs-suffix-way-rules.mk
index 4735182017..d7b452075f 100644
--- a/rules/hs-suffix-way-rules.mk
+++ b/rules/hs-suffix-way-rules.mk
@@ -117,10 +117,10 @@ $1/$2/build/%.$$($3_hcsuf) : $1/$2/build/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_
$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)
$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@)))
-$1/$2/build/%.$$($3_hcsuf) : $1/$2/build/autogen/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)
+$1/$2/build/%.$$($3_hcsuf) : $1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)
$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@
-$1/$2/build/%.$$($3_osuf) : $1/$2/build/autogen/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)
+$1/$2/build/%.$$($3_osuf) : $1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)
$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@)))
endif