Set the soname when creating a shared lib
[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 #   - 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
26
27 $1_$2_$3_MOST_HC_OPTS = \
28  $$(WAY_$3_HC_OPTS) \
29  $$($1_$2_BUILD_HC_OPTS) \
30  $$($1_$2_$3_HC_OPTS) \
31  $$($$*_HC_OPTS) \
32  $$(EXTRA_HC_OPTS)
33
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)
39
40 # c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
41 # We use '' around cflags and lflags to handle paths with backslashes in
42 # on Windows
43 $1_$2_$3_ALL_HSC2HS_OPTS = \
44  --cc=$$(WhatGccIsCalled) \
45  --ld=$$(WhatGccIsCalled) \
46  $$(SRC_HSC2HS_OPTS) \
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)') \
51  $$($$*_HSC2HS_OPTS) \
52  $$(EXTRA_HSC2HS_OPTS)
53
54 $1_$2_$3_ALL_CC_OPTS = \
55  $$(WAY_$3_CC_OPTS) \
56  $$($1_$2_BUILD_CC_OPTS) \
57  $$($1_$2_$3_CC_OPTS) \
58  $$($$*_CC_OPTS) \
59  $$(EXTRA_CC_OPTS)
60
61 $1_$2_$3_GHC_CC_OPTS = \
62  $$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \
63  $$($1_$2_$3_MOST_HC_OPTS)
64
65 $1_$2_$3_ALL_AS_OPTS = \
66  $$(SRC_AS_OPTS)
67  $$(WAY_$3_AS_OPTS) \
68  $$($1_AS_OPTS) \
69  $$($1_$2_AS_OPTS) \
70  $$($1_$2_$3_AS_OPTS) \
71  $$(EXTRA_AS_OPTS)
72
73 $1_$2_$3_ALL_ALEX_OPTS = \
74  $$(SRC_ALEX_OPTS)
75  $$(WAY_$3_ALEX_OPTS) \
76  $$($1_ALEX_OPTS) \
77  $$($1_$2_ALEX_OPTS) \
78  $$($1_$2_$3_ALEX_OPTS) \
79  $$(EXTRA_ALEX_OPTS)
80
81 $1_$2_$3_ALL_HAPPY_OPTS = \
82  $$(SRC_HAPPY_OPTS) \
83  $$(WAY_$3_HAPPY_OPTS) \
84  $$($1_HAPPY_OPTS) \
85  $$($1_$2_HAPPY_OPTS) \
86  $$($1_$2_$3_HAPPY_OPTS) \
87  $$(EXTRA_HAPPY_OPTS)
88
89 endef
90