summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-03-03 18:49:23 +0000
committerIan Lynagh <ian@well-typed.com>2013-03-03 19:56:49 +0000
commit1da6975add0b333027f2b643933a4b60f0f66095 (patch)
treeb0fb41e1be3d37acec65c2920e7555df804817d8
parent5d0801dac3503c242e874eb6334245943b2e7908 (diff)
downloadhaskell-1da6975add0b333027f2b643933a4b60f0f66095.tar.gz
Define $(prog)_INPLACE variables automatically, and start using them
-rw-r--r--compiler/ghc.mk48
-rw-r--r--ghc.mk10
-rw-r--r--mk/config.mk.in18
-rw-r--r--mk/tree.mk2
-rw-r--r--rts/ghc.mk4
-rw-r--r--rules/build-prog.mk16
-rw-r--r--rules/hs-suffix-rules-srcdir.mk4
-rw-r--r--rules/pretty_commands.mk2
-rw-r--r--utils/genapply/ghc.mk2
-rw-r--r--utils/genprimopcode/ghc.mk2
-rw-r--r--utils/ghc-cabal/ghc.mk30
-rw-r--r--utils/touchy/ghc.mk2
12 files changed, 67 insertions, 73 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index f15fc2d0e7..0cceed03cb 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -246,33 +246,33 @@ compiler/stage$1/build/Parser.y: compiler/parser/Parser.y.pp
compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H)
$$(CPP) $$(RAWCPP_FLAGS) -P $$(compiler_CPP_OPTS) -Icompiler/stage$1 -x c $$< | grep -v '^#pragma GCC' > $$@
-compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --data-decl < $$< > $$@
-compiler/stage$1/build/primop-tag.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --primop-tag < $$< > $$@
-compiler/stage$1/build/primop-list.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --primop-list < $$< > $$@
-compiler/stage$1/build/primop-has-side-effects.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --has-side-effects < $$< > $$@
-compiler/stage$1/build/primop-out-of-line.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --out-of-line < $$< > $$@
-compiler/stage$1/build/primop-commutable.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --commutable < $$< > $$@
-compiler/stage$1/build/primop-code-size.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --code-size < $$< > $$@
-compiler/stage$1/build/primop-can-fail.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --can-fail < $$< > $$@
-compiler/stage$1/build/primop-strictness.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --strictness < $$< > $$@
-compiler/stage$1/build/primop-fixity.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --fixity < $$< > $$@
-compiler/stage$1/build/primop-primop-info.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --primop-primop-info < $$< > $$@
+compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --data-decl < $$< > $$@
+compiler/stage$1/build/primop-tag.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --primop-tag < $$< > $$@
+compiler/stage$1/build/primop-list.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --primop-list < $$< > $$@
+compiler/stage$1/build/primop-has-side-effects.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --has-side-effects < $$< > $$@
+compiler/stage$1/build/primop-out-of-line.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --out-of-line < $$< > $$@
+compiler/stage$1/build/primop-commutable.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --commutable < $$< > $$@
+compiler/stage$1/build/primop-code-size.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --code-size < $$< > $$@
+compiler/stage$1/build/primop-can-fail.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --can-fail < $$< > $$@
+compiler/stage$1/build/primop-strictness.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --strictness < $$< > $$@
+compiler/stage$1/build/primop-fixity.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --fixity < $$< > $$@
+compiler/stage$1/build/primop-primop-info.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --primop-primop-info < $$< > $$@
# Usages aren't used any more; but the generator
# can still generate them if we want them back
-compiler/stage$1/build/primop-usage.hs-incl: compiler/stage$1/build/primops.txt $$(GENPRIMOP_INPLACE)
- "$$(GENPRIMOP_INPLACE)" --usage < $$< > $$@
+compiler/stage$1/build/primop-usage.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE)
+ "$$(genprimopcode_INPLACE)" --usage < $$< > $$@
endef
diff --git a/ghc.mk b/ghc.mk
index f4d85abce1..5f5f472f64 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -549,8 +549,8 @@ endef
PRIMOPS_TXT_STAGE1 = compiler/stage1/build/primops.txt
-libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $(GENPRIMOP_INPLACE) $(PRIMOPS_TXT_STAGE1) | $$(dir $$@)/.
- "$(GENPRIMOP_INPLACE)" --make-haskell-wrappers < $(PRIMOPS_TXT_STAGE1) >$@
+libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $$(genprimopcode_INPLACE) $(PRIMOPS_TXT_STAGE1) | $$(dir $$@)/.
+ "$(genprimopcode_INPLACE)" --make-haskell-wrappers < $(PRIMOPS_TXT_STAGE1) >$@
# Required so that Haddock documents the primops.
libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs
@@ -655,7 +655,7 @@ BUILD_DIRS += utils/deriveConstants
BUILD_DIRS += utils/testremove
BUILD_DIRS += $(MAYBE_GHCTAGS)
BUILD_DIRS += utils/ghc-pwd
-BUILD_DIRS += $(GHC_CABAL_DIR)
+BUILD_DIRS += utils/ghc-cabal
BUILD_DIRS += $(MAYBE_HPC)
BUILD_DIRS += $(MAYBE_RUNGHC)
BUILD_DIRS += ghc
@@ -767,9 +767,9 @@ $(ghc-prim-$(libraries/ghc-prim_dist-install_VERSION)_HADDOCK_FILE): \
endif # BINDIST
libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs: \
- $(PRIMOPS_TXT_STAGE1) $(GENPRIMOP_INPLACE) \
+ $(PRIMOPS_TXT_STAGE1) $$(genprimopcode_INPLACE) \
| $$(dir $$@)/.
- "$(GENPRIMOP_INPLACE)" --make-haskell-source < $< > $@
+ "$(genprimopcode_INPLACE)" --make-haskell-source < $< > $@
.PHONY: tags
tags: tags_compiler
diff --git a/mk/config.mk.in b/mk/config.mk.in
index b310e86e98..c43612f709 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -435,24 +435,14 @@ SRC_FLEX_OPTS += -8
# xxx the executable relative to the current dir
GHC_UNLIT_PGM = unlit$(exeext)
-GHC_HSC2HS_PGM = hsc2hs$(exeext)
-GHC_TOUCHY_PGM = touchy$(exeext)
GHC_SPLIT_PGM = ghc-split
-GHC_GENPRIMOP_PGM = genprimopcode$(exeext)
-GHC_GENAPPLY_PGM = genapply$(exeext)
-GHC_CABAL_PGM = ghc-cabal$(exeext)
-GHC_PKG_PGM = ghc-pkg$(exeext)
-GHC_MKDIRHIER_PGM = mkdirhier
SPLIT = $(INPLACE_LIB)/$(GHC_SPLIT_PGM)
UNLIT = $(INPLACE_LIB)/$(GHC_UNLIT_PGM)
-TOUCHY = $(INPLACE_LIB)/$(GHC_TOUCHY_PGM)
-MKDIRHIER = $(INPLACE_BIN)/$(GHC_MKDIRHIER_PGM)
-GHC_CABAL_INPLACE = $(INPLACE_BIN)/$(GHC_CABAL_PGM)
-GENAPPLY_INPLACE = $(INPLACE_BIN)/$(GHC_GENAPPLY_PGM)
-GHC_PKG_INPLACE = $(INPLACE_BIN)/$(GHC_PKG_PGM)
-HSC2HS_INPLACE = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
-GENPRIMOP_INPLACE = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
+TOUCHY = $(INPLACE_LIB)/touchy$(exeext)
+MKDIRHIER = $(INPLACE_BIN)/mkdirhier
+GHC_CABAL_INPLACE = $(INPLACE_BIN)/ghc-cabal$(exeext)
+GHC_PKG_INPLACE = $(INPLACE_BIN)/ghc-pkg$(exeext)
GENERATED_FILE = chmod a-w
EXECUTABLE_FILE = chmod +x
diff --git a/mk/tree.mk b/mk/tree.mk
index 1ae45ed2cf..9c2e3daa4e 100644
--- a/mk/tree.mk
+++ b/mk/tree.mk
@@ -20,8 +20,6 @@ GHC_INCLUDE_DIRS = includes includes/dist includes/dist-derivedconstants/
GHC_RTS_DIR = rts
GHC_DRIVER_DIR = driver
-GHC_CABAL_DIR = $(GHC_UTILS_DIR)/ghc-cabal
-
INPLACE = inplace
INPLACE_BIN = $(INPLACE)/bin
INPLACE_LIB = $(INPLACE)/lib
diff --git a/rts/ghc.mk b/rts/ghc.mk
index a4c7acb8b7..cc22c0518d 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -57,8 +57,8 @@ endif
rts_AUTO_APPLY_CMM = rts/dist/build/AutoApply.cmm
-$(rts_AUTO_APPLY_CMM): $(GENAPPLY_INPLACE)
- "$(GENAPPLY_INPLACE)" >$@
+$(rts_AUTO_APPLY_CMM): $$(genapply_INPLACE)
+ "$(genapply_INPLACE)" >$@
rts/dist/build/sm/Evac_thr.c : rts/sm/Evac.c | $$(dir $$@)/.
cp $< $@
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 7fbe7897cb..4bf9ab09e4 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -87,15 +87,21 @@ else
$1_$2_INPLACE =
endif
else
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$($$($1_$2_PROG)_INPLACE)" ""
+$$(error $$($1_$2_PROG)_INPLACE defined twice)
+endif
+endif
+ifeq "$$($1_$2_TOPDIR)" "YES"
+$$($1_$2_PROG)_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
+else
+$$($1_$2_PROG)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
+endif
# Where do we install the inplace version?
ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
$1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG)
else
-ifeq "$$($1_$2_TOPDIR)" "YES"
-$1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
-else
-$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
-endif
+$1_$2_INPLACE = $$($$($1_$2_PROG)_INPLACE)
endif
endif
diff --git a/rules/hs-suffix-rules-srcdir.mk b/rules/hs-suffix-rules-srcdir.mk
index 8ed72af3be..d3c932f241 100644
--- a/rules/hs-suffix-rules-srcdir.mk
+++ b/rules/hs-suffix-rules-srcdir.mk
@@ -33,8 +33,8 @@ $1/$2/build/%.hs : $1/$2/build/%.y | $$$$(dir $$$$@)/.
$1/$2/build/%.hs : $1/$3/%.x | $$$$(dir $$$$@)/.
$$(call cmd,ALEX) $$($1_$2_ALL_ALEX_OPTS) $$< -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 $$@
+$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.
diff --git a/rules/pretty_commands.mk b/rules/pretty_commands.mk
index cfd7fac2b6..f7576e171f 100644
--- a/rules/pretty_commands.mk
+++ b/rules/pretty_commands.mk
@@ -6,7 +6,7 @@ endif
label_ALEX=ALEX
label_HAPPY=HAPPY
-label_HSC2HS_INPLACE=HSC2HS
+label_hsc2hs_INPLACE=HSC2HS
diff --git a/utils/genapply/ghc.mk b/utils/genapply/ghc.mk
index 805fd6f697..cd42cb4e34 100644
--- a/utils/genapply/ghc.mk
+++ b/utils/genapply/ghc.mk
@@ -11,7 +11,7 @@
# -----------------------------------------------------------------------------
utils/genapply_dist_MODULES = GenApply
-utils/genapply_dist_PROG = $(GHC_GENAPPLY_PGM)
+utils/genapply_dist_PROG = genapply$(exeext)
utils/genapply_dist_INSTALL_INPLACE = YES
utils/genapply_HC_OPTS += -package pretty
diff --git a/utils/genprimopcode/ghc.mk b/utils/genprimopcode/ghc.mk
index d119d8dfb3..b4fb6c01de 100644
--- a/utils/genprimopcode/ghc.mk
+++ b/utils/genprimopcode/ghc.mk
@@ -11,7 +11,7 @@
# -----------------------------------------------------------------------------
utils/genprimopcode_dist_MODULES = Lexer Main ParserM Parser Syntax
-utils/genprimopcode_dist_PROG = $(GHC_GENPRIMOP_PGM)
+utils/genprimopcode_dist_PROG = genprimopcode$(exeext)
utils/genprimopcode_dist_HC_OPTS = -package array
utils/genprimopcode_dist_INSTALL_INPLACE = YES
diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk
index e95fa62f07..c72f1a1a31 100644
--- a/utils/ghc-cabal/ghc.mk
+++ b/utils/ghc-cabal/ghc.mk
@@ -18,15 +18,15 @@ CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/Cabal/Cabal/Cabal.cab
CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
-$(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/.
+$(GHC_CABAL_INPLACE) : utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/.
"$(CP)" $< $@
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*/*.hs)
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*.hs)
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs)
+utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*/*.hs)
+utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*/*.hs)
+utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs)
-$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/.
- "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/Main.hs -o $@ \
+utils/ghc-cabal/dist/build/tmp/ghc-cabal$(exeext): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/.
+ "$(GHC)" $(SRC_HC_OPTS) --make utils/ghc-cabal/Main.hs -o $@ \
-no-user-$(GHC_PACKAGE_DB_FLAG) \
-Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \
-DCABAL_VERSION=$(CABAL_VERSION) \
@@ -42,21 +42,21 @@ $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs $(T
# touch is required, because otherwise if mkdirhier is newer, we
# repeatedly rebuild ghc-cabal.
-$(eval $(call clean-target,$(GHC_CABAL_DIR),dist,\
- $(GHC_CABAL_DIR)/dist bootstrapping))
+$(eval $(call clean-target,utils/ghc-cabal,dist,\
+ utils/ghc-cabal/dist bootstrapping))
-$(eval $(call all-target,$(GHC_CABAL_DIR),$(GHC_CABAL_INPLACE)))
+$(eval $(call all-target,utils/ghc-cabal,$(GHC_CABAL_INPLACE)))
# -----------------------------------------------------------------------------
# Now make another copy that goes in bindists. This needs to be built
# with the in-tree compiler.
-$(GHC_CABAL_DIR)_USES_CABAL = YES
-$(GHC_CABAL_DIR)_PACKAGE = ghc-cabal
-$(GHC_CABAL_DIR)_dist-install_PROG = ghc-cabal$(exeext)
-$(GHC_CABAL_DIR)_dist-install_INSTALL_INPLACE = NO
-$(GHC_CABAL_DIR)_dist-install_WANT_BINDIST_WRAPPER = YES
-$(GHC_CABAL_DIR)_dist-install_MODULES = Main
+utils/ghc-cabal_USES_CABAL = YES
+utils/ghc-cabal_PACKAGE = ghc-cabal
+utils/ghc-cabal_dist-install_PROG = ghc-cabal$(exeext)
+utils/ghc-cabal_dist-install_INSTALL_INPLACE = NO
+utils/ghc-cabal_dist-install_WANT_BINDIST_WRAPPER = YES
+utils/ghc-cabal_dist-install_MODULES = Main
$(eval $(call build-prog,utils/ghc-cabal,dist-install,1))
diff --git a/utils/touchy/ghc.mk b/utils/touchy/ghc.mk
index 458f80e5ed..8c316ba993 100644
--- a/utils/touchy/ghc.mk
+++ b/utils/touchy/ghc.mk
@@ -11,7 +11,7 @@
# -----------------------------------------------------------------------------
utils/touchy_dist_C_SRCS = touchy.c
-utils/touchy_dist_PROG = $(GHC_TOUCHY_PGM)
+utils/touchy_dist_PROG = touchy$(exeext)
utils/touchy_dist_TOPDIR = YES
utils/touchy_dist_INSTALL = YES
utils/touchy_dist_INSTALL_INPLACE = YES