Get building GHC itself with Cabal more-or-less working
[ghc-hetmet.git] / mk / cabal-flags.mk
1
2 nothing=
3 space=$(nothing) $(nothing)
4
5 LIBRARIES_ABS = $(FPTOOLS_TOP_ABS)/libraries
6 UTILS_ABS     = $(FPTOOLS_TOP_ABS)/utils
7 CABAL = $(LIBRARIES_ABS)/cabal-bin $(GHC) $(LIBRARIES_ABS)/bootstrapping.conf
8 INSTALL_PACKAGE = \
9     $(UTILS_ABS)/installPackage/install-inplace/bin/installPackage
10
11 # We rely on all the CONFIGURE_ARGS being quoted with '...', and there
12 # being no 's inside the values.
13 FLAGGED_CONFIGURE_ARGS = $(subst $(space)',\
14                                  $(space)--configure-option=',\
15                                  $(space)$(CONFIGURE_ARGS))
16
17 COMMON_CONFIGURE_FLAGS = \
18     --libsubdir='$$pkgid' \
19     --with-ld=$(LD) \
20     $(addprefix --hsc2hs-option=,$(SRC_HSC2HS_OPTS))
21
22 ifneq "$(HSCOLOUR)" ""
23 COMMON_CONFIGURE_FLAGS += --with-hscolour=$(HSCOLOUR)
24 endif
25
26 ifneq "$(ALEX)" ""
27 COMMON_CONFIGURE_FLAGS += --with-alex=$(ALEX)
28 endif
29
30 ifneq "$(HADDOCK)" ""
31 COMMON_CONFIGURE_FLAGS += --with-haddock=$(HADDOCK)
32 endif
33
34 ifneq "$(HAPPY)" ""
35 COMMON_CONFIGURE_FLAGS += --with-happy=$(HAPPY)
36 endif
37
38 COMMON_CONFIGURE_FLAGS += $(FLAGGED_CONFIGURE_ARGS) \
39                           --configure-option=--with-cc=$(CC)
40
41 COMMON_CONFIGURE_FLAGS += $(shell [ -e $(HSC2HS_INPLACE) ] && \
42                                   echo --with-hsc2hs=$(HSC2HS_INPLACE) )
43
44 ifeq "$(Windows)" "YES"
45 NONEXISTENT=c:/NONEXISTENT
46 else
47 NONEXISTENT=/NONEXISTENT
48 endif
49
50 # We put non-existant paths in when configuring things that we plan to
51 # install, as we require that builds don't depend on these paths when
52 # making bindists.
53 INSTALL_DIRS_CONFIGURE_FLAGS = \
54     --prefix=$(NONEXISTENT) \
55     --bindir=$(NONEXISTENT) \
56     --libdir=$(NONEXISTENT) \
57     --libexecdir=$(NONEXISTENT) \
58     --datadir=$(NONEXISTENT) \
59     --docdir=$(NONEXISTENT) \
60     --haddockdir=$(NONEXISTENT) \
61     --htmldir=$(NONEXISTENT)
62
63 INPLACE_DIRS_CONFIGURE_FLAGS = \
64     --prefix=`$(TOP)/utils/pwd/pwd forwardslash`/install-inplace
65
66 USE_STAGE1_CONFIGURE_FLAGS = \
67     --with-compiler=$(GHC_STAGE1) \
68     --with-hc-pkg=$(FPTOOLS_TOP_ABS)/utils/ghc-pkg/ghc-pkg-inplace \
69     $(addprefix --cc-option=,$(MACOSX_DEPLOYMENT_CC_OPTS)) \
70     $(addprefix --ld-option=,$(MACOSX_DEPLOYMENT_LD_OPTS))
71
72 USE_BOOT_CONFIGURE_FLAGS = \
73     --with-compiler=$(GHC) \
74     --with-hc-pkg=$(GHC_PKG) \
75         --package-db $(FPTOOLS_TOP_ABS)/libraries/bootstrapping.conf
76
77 # XXX
78 #    --bindir='$$prefix/bin' \
79 #    --libdir='$$prefix/lib' \
80 #    --libexecdir='$$prefix/libexec' \
81 #    --datadir='$$prefix/data' \
82 #    --docdir='$$prefix/doc' \
83 #    --haddockdir='$$prefix/haddock' \
84 #    --htmldir='$$prefix/html' \
85
86 BUILD_FLAGS = $(addprefix --ghc-option=,$(SRC_HC_OPTS))
87