update submodules for GHC.HetMet.GArrow -> Control.GArrow renaming
[ghc-hetmet.git] / utils / ghc-cabal / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 # Bootstrapping ghc-cabal
14
15 # Euch, hideous hack:
16 # XXX This should be in a different Makefile
17 CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/Cabal/Cabal.cabal | sed "s/^Version: //")
18 CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
19 CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
20
21 $(GHC_CABAL_INPLACE) : $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext) | $$(dir $$@)/.
22         "$(CP)" $< $@
23
24 $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*/*/*.hs)
25 $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*/*.hs)
26 $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/Distribution/*.hs)
27
28 $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs | $$(dir $$@)/. bootstrapping/.
29         "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/Main.hs -o $@ \
30                -no-user-package-conf \
31                -Wall $(WERROR) \
32                -DCABAL_VERSION=$(CABAL_VERSION) \
33                -odir  bootstrapping \
34                -hidir bootstrapping \
35                -ilibraries/Cabal \
36                -ilibraries/filepath \
37                -ilibraries/hpc
38         touch $@
39
40 # touch is required, because otherwise if mkdirhier is newer, we
41 # repeatedly rebuild ghc-cabal.
42
43 $(eval $(call clean-target,$(GHC_CABAL_DIR),dist,\
44    $(GHC_CABAL_DIR)/dist bootstrapping))
45
46 $(eval $(call all-target,$(GHC_CABAL_DIR),$(GHC_CABAL_INPLACE)))
47
48 # -----------------------------------------------------------------------------
49 # Now make another copy that goes in bindists. This needs to be built
50 # with the in-tree compiler.
51
52 $(GHC_CABAL_DIR)_USES_CABAL                   = YES
53 $(GHC_CABAL_DIR)_PACKAGE                      = ghc-cabal
54 $(GHC_CABAL_DIR)_dist-install_PROG            = ghc-cabal$(exeext)
55 $(GHC_CABAL_DIR)_dist-install_INSTALL_INPLACE = NO
56 $(GHC_CABAL_DIR)_dist-install_MODULES         = Main
57
58 $(eval $(call build-prog,utils/ghc-cabal,dist-install,1))
59