Tell Cabal where gcc is
[ghc.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 "$(HADDOCK)" ""
33 COMMON_CONFIGURE_FLAGS += --with-haddock=$(HADDOCK)
34 endif
35
36 ifneq "$(HAPPY)" ""
37 COMMON_CONFIGURE_FLAGS += --with-happy=$(HAPPY)
38 endif
39
40 COMMON_CONFIGURE_FLAGS += $(FLAGGED_CONFIGURE_ARGS) \
41 --configure-option=--with-cc=$(CC)
42
43 COMMON_CONFIGURE_FLAGS += $(shell [ -e $(HSC2HS_INPLACE) ] && \
44 echo --with-hsc2hs=$(HSC2HS_INPLACE) )
45
46 ifeq "$(Windows)" "YES"
47 NONEXISTENT=c:/NONEXISTENT
48 else
49 NONEXISTENT=/NONEXISTENT
50 endif
51
52 # We put non-existant paths in when configuring things that we plan to
53 # install, as we require that builds don't depend on these paths when
54 # making bindists.
55 INSTALL_DIRS_CONFIGURE_FLAGS = \
56 --prefix=$(NONEXISTENT) \
57 --bindir=$(NONEXISTENT) \
58 --libdir=$(NONEXISTENT) \
59 --libexecdir=$(NONEXISTENT) \
60 --datadir=$(NONEXISTENT) \
61 --docdir=$(NONEXISTENT) \
62 --haddockdir=$(NONEXISTENT) \
63 --htmldir=$(NONEXISTENT)
64
65 INPLACE_GHC_DATADIR_CONFIGURE_FLAGS = \
66 --datadir=$(FPTOOLS_TOP_ABS)/inplace-datadir \
67 --datasubdir=.
68
69 INPLACE_DIRS_CONFIGURE_FLAGS = \
70 --prefix=`$(FPTOOLS_TOP_ABS)/utils/pwd/pwd forwardslash`/install-inplace
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 USE_STAGE_CONFIGURE_FLAGS = \
78 --with-hc-pkg=$(GHC_PKG_INPLACE) \
79 $(addprefix --cc-option=,$(MACOSX_DEPLOYMENT_CC_OPTS)) \
80 $(addprefix --ld-option=,$(MACOSX_DEPLOYMENT_LD_OPTS))
81
82 USE_STAGE1_CONFIGURE_FLAGS = \
83 --with-compiler=$(GHC_STAGE1) \
84 $(USE_STAGE_CONFIGURE_FLAGS)
85
86 USE_STAGE2_CONFIGURE_FLAGS = \
87 --with-compiler=$(GHC_STAGE2) \
88 $(USE_STAGE_CONFIGURE_FLAGS) \
89 --package-db $(STAGE3_PACKAGE_CONF)
90
91 BUILD_FLAGS = $(addprefix --ghc-option=,$(SRC_HC_OPTS))
92