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 # - WAY_v_HC_OPTS options for this way
21 # - libraries/base_BUILD_HC_OPTS options from the build system for this dir
22 # - -Idir1 -Idir2 ... include-dirs from this package
23 # - -odir/-hidir/-stubdir put the output files under $3/build
24 # - -osuf/-hisuf/-hcsuf suffixes for the output files in this way
25 # - EXTRA_HC_OPTS options from the command-line
27 $1_$2_$3_MOST_HC_OPTS = \
29 $$($1_$2_BUILD_HC_OPTS) \
30 $$($1_$2_$3_HC_OPTS) \
34 # For real Haskell compilations we add -hidir etc.
35 $1_$2_$3_ALL_HC_OPTS = \
36 $$($1_$2_$3_MOST_HC_OPTS) \
37 -odir $1/$2/build -hidir $1/$2/build -stubdir $1/$2/build \
38 -hisuf $$($3_hisuf) -osuf $$($3_osuf) -hcsuf $$($3_hcsuf)
40 # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
41 # We use '' around cflags and lflags to handle paths with backslashes in
43 $1_$2_$3_ALL_HSC2HS_OPTS = \
44 --cc=$$(WhatGccIsCalled) \
45 --ld=$$(WhatGccIsCalled) \
47 $$(WAY_$3_HSC2HS_OPTS) \
48 --cflag=-D__GLASGOW_HASKELL__=$$(ProjectVersionInt) \
49 $$(foreach opt,$$($1_$2_BUILD_CC_OPTS),'--cflag=$$(opt)') \
50 $$(foreach opt,$$($1_$2_BUILD_LD_OPTS),'--lflag=$$(opt)') \
54 $1_$2_$3_ALL_CC_OPTS = \
56 $$($1_$2_BUILD_CC_OPTS) \
57 $$($1_$2_$3_CC_OPTS) \
61 $1_$2_$3_GHC_CC_OPTS = \
62 $$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \
63 $$($1_$2_$3_MOST_HC_OPTS)
65 $1_$2_$3_ALL_AS_OPTS = \
70 $$($1_$2_$3_AS_OPTS) \
73 $1_$2_$3_ALL_ALEX_OPTS = \
75 $$(WAY_$3_ALEX_OPTS) \
78 $$($1_$2_$3_ALEX_OPTS) \
81 $1_$2_$3_ALL_HAPPY_OPTS = \
83 $$(WAY_$3_HAPPY_OPTS) \
85 $$($1_$2_HAPPY_OPTS) \
86 $$($1_$2_$3_HAPPY_OPTS) \