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