add $(CONF_*_OPTS) for options that come from ./configure (fixes #3426)
[ghc-hetmet.git] / rules / distdir-way-opts.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13
14 # Set compilation flags that additionally depend on a particular way
15
16 define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way
17
18 # Options for a Haskell compilation:
19 #   - SRC_HC_OPTS                  source-tree-wide options
20 #                                  (optimisation, heap settings)
21 #   - CONF_HC_OPTS                 source-tree-wide options, selected at
22 #                                  configure-time
23 #   - libraries/base_HC_OPTS       options from libraries/base for all ways
24 #   - libraries/base_v_HC_OPTS     options from libraries/base for way v
25 #   - WAY_v_HC_OPTS                options for this way
26 #   - EXTRA_HC_OPTS                options from the command-line
27 #   - -Idir1 -Idir2 ...            include-dirs from this package
28 #   - -odir/-hidir/-stubdir        put the output files under $3/build
29 #   - -osuf/-hisuf/-hcsuf          suffixes for the output files in this way
30
31 $1_$2_$3_MOST_HC_OPTS = \
32  $$(WAY_$3_HC_OPTS) \
33  $$($1_$2_DIST_HC_OPTS) \
34  $$($1_$2_$3_HC_OPTS) \
35  $$($$*_HC_OPTS) \
36  $$(EXTRA_HC_OPTS)
37
38 # For real Haskell compilations we add -hidir etc.
39 $1_$2_$3_ALL_HC_OPTS = \
40  $$($1_$2_$3_MOST_HC_OPTS) \
41  -odir $1/$2/build -hidir $1/$2/build -stubdir $1/$2/build \
42  -hisuf $$($3_hisuf) -osuf  $$($3_osuf) -hcsuf $$($3_hcsuf)
43
44 # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
45 # We use '' around cflags and lflags to handle paths with backslashes in
46 # on Windows
47 $1_$2_$3_ALL_HSC2HS_OPTS = \
48  --cc=$$(WhatGccIsCalled) \
49  --ld=$$(WhatGccIsCalled) \
50  $$(CONF_HSC2HS_OPTS) \
51  $$(SRC_HSC2HS_OPTS) \
52  $$(WAY_$3_HSC2HS_OPTS) \
53  --cflag=-D__GLASGOW_HASKELL__=$$(ProjectVersionInt) \
54  $$(foreach opt,$$($1_$2_DIST_CC_OPTS),'--cflag=$$(opt)') \
55  $$(foreach opt,$$($1_$2_DIST_LD_OPTS),'--lflag=$$(opt)') \
56  $$($$*_HSC2HS_OPTS) \
57  $$(EXTRA_HSC2HS_OPTS)
58
59 $1_$2_$3_ALL_CC_OPTS = \
60  $$(WAY_$3_CC_OPTS) \
61  $$($1_$2_DIST_CC_OPTS) \
62  $$($1_$2_$3_CC_OPTS) \
63  $$($$*_CC_OPTS) \
64  $$(EXTRA_CC_OPTS)
65
66 $1_$2_$3_GHC_CC_OPTS = \
67  $$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \
68  $$($1_$2_$3_MOST_HC_OPTS)
69
70 $1_$2_$3_ALL_AS_OPTS = \
71  $$(CONF_AS_OPTS) \
72  $$(SRC_AS_OPTS)
73  $$(WAY_$3_AS_OPTS) \
74  $$($1_AS_OPTS) \
75  $$($1_$2_AS_OPTS) \
76  $$($1_$2_$3_AS_OPTS) \
77  $$(EXTRA_AS_OPTS)
78
79 $1_$2_$3_ALL_ALEX_OPTS = \
80  $$(CONF_ALEX_OPTS) \
81  $$(SRC_ALEX_OPTS)
82  $$(WAY_$3_ALEX_OPTS) \
83  $$($1_ALEX_OPTS) \
84  $$($1_$2_ALEX_OPTS) \
85  $$($1_$2_$3_ALEX_OPTS) \
86  $$(EXTRA_ALEX_OPTS)
87
88 $1_$2_$3_ALL_HAPPY_OPTS = \
89  $$(CONF_HAPPY_OPTS) \
90  $$(SRC_HAPPY_OPTS) \
91  $$(WAY_$3_HAPPY_OPTS) \
92  $$($1_HAPPY_OPTS) \
93  $$($1_$2_HAPPY_OPTS) \
94  $$($1_$2_$3_HAPPY_OPTS) \
95  $$(EXTRA_HAPPY_OPTS)
96
97 endef
98