4e61c662d81de65938f341879e2c743e1f7ce8b8
[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 STAGE3_PACKAGE_CONF = $(FPTOOLS_TOP_ABS)/stage3.package.conf
11
12 # We rely on all the CONFIGURE_ARGS being quoted with '...', and there
13 # being no 's inside the values.
14 FLAGGED_CONFIGURE_ARGS = $(subst $(space)',\
15                                  $(space)--configure-option=',\
16                                  $(space)$(CONFIGURE_ARGS))
17
18 COMMON_CONFIGURE_FLAGS = \
19     --libsubdir='$$pkgid' \
20     --with-ld=$(LD) \
21     $(addprefix --hsc2hs-option=,$(SRC_HSC2HS_OPTS))
22
23 ifneq "$(HSCOLOUR)" ""
24 COMMON_CONFIGURE_FLAGS += --with-hscolour=$(HSCOLOUR)
25 endif
26
27 ifneq "$(ALEX)" ""
28 COMMON_CONFIGURE_FLAGS += --with-alex=$(ALEX)
29 endif
30
31 ifneq "$(HADDOCK)" ""
32 COMMON_CONFIGURE_FLAGS += --with-haddock=$(HADDOCK)
33 endif
34
35 ifneq "$(HAPPY)" ""
36 COMMON_CONFIGURE_FLAGS += --with-happy=$(HAPPY)
37 endif
38
39 COMMON_CONFIGURE_FLAGS += $(FLAGGED_CONFIGURE_ARGS) \
40                           --configure-option=--with-cc=$(CC)
41
42 COMMON_CONFIGURE_FLAGS += $(shell [ -e $(HSC2HS_INPLACE) ] && \
43                                   echo --with-hsc2hs=$(HSC2HS_INPLACE) )
44
45 ifeq "$(Windows)" "YES"
46 NONEXISTENT=c:/NONEXISTENT
47 else
48 NONEXISTENT=/NONEXISTENT
49 endif
50
51 # We put non-existant paths in when configuring things that we plan to
52 # install, as we require that builds don't depend on these paths when
53 # making bindists.
54 INSTALL_DIRS_CONFIGURE_FLAGS = \
55     --prefix=$(NONEXISTENT) \
56     --bindir=$(NONEXISTENT) \
57     --libdir=$(NONEXISTENT) \
58     --libexecdir=$(NONEXISTENT) \
59     --datadir=$(NONEXISTENT) \
60     --docdir=$(NONEXISTENT) \
61     --haddockdir=$(NONEXISTENT) \
62     --htmldir=$(NONEXISTENT)
63
64 INPLACE_GHC_DATADIR_CONFIGURE_FLAGS = \
65     --datadir=$(FPTOOLS_TOP_ABS)/inplace-datadir \
66     --datasubdir=.
67
68 INPLACE_DIRS_CONFIGURE_FLAGS = \
69     --prefix=`$(FPTOOLS_TOP_ABS)/utils/pwd/pwd forwardslash`/install-inplace
70
71 USE_BOOT_CONFIGURE_FLAGS = \
72     --with-compiler=$(GHC) \
73     --with-hc-pkg=$(GHC_PKG) \
74         --package-db $(FPTOOLS_TOP_ABS)/libraries/bootstrapping.conf
75
76 USE_STAGE_CONFIGURE_FLAGS = \
77     --with-hc-pkg=$(GHC_PKG_INPLACE) \
78     $(addprefix --cc-option=,$(MACOSX_DEPLOYMENT_CC_OPTS)) \
79     $(addprefix --ld-option=,$(MACOSX_DEPLOYMENT_LD_OPTS))
80
81 USE_STAGE1_CONFIGURE_FLAGS = \
82     --with-compiler=$(GHC_STAGE1) \
83     $(USE_STAGE_CONFIGURE_FLAGS)
84
85 USE_STAGE2_CONFIGURE_FLAGS =            \
86     --with-compiler=$(GHC_STAGE2)       \
87     $(USE_STAGE_CONFIGURE_FLAGS)        \
88         --package-db $(STAGE3_PACKAGE_CONF)
89
90 BUILD_FLAGS = $(addprefix --ghc-option=,$(SRC_HC_OPTS))
91