2 # Set compilation flags that additionally depend on a particular way
4 define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way
6 # Options for a Haskell compilation:
7 # - SRC_HC_OPTS source-tree-wide options
8 # - WAY_v_HC_OPTS options for this way
9 # - libraries/base_BUILD_HC_OPTS options from the build system for this dir
10 # - -Idir1 -Idir2 ... include-dirs from this package
11 # - -odir/-hidir/-stubdir put the output files under $3/build
12 # - -osuf/-hisuf/-hcsuf suffixes for the output files in this way
13 # - EXTRA_HC_OPTS options from the command-line
15 $1_$2_$3_MOST_HC_OPTS = \
17 $$($1_$2_BUILD_HC_OPTS) \
18 $$($1_$2_$3_HC_OPTS) \
22 # For real Haskell compilations we add -hidir etc.
23 $1_$2_$3_ALL_HC_OPTS = \
24 $$($1_$2_$3_MOST_HC_OPTS) \
25 -odir $1/$2/build -hidir $1/$2/build -stubdir $1/$2/build \
26 -hisuf $$($3_hisuf) -osuf $$($3_osuf) -hcsuf $$($3_hcsuf)
28 # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
29 # We use '' around cflags and lflags to handle paths with backslashes in
31 $1_$2_$3_ALL_HSC2HS_OPTS = \
32 --cc=$$(WhatGccIsCalled) \
33 --ld=$$(WhatGccIsCalled) \
35 $$(WAY_$3_HSC2HS_OPTS) \
36 --cflag=-D__GLASGOW_HASKELL__=$$(ProjectVersionInt) \
37 $$(foreach opt,$$($1_$2_BUILD_CC_OPTS),'--cflag=$$(opt)') \
38 $$(foreach opt,$$($1_$2_BUILD_LD_OPTS),'--lflag=$$(opt)') \
42 $1_$2_$3_ALL_CC_OPTS = \
44 $$($1_$2_BUILD_CC_OPTS) \
45 $$($1_$2_$3_CC_OPTS) \
49 $1_$2_$3_GHC_CC_OPTS = \
50 $$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \
51 $$($1_$2_$3_MOST_HC_OPTS)
53 $1_$2_$3_ALL_AS_OPTS = \
58 $$($1_$2_$3_AS_OPTS) \
61 $1_$2_$3_ALL_ALEX_OPTS = \
63 $$(WAY_$3_ALEX_OPTS) \
66 $$($1_$2_$3_ALEX_OPTS) \
69 $1_$2_$3_ALL_HAPPY_OPTS = \
71 $$(WAY_$3_HAPPY_OPTS) \
73 $$($1_$2_HAPPY_OPTS) \
74 $$($1_$2_$3_HAPPY_OPTS) \