summaryrefslogtreecommitdiff
path: root/utils/ghc-cabal/ghc.mk
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-04-26 11:42:15 +0000
committerIan Lynagh <igloo@earth.li>2009-04-26 11:42:15 +0000
commit34cc75e1a62638f2833815746ebce0a9114dc26b (patch)
treeef21e8fd7af1356beea9cce7d6efb8a65374e24c /utils/ghc-cabal/ghc.mk
parent74e1368d4688ee16f6decdf2cd3ebe27506b26ba (diff)
downloadhaskell-34cc75e1a62638f2833815746ebce0a9114dc26b.tar.gz
GHC new build system megapatch
Diffstat (limited to 'utils/ghc-cabal/ghc.mk')
-rw-r--r--utils/ghc-cabal/ghc.mk54
1 files changed, 54 insertions, 0 deletions
diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk
new file mode 100644
index 0000000000..c0fd0f336d
--- /dev/null
+++ b/utils/ghc-cabal/ghc.mk
@@ -0,0 +1,54 @@
+# -----------------------------------------------------------------------------
+# Bootstrapping ghc-cabal
+
+# Euch, hideous hack:
+# XXX This should be in a different Makefile
+CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/Cabal/Cabal.cabal | sed "s/^Version: //")
+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)
+ $(MKDIRHIER) $(dir $@)
+ $(CP) $< $@
+
+$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/ghc-cabal.hs $(MKDIRHIER)
+ $(MKDIRHIER) bootstrapping
+ $(MKDIRHIER) $(dir $@)
+ $(GHC) --make $(GHC_CABAL_DIR)/ghc-cabal.hs -o $@ \
+ -Wall $(WERROR) \
+ -DCABAL_VERSION=$(CABAL_VERSION) \
+ -odir bootstrapping \
+ -hidir bootstrapping \
+ -ilibraries/Cabal \
+ -ilibraries/filepath \
+ -ilibraries/hpc
+ touch $@
+
+# 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 all-target,$(GHC_CABAL_DIR),$(GHC_CABAL_INPLACE)))
+
+# -----------------------------------------------------------------------------
+# dummy-ghc
+
+# This is a tiny program to fool Cabal's configure that we have a
+# stage1 GHC, which lets us configure all the packages before we've
+# build stage1.
+
+$(GHC_CABAL_DIR)_dist-dummy-ghc_MODULES = dummy-ghc
+$(GHC_CABAL_DIR)_dist-dummy-ghc_PROG = dummy-ghc$(exeext)
+
+$(GHC_CABAL_DIR)/dist-dummy-ghc/build/dummy-ghc.hs : $(GHC_CABAL_DIR)/ghc.mk $(MKDIRHIER)
+ $(MKDIRHIER) $(dir $@)
+ echo "import System.Environment; import System.Cmd; import System.Exit" >$@
+ echo "main = do args <- getArgs; if args == [\"--numeric-version\"] then putStrLn \"$(ProjectVersion)\" else do e <- rawSystem \"$(GHC_STAGE0)\" args; exitWith e" >>$@
+
+# We don't build dummy-ghc with Cabal, so we need to pass -package
+# flags manually
+utils/ghc-cabal_dist-dummy-ghc_HC_OPTS = -package process
+$(eval $(call build-prog,utils/ghc-cabal,dist-dummy-ghc,0))
+