summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-02-27 09:57:09 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2013-02-27 09:57:09 +0000
commit47d226544fc3fb11d024740a162f8ae4e1d044c9 (patch)
tree8a024b97de71216f6b3606d3cda7bf16ae1f98a6 /rules
parent7b5e514d85c086be8dc6d938b526c97b6ced56eb (diff)
parent0ee31659afe7a6819f9eb5e233f98e5592f1b439 (diff)
downloadhaskell-tc-arrows.tar.gz
Merge remote-tracking branch 'origin/master' into tc-arrowstc-arrows
Diffstat (limited to 'rules')
-rw-r--r--rules/build-dependencies.mk13
-rw-r--r--rules/build-package-data.mk14
-rw-r--r--rules/build-package-way.mk6
-rw-r--r--rules/build-package.mk21
-rw-r--r--rules/build-prog.mk16
-rw-r--r--rules/c-suffix-rules.mk3
-rw-r--r--rules/cmm-suffix-rules.mk4
-rw-r--r--rules/distdir-opts.mk111
-rw-r--r--rules/distdir-way-opts.mk98
-rw-r--r--rules/haddock.mk2
-rw-r--r--rules/hi-rule.mk34
-rw-r--r--rules/hs-suffix-rules-srcdir.mk77
-rw-r--r--rules/hs-suffix-way-rules-srcdir.mk67
-rw-r--r--rules/hs-suffix-way-rules.mk (renamed from rules/hs-suffix-rules.mk)33
-rw-r--r--rules/manual-package-config.mk2
15 files changed, 284 insertions, 217 deletions
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk
index 4a4f5638e2..7b66dcd266 100644
--- a/rules/build-dependencies.mk
+++ b/rules/build-dependencies.mk
@@ -48,7 +48,18 @@ endif
# Some packages are from the bootstrapping compiler, so are not
# within the build tree. On Windows this causes a problem as they look
# like bad rules, due to the two colons, so we filter them out.
- grep -v ' : [a-zA-Z]:/' $$@.tmp > $$@
+ grep -v ' : [a-zA-Z]:/' $$@.tmp > $$@.tmp2
+ sed '/hs$$$$/ p ; \
+ /hs$$$$/ s/o /hi /g ; \
+ /hs$$$$/ s/:/ : %hi: %o / ; \
+ /hs$$$$/ s/^/$$$$(eval $$$$(call hi-rule,/ ; \
+ /hs$$$$/ s/$$$$/))/ ; \
+ /hs-boot$$$$/ p ; \
+ /hs-boot$$$$/ s/o-boot /hi-boot /g ; \
+ /hs-boot$$$$/ s/:/ : %hi-boot: %o-boot / ; \
+ /hs-boot$$$$/ s/^/$$$$(eval $$$$(call hi-rule,/ ; \
+ /hs-boot$$$$/ s/$$$$/))/' \
+ $$@.tmp2 > $$@
# Some of the C files (directly or indirectly) include the generated
# includes files.
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 17def03638..41f7a02be1 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -71,9 +71,7 @@ $1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="$$(GMP_LIB_DIRS
endif
ifeq "$$(CrossCompiling)" "YES"
-$1_$2_CONFIGURE_OPTS += --configure-option=--host=$(TARGETPLATFORM)
-# We use different platform name conventions than autoconf expects,
-# but let's hope it doesn't cause problems.
+$1_$2_CONFIGURE_OPTS += --configure-option=--host=$(TargetPlatformFull)
endif
ifeq "$3" "0"
@@ -102,7 +100,15 @@ $1/$2/build/autogen/cabal_macros.h : $1/$2/package-data.mk
# for our build system, and registers the package for use in-place in
# the build tree.
$1/$2/package-data.mk : $$(GHC_CABAL_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_CONFIG_DEP)
- CROSS_COMPILE="$(CrossCompilePrefix)" "$$(GHC_CABAL_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1
+# Checking packages built with the bootstrapping compiler would
+# generally be a waste of time. Either we will rebuild them with
+# stage1/stage2, or we don't really care about them.
+ifneq "$3" "0"
+ifneq "$$($1_NO_CHECK)" "YES"
+ "$$(GHC_CABAL_INPLACE)" check $1
+endif
+endif
+ "$$(GHC_CABAL_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1
ifeq "$$($1_$2_PROG)" ""
ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO"
$$(call cmd,$1_$2_GHC_PKG) update --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index aade4e93af..4621482d82 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-rules,$1,$2,$3)
+$(call hs-suffix-way-rules,$1,$2,$3)
$(call hs-objs,$1,$2,$3)
@@ -43,10 +43,6 @@ endif
# [inconsistent distdirs].
$1_$2_$3_DEPS_LIBS=$$(foreach dep,$$($1_$2_DEPS),$$($$(dep)_$(subst stage2,dist-install,$2)_$3_LIB))
-ifeq "$$(BootingFromHc)" "YES"
-$1_$2_$3_C_OBJS += $$(shell $$(FIND) $1/$2/build -name "*_stub.c" -print | sed 's/c$$$$/o/')
-endif
-
$1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
$1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS)
diff --git a/rules/build-package.mk b/rules/build-package.mk
index e64754cb3f..47ef22c89d 100644
--- a/rules/build-package.mk
+++ b/rules/build-package.mk
@@ -75,6 +75,15 @@ else
$1_$2_WAYS = $$(filter-out $$($1_$2_EXCLUDED_WAYS),$$(GhcLibWays))
endif
+$1_$2_DYNAMIC_TOO = NO
+ifneq "$$(DYNAMIC_TOO)" "NO"
+ifneq "$$(filter v,$$($1_$2_WAYS))" ""
+ifneq "$$(filter dyn,$$($1_$2_WAYS))" ""
+$1_$2_DYNAMIC_TOO = YES
+endif
+endif
+endif
+
# We must use a different dependency file if $(GhcLibWays) changes, so
# encode the ways into the name of the file.
$1_$2_WAYS_DASHED = $$(subst $$(space),,$$(patsubst %,-%,$$(strip $$($1_$2_WAYS))))
@@ -105,6 +114,7 @@ endif
$(call hs-sources,$1,$2)
$(call c-sources,$1,$2)
$(call includes-sources,$1,$2)
+$(call distdir-opts,$1,$2,$3)
$(call dependencies,$1,$2,$3)
@@ -123,12 +133,15 @@ $$(foreach way,$$($1_$2_WAYS),$$(eval \
# If dyn libs are not being built then $$($1_$2_dyn_LIB) will just
# expand to the empty string, and be ignored.
$1_$2_PROGRAM_DEP_LIB = $$($1_$2_v_LIB) $$($1_$2_dyn_LIB)
+$$($1_PACKAGE)-$$($1_$2_VERSION)_$2_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB)
# C and S files are possibly built the "dyn" way.
ifeq "$$(BuildSharedLibs)" "YES"
$(call c-objs,$1,$2,dyn)
$(call c-suffix-rules,$1,$2,dyn,YES)
endif
+$$(foreach dir,$$($1_$2_HS_SRC_DIRS),\
+ $$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$$(dir))))
$(call all-target,$1,all_$1_$2)
# This give us things like
@@ -137,14 +150,6 @@ ifneq "$$($1_$2_GROUP)" ""
all_$$($1_$2_GROUP): all_$1_$2
endif
-ifneq "$$(CHECKED_$1)" "YES"
-CHECKED_$1 = YES
-check_packages: check_$1
-.PHONY: check_$1
-check_$1: $$(GHC_CABAL_INPLACE)
- CROSS_COMPILE="$(CrossCompilePrefix)" $$(GHC_CABAL_INPLACE) check $1
-endif
-
ifneq "$3" "0"
$(call haddock,$1,$2)
endif
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 0419c3b4ab..3cea0e4839 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -135,11 +135,14 @@ endif
$1_$2_WAYS = $$($1_$2_PROGRAM_WAY)
+$1_$2_DYNAMIC_TOO = NO
+
$(call hs-sources,$1,$2)
$(call c-sources,$1,$2)
# --- IMPLICIT RULES
+$(call distdir-opts,$1,$2,,$3)
$(call distdir-way-opts,$1,$2,$$($1_$2_PROGRAM_WAY),$3)
ifeq "$3" "0"
@@ -154,15 +157,14 @@ $(call c-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY),NO)
endif
endif
-$(call hs-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY))
+$$(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 c-objs,$1,$2,$$($1_$2_PROGRAM_WAY))
$(call hs-objs,$1,$2,$$($1_$2_PROGRAM_WAY))
$1_$2_LINK_WITH_GCC = NO
-ifeq "$$(BootingFromHc)" "YES"
-$1_$2_LINK_WITH_GCC = YES
-endif
ifeq "$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS)" ""
# We don't want to link the GHC RTS into C-only programs. There's no
@@ -186,13 +188,13 @@ ifneq "$$(BINDIST)" "YES"
# The quadrupled $'s here are because the _<way>_LIB variables aren't
# necessarily set when this part of the makefile is read
$1/$2/build/tmp/$$($1_$2_PROG) : \
- $$(foreach dep,$$($1_$2_DEP_NAMES),\
- $$(if $$(filter ghc,$$(dep)),\
+ $$(foreach dep,$$($1_$2_DEPS),\
+ $$(if $$(filter ghc%,$$(dep)),\
$(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\
$(if $(filter 1,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
$(if $(filter 2,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
$$(error Bad build stage)))),\
- $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)))
+ $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)))
ifeq "$$($1_$2_LINK_WITH_GCC)" "NO"
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
diff --git a/rules/c-suffix-rules.mk b/rules/c-suffix-rules.mk
index 6d4bfe1755..628546c077 100644
--- a/rules/c-suffix-rules.mk
+++ b/rules/c-suffix-rules.mk
@@ -19,8 +19,7 @@ define c-suffix-rules
ifneq "$$(BINDIST)" "YES"
-# UseGhcForCc is only relevant when not booting from HC files.
-ifeq "$4 $$(BootingFromHc)" "YES NO"
+ifeq "$4" "YES"
$1/$2/build/%.$$($3_osuf) : $1/%.c $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
$$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
diff --git a/rules/cmm-suffix-rules.mk b/rules/cmm-suffix-rules.mk
index 0c8b0716e6..6546f86004 100644
--- a/rules/cmm-suffix-rules.mk
+++ b/rules/cmm-suffix-rules.mk
@@ -20,8 +20,6 @@ define cmm-suffix-rules
ifneq "$$(CLEANING)" "YES"
-ifneq "$$(BootingFromHc)" "YES"
-
$1/$2/build/%.$$($3_way_)o : $1/%.cmm $$(rts_H_FILES) $$(includes_H_FILES) $$(includes_DERIVEDCONSTANTS) $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
$$(call cmd,$1_$2_HC) $$($1_$2_$3_MOST_HC_OPTS) -c $$< -o $$@
@@ -50,7 +48,5 @@ $1/$2/build/%.$$($3_way_)hc : $1/$2/build/%.cmm $$(rts_H_FILES) $$(includes_H_FI
endif
-endif
-
endef
diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk
new file mode 100644
index 0000000000..748e27e52d
--- /dev/null
+++ b/rules/distdir-opts.mk
@@ -0,0 +1,111 @@
+# -----------------------------------------------------------------------------
+#
+# (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
+#
+# -----------------------------------------------------------------------------
+
+
+# Set compilation flags that additionally depend on a particular way
+
+define distdir-opts # args: $1 = dir, $2 = distdir, $3 = stage
+
+ifeq "$3" "0"
+# This is a bit of a hack.
+# If we are compiling something with the bootstrapping compiler on
+# cygwin, and it uses an include file from the rts (say), then we
+# need to stop mkdependC from generating a dependincy on
+# c:/ghc/rts/include/Rts.h
+# as that confuses make. So we use -isystem instead of -I, which stops
+# these dependencies from being generated. Technically this is wrong if
+# we depend on a library that is built inside the build tree, and we
+# use headers from that library, but currently I don't think that's the
+# case.
+$1_$2_DEP_INCLUDE_DIRS_FLAG = -isystem
+else
+$1_$2_DEP_INCLUDE_DIRS_FLAG = -I
+endif
+
+ifneq ($$(strip $$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED)),)
+$1_$2_CC_INC_FLAGS := $$(subst $$(space)',$$(space)$$($1_$2_DEP_INCLUDE_DIRS_FLAG)',$$(space)$$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED))
+endif
+
+# The CONF_CC_OPTS_STAGE$3 options are what we use to get gcc to
+# behave correctly, but they are specific to the gcc that we are using.
+# If GHC is compiling C code then it will take care of that for us,
+# and in the case of the stage 0 compiler it may be using a different
+# gcc, so we don't want to use our gcc-specific options.
+$1_$2_DIST_GCC_CC_OPTS = \
+ $$(CONF_CC_OPTS_STAGE$3) \
+ $$($1_$2_DIST_CC_OPTS)
+
+$1_$2_DIST_CC_OPTS = \
+ $$(SRC_CC_OPTS) \
+ $$($1_CC_OPTS) \
+ $$(foreach dir,$$(filter-out /%,$$($1_$2_INCLUDE_DIRS)),-I$1/$$(dir)) \
+ $$(foreach dir,$$(filter /%,$$($1_$2_INCLUDE_DIRS)),-I$$(dir)) \
+ $$($1_$2_CC_OPTS) \
+ $$($1_$2_CPP_OPTS) \
+ $$($1_$2_CC_INC_FLAGS) \
+ $$($1_$2_DEP_CC_OPTS) \
+ $$(SRC_CC_WARNING_OPTS)
+
+ifneq ($$(strip $$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)),)
+$1_$2_DIST_LD_LIB_DIRS := $$(subst $$(space)',$$(space)-L',$$(space)$$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED))
+endif
+
+$1_$2_DIST_LD_OPTS = \
+ $$(CONF_GCC_LINKER_OPTS_STAGE$3) \
+ $$(SRC_LD_OPTS) \
+ $$($1_LD_OPTS) \
+ $$($1_$2_LD_OPTS) \
+ $$($1_$2_DIST_LD_LIB_DIRS) \
+ $$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \
+ $$($1_$2_DEP_LD_OPTS)
+
+# c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
+# We use '' around cflags and lflags to handle paths with backslashes in
+# on Windows
+ifneq ($$(strip $$($1_$2_DIST_GCC_CC_OPTS)),)
+$1_$2_HSC2HS_CC_OPTS:=$$(shell for i in $$($1_$2_DIST_GCC_CC_OPTS); do echo \'--cflag=$$$$i\'; done)
+endif
+ifneq ($$(strip $$($1_$2_DIST_LD_OPTS)),)
+$1_$2_HSC2HS_LD_OPTS:=$$(shell for i in $$($1_$2_DIST_LD_OPTS); do echo \'--lflag=$$$$i\'; done)
+endif
+
+$1_$2_ALL_HSC2HS_OPTS = \
+ --cc=$$(WhatGccIsCalled) \
+ --ld=$$(WhatGccIsCalled) \
+ $$(CONF_HSC2HS_OPTS) \
+ $$(SRC_HSC2HS_OPTS) \
+ --cflag=-D__GLASGOW_HASKELL__=$$(if $$(filter 0,$3),$$(GhcCanonVersion),$$(ProjectVersionInt)) \
+ --cflag=-D$$(HostArch_CPP)_HOST_ARCH=1 \
+ --cflag=-D$$(HostOS_CPP)_HOST_OS=1 \
+ $$($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) \
+ $$($$(basename $$<)_HSC2HS_OPTS) \
+ $$(EXTRA_HSC2HS_OPTS)
+
+$1_$2_ALL_ALEX_OPTS = \
+ $$(CONF_ALEX_OPTS) \
+ $$(SRC_ALEX_OPTS)
+ $$($1_ALEX_OPTS) \
+ $$($1_$2_ALEX_OPTS) \
+ $$(EXTRA_ALEX_OPTS)
+
+$1_$2_ALL_HAPPY_OPTS = \
+ $$(CONF_HAPPY_OPTS) \
+ $$(SRC_HAPPY_OPTS) \
+ $$($1_HAPPY_OPTS) \
+ $$($1_$2_HAPPY_OPTS) \
+ $$(EXTRA_HAPPY_OPTS)
+
+endef
+
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index 4d27bbfdc8..b04241d2bf 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -100,6 +100,7 @@ $1_$2_$3_MOST_HC_OPTS = \
$$(if $$($1_PACKAGE),-optP-include -optP$1/$2/build/autogen/cabal_macros.h) \
$$(foreach pkg,$$($1_$2_DEPS),-package $$(pkg)) \
$$(if $$(findstring YES,$$($1_$2_SplitObjs)),$$(if $$(findstring dyn,$3),,-split-objs),) \
+ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),$$(if $$(findstring v,$3),-dynamic-too)) \
$$($1_$2_HC_OPTS) \
$$(CONF_HC_OPTS_STAGE$4) \
$$($1_$2_MORE_HC_OPTS) \
@@ -119,59 +120,6 @@ $1_$2_$3_ALL_HC_OPTS = \
-odir $1/$2/build -hidir $1/$2/build -stubdir $1/$2/build \
-hisuf $$($3_hisuf) -osuf $$($3_osuf) -hcsuf $$($3_hcsuf)
-ifeq "$4" "0"
-# This is a bit of a hack.
-# If we are compiling something with the bootstrapping compiler on
-# cygwin, and it uses an include file from the rts (say), then we
-# need to stop mkdependC from generating a dependincy on
-# c:/ghc/rts/include/Rts.h
-# as that confuses make. So we use -isystem instead of -I, which stops
-# these dependencies from being generated. Technically this is wrong if
-# we depend on a library that is built inside the build tree, and we
-# use headers from that library, but currently I don't think that's the
-# case.
-$1_$2_DEP_INCLUDE_DIRS_FLAG = -isystem
-else
-$1_$2_DEP_INCLUDE_DIRS_FLAG = -I
-endif
-
-ifneq ($$(strip $$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED)),)
-$1_$2_CC_INC_FLAGS := $$(subst $$(space)',$$(space)$$($1_$2_DEP_INCLUDE_DIRS_FLAG)',$$(space)$$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED))
-endif
-
-# The CONF_CC_OPTS_STAGE$4 options are what we use to get gcc to
-# behave correctly, but they are specific to the gcc that we are using.
-# If GHC is compiling C code then it will take care of that for us,
-# and in the case of the stage 0 compiler it may be using a different
-# gcc, so we don't want to use our gcc-specific options.
-$1_$2_DIST_GCC_CC_OPTS = \
- $$(CONF_CC_OPTS_STAGE$4) \
- $$($1_$2_DIST_CC_OPTS)
-
-$1_$2_DIST_CC_OPTS = \
- $$(SRC_CC_OPTS) \
- $$($1_CC_OPTS) \
- $$(foreach dir,$$(filter-out /%,$$($1_$2_INCLUDE_DIRS)),-I$1/$$(dir)) \
- $$(foreach dir,$$(filter /%,$$($1_$2_INCLUDE_DIRS)),-I$$(dir)) \
- $$($1_$2_CC_OPTS) \
- $$($1_$2_CPP_OPTS) \
- $$($1_$2_CC_INC_FLAGS) \
- $$($1_$2_DEP_CC_OPTS) \
- $$(SRC_CC_WARNING_OPTS)
-
-ifneq ($$(strip $$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)),)
-$1_$2_DIST_LD_LIB_DIRS := $$(subst $$(space)',$$(space)-L',$$(space)$$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED))
-endif
-
-$1_$2_DIST_LD_OPTS = \
- $$(CONF_GCC_LINKER_OPTS_STAGE$4) \
- $$(SRC_LD_OPTS) \
- $$($1_LD_OPTS) \
- $$($1_$2_LD_OPTS) \
- $$($1_$2_DIST_LD_LIB_DIRS) \
- $$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \
- $$($1_$2_DEP_LD_OPTS)
-
ifeq "$3" "dyn"
ifneq "$4" "0"
ifeq "$$(TargetOS_CPP)" "linux"
@@ -184,32 +132,6 @@ endif
endif
endif
-# c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
-# We use '' around cflags and lflags to handle paths with backslashes in
-# on Windows
-ifneq ($$(strip $$($1_$2_DIST_GCC_CC_OPTS)),)
-$1_$2_$3_HSC2HS_CC_OPTS:=$$(shell for i in $$($1_$2_DIST_GCC_CC_OPTS); do echo \'--cflag=$$$$i\'; done)
-endif
-ifneq ($$(strip $$($1_$2_DIST_LD_OPTS)),)
-$1_$2_$3_HSC2HS_LD_OPTS:=$$(shell for i in $$($1_$2_DIST_LD_OPTS); do echo \'--lflag=$$$$i\'; done)
-endif
-
-$1_$2_$3_ALL_HSC2HS_OPTS = \
- --cc=$$(WhatGccIsCalled) \
- --ld=$$(WhatGccIsCalled) \
- $$(CONF_HSC2HS_OPTS) \
- $$(SRC_HSC2HS_OPTS) \
- $$(WAY_$3_HSC2HS_OPTS) \
- --cflag=-D__GLASGOW_HASKELL__=$$(if $$(filter 0,$4),$$(GhcCanonVersion),$$(ProjectVersionInt)) \
- --cflag=-D$$(HostArch_CPP)_HOST_ARCH=1 \
- --cflag=-D$$(HostOS_CPP)_HOST_OS=1 \
- $$($1_$2_$3_HSC2HS_CC_OPTS) \
- $$($1_$2_$3_HSC2HS_LD_OPTS) \
- --cflag=-I$1/$2/build/autogen \
- $$(if $$($1_PACKAGE),--cflag=-include --cflag=$1/$2/build/autogen/cabal_macros.h) \
- $$($$(basename $$<)_HSC2HS_OPTS) \
- $$(EXTRA_HSC2HS_OPTS)
-
$1_$2_$3_ALL_CC_OPTS = \
$$(WAY_$3_CC_OPTS) \
$$($1_$2_DIST_GCC_CC_OPTS) \
@@ -235,23 +157,5 @@ $1_$2_$3_ALL_AS_OPTS = \
$$($1_$2_$3_AS_OPTS) \
$$(EXTRA_AS_OPTS)
-$1_$2_$3_ALL_ALEX_OPTS = \
- $$(CONF_ALEX_OPTS) \
- $$(SRC_ALEX_OPTS)
- $$(WAY_$3_ALEX_OPTS) \
- $$($1_ALEX_OPTS) \
- $$($1_$2_ALEX_OPTS) \
- $$($1_$2_$3_ALEX_OPTS) \
- $$(EXTRA_ALEX_OPTS)
-
-$1_$2_$3_ALL_HAPPY_OPTS = \
- $$(CONF_HAPPY_OPTS) \
- $$(SRC_HAPPY_OPTS) \
- $$(WAY_$3_HAPPY_OPTS) \
- $$($1_HAPPY_OPTS) \
- $$($1_$2_HAPPY_OPTS) \
- $$($1_$2_$3_HAPPY_OPTS) \
- $$(EXTRA_HAPPY_OPTS)
-
endef
diff --git a/rules/haddock.mk b/rules/haddock.mk
index 4dabe3c71f..3a3fed4503 100644
--- a/rules/haddock.mk
+++ b/rules/haddock.mk
@@ -42,7 +42,7 @@ endif
ifneq "$$(BINDIST)" "YES"
$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$(INPLACE_BIN)/haddock$$(exeext) $$(GHC_CABAL_INPLACE) $$($1_$2_HS_SRCS) $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS) | $$$$(dir $$$$@)/.
ifeq "$$(HSCOLOUR_SRCS)" "YES"
- CROSS_COMPILE="$(CrossCompilePrefix)" "$$(GHC_CABAL_INPLACE)" hscolour $2 $1
+ "$$(GHC_CABAL_INPLACE)" hscolour $2 $1
endif
"$$(TOP)/$$(INPLACE_BIN)/haddock" \
--odir="$1/$2/doc/html/$$($1_PACKAGE)" \
diff --git a/rules/hi-rule.mk b/rules/hi-rule.mk
index e478c17aea..b87e600990 100644
--- a/rules/hi-rule.mk
+++ b/rules/hi-rule.mk
@@ -67,29 +67,37 @@
# However, given that rule, make thinks that it can make .hi files
# for any object file, even if the object file was created from e.g.
# a C source file. We therefore also add a dependency on the .hs/.lhs
-# source file, which means we finally end up with rules like:
+# source file, which means we end up with rules like:
#
# a/%.hi : a/%.o b/%.hs ;
-
-define hi-rule # $1 = source directory, $2 = object directory, $3 = way
-
-$(call hi-rule-helper,$2/%.$$($3_hisuf) : $2/%.$$($3_osuf) $1/%.hs)
-$(call hi-rule-helper,$2/%.$$($3_hisuf) : $2/%.$$($3_osuf) $1/%.lhs)
-
-$(call hi-rule-helper,$2/%.$$($3_way_)hi-boot : $2/%.$$($3_way_)o-boot $1/%.hs)
-$(call hi-rule-helper,$2/%.$$($3_way_)hi-boot : $2/%.$$($3_way_)o-boot $1/%.lhs)
-
-endef
+#
+# But! If a file is not explicitly mentioned in a makefile, then if
+# make needs to build it using such a %-rule then it treats it as an
+# 'intermediate file', and deletes it when it is finished. Most .hi
+# files are mentioned in .depend* files, as some other module depends on
+# them, but there are some library modules that aren't imported by
+# anything in the tree.
+#
+# We could stop make from deleting the .hi files by declaring
+# ".SECONDARY:", but if we do that then make takes a pathologically long
+# time with our build system. So we now generate (by calling hi-rule
+# from .depend* files) rules that look like
+#
+# a/B.hi a/B.dyn_hi : %hi : %o x/B.hs
+#
+# Now all the .hi files are explicitly mentioned in the makefiles, so
+# make doesn't think they are merely intermediate files, and doesn't
+# delete them.
ifeq "$(ExtraMakefileSanityChecks)" "NO"
-define hi-rule-helper # $1 = rule header
+define hi-rule # $1 = rule header
$1 ;
endef
else
-define hi-rule-helper # $1 = rule header
+define hi-rule # $1 = rule header
$1
@if [ ! -f $$@ ] ; then \
echo "Panic! $$< exists, but $$@ does not."; \
diff --git a/rules/hs-suffix-rules-srcdir.mk b/rules/hs-suffix-rules-srcdir.mk
index 776d1ce0f6..8ed72af3be 100644
--- a/rules/hs-suffix-rules-srcdir.mk
+++ b/rules/hs-suffix-rules-srcdir.mk
@@ -12,89 +12,38 @@
define hs-suffix-rules-srcdir
-# args: $1 = dir, $2 = distdir, $3 = way, $4 = srcdir
+# args: $1 = dir, $2 = distdir, $3 = srcdir
# Preprocessing Haskell source
ifneq "$$(BINDIST)" "YES"
-ifneq "$$(BootingFromHc)" "YES"
+$1/$2/build/%.hs : $1/$3/%.ly | $$$$(dir $$$$@)/.
+ $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@
-$1/$2/build/%.hs : $1/$4/%.ly | $$$$(dir $$$$@)/.
- $$(call cmd,HAPPY) $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
-
-$1/$2/build/%.hs : $1/$4/%.y | $$$$(dir $$$$@)/.
- $$(call cmd,HAPPY) $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
+$1/$2/build/%.hs : $1/$3/%.y | $$$$(dir $$$$@)/.
+ $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@
$1/$2/build/%.hs : $1/$2/build/%.ly | $$$$(dir $$$$@)/.
- $$(call cmd,HAPPY) $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
+ $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@
$1/$2/build/%.hs : $1/$2/build/%.y | $$$$(dir $$$$@)/.
- $$(call cmd,HAPPY) $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
-
-$1/$2/build/%.hs : $1/$4/%.x | $$$$(dir $$$$@)/.
- $$(call cmd,ALEX) $$($1_$2_$3_ALL_ALEX_OPTS) $$< -o $$@
-
-$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$4/%.hsc $$(HSC2HS_INPLACE) | $$$$(dir $$$$@)/.
- $$(call cmd,HSC2HS_INPLACE) $$($1_$2_$3_ALL_HSC2HS_OPTS) $$< -o $$@
-
-# Compiling Haskell source
-
-$1/$2/build/%.$$($3_osuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
-
-$1/$2/build/%.$$($3_osuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
-
-$1/$2/build/%.$$($3_hcsuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@
-
-$1/$2/build/%.$$($3_hcsuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@
-
-$(call hi-rule,$1/$4,$1/$2/build,$3)
-
-endif
-
-# 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 $$@
+ $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@
-$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 $$@
+$1/$2/build/%.hs : $1/$3/%.x | $$$$(dir $$$$@)/.
+ $$(call cmd,ALEX) $$($1_$2_ALL_ALEX_OPTS) $$< -o $$@
-# $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_way_)hc
-# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
-#
-# $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc
-# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
-#
-# $1/$2/build/%.$$($3_way_)s : $1/$2/build/%.$$($3_way_)hc
-# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -S $$< -o $$@
+$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$3/%.hsc $$(HSC2HS_INPLACE) | $$$$(dir $$$$@)/.
+ $$(call cmd,HSC2HS_INPLACE) $$($1_$2_ALL_HSC2HS_OPTS) $$< -o $$@
# Now the rules for hs-boot files.
-$1/$2/build/%.hs-boot : $1/$4/%.hs-boot
+$1/$2/build/%.hs-boot : $1/$3/%.hs-boot
"$$(CP)" $$< $$@
-$1/$2/build/%.lhs-boot : $1/$4/%.lhs-boot
+$1/$2/build/%.lhs-boot : $1/$3/%.lhs-boot
"$$(CP)" $$< $$@
-$1/$2/build/%.$$($3_way_)o-boot : $1/$4/%.hs-boot $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
-
-$1/$2/build/%.$$($3_way_)o-boot : $1/$4/%.lhs-boot $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
-
-ifneq "$$(BootingFromHc)" "YES"
-# stubs are automatically generated and compiled by GHC
-
-$1/$2/build/%_stub.$$($3_osuf): $1/$2/build/%.$$($3_osuf)
- @:
-endif
-
endif
endef
diff --git a/rules/hs-suffix-way-rules-srcdir.mk b/rules/hs-suffix-way-rules-srcdir.mk
new file mode 100644
index 0000000000..b8b8bfd694
--- /dev/null
+++ b/rules/hs-suffix-way-rules-srcdir.mk
@@ -0,0 +1,67 @@
+# -----------------------------------------------------------------------------
+#
+# (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
+#
+# -----------------------------------------------------------------------------
+
+
+define hs-suffix-way-rules-srcdir
+# args: $1 = dir, $2 = distdir, $3 = way, $4 = srcdir
+
+ifneq "$$(BINDIST)" "YES"
+
+# Compiling Haskell source
+
+$1/$2/build/%.$$($3_osuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_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_osuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_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/$4/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
+ $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@
+
+$1/$2/build/%.$$($3_hcsuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP)
+ $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@
+
+# 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/$2/build/%.$$($3_way_)hc
+# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
+#
+# $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc
+# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
+#
+# $1/$2/build/%.$$($3_way_)s : $1/$2/build/%.$$($3_way_)hc
+# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -S $$< -o $$@
+
+# Now the rules for hs-boot files.
+
+$1/$2/build/%.$$($3_way_)o-boot : $1/$4/%.hs-boot $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_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)-boot,$$(basename $$@)))
+
+$1/$2/build/%.$$($3_way_)o-boot : $1/$4/%.lhs-boot $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_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)-boot,$$(basename $$@)))
+
+# stubs are automatically generated and compiled by GHC
+
+$1/$2/build/%_stub.$$($3_osuf): $1/$2/build/%.$$($3_osuf)
+ @:
+
+endif
+
+endef
+
diff --git a/rules/hs-suffix-rules.mk b/rules/hs-suffix-way-rules.mk
index fead7d1d41..e53821554a 100644
--- a/rules/hs-suffix-rules.mk
+++ b/rules/hs-suffix-way-rules.mk
@@ -11,31 +11,44 @@
# -----------------------------------------------------------------------------
-define hs-suffix-rules # args: $1 = dir, $2 = distdir, $3 = way
+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
+# e.g. C sources, so we depend on the v_hisuf rather than v_osuf.
+$1/$2/build/%.$$(dyn_osuf): $1/$2/build/%.$$(v_hisuf)
+ @if [ ! -f $$@ ] ; then \
+ echo "Panic! $$< exists, but $$@ does not."; \
+ exit 1; \
+ fi
+
+$1/$2/build/%.$$(dyn_osuf)-boot: $1/$2/build/%.$$(v_hisuf)-boot
+ @if [ ! -f $$@ ] ; then \
+ echo "Panic! $$< exists, but $$@ does not."; \
+ exit 1; \
+ fi
+else
ifneq "$$(BINDIST)" "YES"
-ifneq "$$(BootingFromHc)" "YES"
$1/$2/build/%.$$($3_hcsuf) : $1/$2/build/%.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/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
+ $$(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)
$$(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)
- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
+ $$(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 $$@)))
-$(call hi-rule,$1/$2/build,$1/$2/build,$3)
-$(call hi-rule,$1/$2/build/autogen,$1/$2/build,$3)
-
-endif
endif
$$(foreach dir,$$($1_$2_HS_SRC_DIRS),\
- $$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$3,$$(dir))))
+ $$(eval $$(call hs-suffix-way-rules-srcdir,$1,$2,$3,$$(dir))))
+
+endif
-endef # hs-suffix-rules
+endef # hs-suffix-way-rules
diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk
index 848fe1b4ce..568d70887b 100644
--- a/rules/manual-package-config.mk
+++ b/rules/manual-package-config.mk
@@ -15,7 +15,7 @@ define manual-package-config # args: $1 = dir
$(call trace, manual-package-config($1))
$(call profStart, manual-package-config($1))
-$1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
+$1/package.conf.inplace : $1/package.conf.in $$(GHC_PKG_INPLACE)
$$(CPP) $$(RAWCPP_FLAGS) -P \
-DTOP='"$$(TOP)"' \
$$($1_PACKAGE_CPP_OPTS) \