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