253a1e3f1f7845a2ed6285b67cb6a0967b6c25c8
[ghc-hetmet.git] / mk / cabal-flags.mk
1
2 nothing=
3 space=$(nothing) $(nothing)
4 comma=,
5
6 GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-install/build/ghc-pkg/ghc-pkg
7
8 LIBRARIES_ABS = $(FPTOOLS_TOP_ABS)/libraries
9 UTILS_ABS     = $(FPTOOLS_TOP_ABS)/utils
10 CABAL = $(LIBRARIES_ABS)/cabal-bin $(GHC) $(LIBRARIES_ABS)/bootstrapping.conf $(CABAL_DOTTED_VERSION)
11 INSTALL_PACKAGE = \
12     $(UTILS_ABS)/installPackage/install-inplace/bin/installPackage
13 STAGE3_PACKAGE_CONF = $(FPTOOLS_TOP_ABS)/stage3.package.conf
14
15 # Euch, hideous hack:
16 CABAL_DOTTED_VERSION = $(shell grep "^Version:" $(LIBRARIES_ABS)/Cabal/Cabal.cabal | sed "s/^Version: //")
17 CABAL_VERSION = $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
18 CABAL_CONSTRAINT = --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
19
20 # We rely on all the CONFIGURE_ARGS being quoted with '...', and there
21 # being no 's inside the values.
22 FLAGGED_CONFIGURE_ARGS = $(subst $(space)',\
23                                  $(space)--configure-option=',\
24                                  $(space)$(CONFIGURE_ARGS))
25
26 COMMON_CONFIGURE_FLAGS =          \
27     --libsubdir='$$pkgid'         \
28     --with-gcc=$(WhatGccIsCalled) \
29     --with-ld=$(LD)               \
30     $(addprefix --hsc2hs-option=,$(SRC_HSC2HS_OPTS))
31
32 ifeq "$(HSCOLOUR_SRCS)" "YES"
33 CONFIGURE_OPTS += --with-hscolour="$(HSCOLOUR)"
34 endif
35
36 ifneq "$(ALEX)" ""
37 COMMON_CONFIGURE_FLAGS += --with-alex="$(ALEX)"
38 endif
39
40 ifneq "$(HAPPY)" ""
41 COMMON_CONFIGURE_FLAGS += --with-happy="$(HAPPY)"
42 endif
43
44 COMMON_CONFIGURE_FLAGS += $(FLAGGED_CONFIGURE_ARGS) \
45                           --configure-option=--with-cc="$(CC)"
46
47 COMMON_CONFIGURE_FLAGS += $(shell [ -f $(HSC2HS_INPLACE) ] && \
48                                   echo --with-hsc2hs=$(HSC2HS_INPLACE) )
49
50 ifeq "$(Windows)" "YES"
51 NONEXISTENT=c:/NONEXISTENT
52 else
53 NONEXISTENT=/NONEXISTENT
54 endif
55
56 # We put non-existant paths in when configuring things that we plan to
57 # install, as we require that builds don't depend on these paths when
58 # making bindists.
59 INSTALL_DIRS_CONFIGURE_FLAGS = \
60     --prefix=$(NONEXISTENT) \
61     --bindir=$(NONEXISTENT) \
62     --libdir=$(NONEXISTENT) \
63     --libexecdir=$(NONEXISTENT) \
64     --datadir=$(NONEXISTENT) \
65     --docdir=$(NONEXISTENT) \
66     --haddockdir=$(NONEXISTENT) \
67     --htmldir=$(NONEXISTENT)
68
69 INPLACE_GHC_DATADIR_CONFIGURE_FLAGS = \
70     --datadir=$(FPTOOLS_TOP_ABS)/inplace-datadir \
71     --datasubdir=.
72
73 INPLACE_DIRS_CONFIGURE_FLAGS = \
74     --prefix=`$(FPTOOLS_TOP_ABS)/utils/pwd/pwd forwardslash`/install-inplace
75
76 USE_BOOT_CONFIGURE_FLAGS = \
77     --with-compiler=$(GHC) \
78     --with-hc-pkg=$(GHC_PKG) \
79         --package-db $(FPTOOLS_TOP_ABS)/libraries/bootstrapping.conf
80
81 USE_STAGE_CONFIGURE_FLAGS = \
82     --with-hc-pkg=$(GHC_PKG_INPLACE) \
83     $(addprefix --cc-option=,$(MACOSX_DEPLOYMENT_CC_OPTS)) \
84     $(addprefix --ld-option=,$(MACOSX_DEPLOYMENT_LD_OPTS))
85
86 USE_STAGE1_CONFIGURE_FLAGS = \
87     --with-compiler=$(GHC_STAGE1) \
88     $(USE_STAGE_CONFIGURE_FLAGS)
89
90 USE_STAGE2_CONFIGURE_FLAGS =            \
91     --with-compiler=$(GHC_STAGE2)       \
92     $(USE_STAGE_CONFIGURE_FLAGS)
93
94 BUILD_FLAGS = $(addprefix --ghc-option=,$(SRC_HC_OPTS))
95
96
97 # We now define various i* variables, which are used for the paths
98 # when installing Cabal libraries
99 ifeq "$(RelocatableBuild)" "YES"
100 # On Windows we want to make moveable bindists, but we need to tell
101 # ghc-pkg where the haddock docs are. Therefore we completely ignore
102 # where the user tells us to put the haddock documentation and put it
103 # somewhere whose relative location we know. When installing we need
104 # to give Cabal a real path, though.
105 iprefix             = $$topdir
106 ibindir             = $$topdir
107 ilibdir             = $$topdir
108 ilibexecdir         = $$topdir
109 idynlibdir          = $$topdir
110 idatadir            = $$topdir
111 idocdir             = $$topdir/doc/libraries/$$pkg
112 ihaddockdir         = $$topdir/doc/libraries/$$pkg
113 ihtmldir            = $$httptopdir/doc/libraries/$$pkg
114 html_installed_root = $(prefix)/doc/libraries
115 else
116 # On non-Windows we can just give absolute paths all the time, and
117 # thus obey the htmldir that we are given.
118 iprefix             = $(prefix)
119 ibindir             = $(bindir)
120 ilibdir             = $(libdir)
121 ilibexecdir         = $(libexecdir)
122 idynlibdir          = $(dynlibdir)
123 idatadir            = $(datadir)
124 idocdir             = $(docdir)/libraries/$$pkg
125 ihaddockdir         = $(htmldir)/libraries/$$pkg
126 ihtmldir            = $(htmldir)/libraries/$$pkg
127 html_installed_root = $(htmldir)/libraries
128 endif
129