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