1 # -----------------------------------------------------------------------------
3 # (c) 2009 The University of Glasgow
5 # This file is part of the GHC build system.
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
11 # -----------------------------------------------------------------------------
14 # Set compilation flags that additionally depend on a particular way
16 define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way
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
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
31 $1_$2_$3_MOST_HC_OPTS = \
33 $$($1_$2_DIST_HC_OPTS) \
34 $$($1_$2_$3_HC_OPTS) \
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)
44 # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
45 # We use '' around cflags and lflags to handle paths with backslashes in
47 $1_$2_$3_ALL_HSC2HS_OPTS = \
48 --cc=$$(WhatGccIsCalled) \
49 --ld=$$(WhatGccIsCalled) \
50 $$(CONF_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)') \
59 $1_$2_$3_ALL_CC_OPTS = \
61 $$($1_$2_DIST_CC_OPTS) \
62 $$($1_$2_$3_CC_OPTS) \
66 $1_$2_$3_GHC_CC_OPTS = \
67 $$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \
68 $$($1_$2_$3_MOST_HC_OPTS)
70 $1_$2_$3_ALL_AS_OPTS = \
76 $$($1_$2_$3_AS_OPTS) \
79 $1_$2_$3_ALL_ALEX_OPTS = \
82 $$(WAY_$3_ALEX_OPTS) \
85 $$($1_$2_$3_ALEX_OPTS) \
88 $1_$2_$3_ALL_HAPPY_OPTS = \
91 $$(WAY_$3_HAPPY_OPTS) \
93 $$($1_$2_HAPPY_OPTS) \
94 $$($1_$2_$3_HAPPY_OPTS) \