Keep separate linker flags, for when we want to link with gcc or ld
[ghc-hetmet.git] / rules / package-config.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 define package-config # args: $1 = dir, $2 = distdir, $3 = GHC stage
15 $(call trace, package-config($1,$2,$3))
16 $(call profStart, package-config($1,$2,$3))
17
18 $1_$2_HC = $$(GHC_STAGE$3)
19
20 # configuration stuff that depends on which GHC we're building with
21 ifeq "$3" "0"
22 $1_$2_ghc_ge_613 = $$(ghc_ge_613)
23 $1_$2_HC_CONFIG = $$(GHC_STAGE0)
24 $1_$2_HC_CONFIG_DEP =
25 $1_$2_GHC_PKG = $$(GHC_PKG)
26 $1_$2_GHC_PKG_DEP = 
27 $1_$2_HC_MK_DEPEND = $$($1_$2_HC)
28 # We can't make rules depend on the bootstrapping compiler, as then
29 # on cygwin we get a dep on c:/ghc/..., and make gets confused by the :
30 $1_$2_HC_MK_DEPEND_DEP =
31 $1_$2_HC_DEP =
32 $1_$2_HC_PKGCONF = -package-conf $$(BOOTSTRAPPING_CONF)
33 $1_$2_GHC_PKG_OPTS = --package-conf=$$(BOOTSTRAPPING_CONF)
34 $1_$2_CONFIGURE_OPTS += --package-db=$$(TOP)/$$(BOOTSTRAPPING_CONF)
35 $1_$2_MORE_HC_OPTS += -no-user-package-conf
36 ifeq "$(ghc_ge_613)" "YES"
37 $1_$2_MORE_HC_OPTS += -rtsopts
38 endif
39 else
40 $1_$2_ghc_ge_613 = YES
41 $1_$2_HC_PKGCONF = 
42 $1_$2_HC_CONFIG = $$(TOP)/$$(GHC_STAGE1)
43 $1_$2_HC_CONFIG_DEP = $$(GHC_STAGE1)
44 $1_$2_GHC_PKG = $$(TOP)/$$(GHC_PKG_INPLACE)
45 $1_$2_GHC_PKG_DEP = $$(GHC_PKG_INPLACE)
46 $1_$2_GHC_PKG_OPTS =
47 # If stage is not 0 then we always use stage1 for making .depend, as later
48 # stages aren't available early enough
49 $1_$2_HC_MK_DEPEND = $$(GHC_STAGE1)
50 $1_$2_HC_MK_DEPEND_DEP = $$($1_$2_HC_MK_DEPEND)
51 $1_$2_HC_DEP = $$($1_$2_HC)
52 $1_$2_MORE_HC_OPTS += -no-user-package-conf
53 $1_$2_MORE_HC_OPTS += -rtsopts
54 endif
55
56 # Useful later
57 $1_$2_SLASH_MODS = $$(subst .,/,$$($1_$2_MODULES))
58
59 $(call profEnd, package-config($1,$2,$3))
60 endef