package-config.mk 2.25 KB
Newer Older
1 2 3 4 5 6 7
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
8 9
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 11 12
#
# -----------------------------------------------------------------------------

Ian Lynagh's avatar
Ian Lynagh committed
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))
Ian Lynagh's avatar
Ian Lynagh committed
17 18

$1_$2_HC = $$(GHC_STAGE$3)
19
$1_$2_CC = $$(CC_STAGE$3)
20
$1_$2_AS = $$(AS_STAGE$3)
21
$1_$2_AR = $$(AR_STAGE$3)
22 23 24
$1_$2_AR_OPTS = $$(AR_OPTS_STAGE$3)
$1_$2_EXTRA_AR_ARGS = $$(EXTRA_AR_ARGS_STAGE$3)
$1_$2_ArSupportsAtFile = $$(ArSupportsAtFile_STAGE$3)
Ian Lynagh's avatar
Ian Lynagh committed
25 26 27 28 29 30 31 32 33 34 35 36

# configuration stuff that depends on which GHC we're building with
ifeq "$3" "0"
$1_$2_HC_CONFIG = $$(GHC_STAGE0)
$1_$2_HC_CONFIG_DEP =
$1_$2_GHC_PKG = $$(GHC_PKG)
$1_$2_GHC_PKG_DEP = 
$1_$2_HC_MK_DEPEND = $$($1_$2_HC)
# We can't make rules depend on the bootstrapping compiler, as then
# on cygwin we get a dep on c:/ghc/..., and make gets confused by the :
$1_$2_HC_MK_DEPEND_DEP =
$1_$2_HC_DEP =
37 38
$1_$2_HC_PKGCONF = -$(GHC_PACKAGE_DB_FLAG) $$(BOOTSTRAPPING_CONF)
$1_$2_GHC_PKG_OPTS = --$(GHC_PACKAGE_DB_FLAG)=$$(BOOTSTRAPPING_CONF)
Ian Lynagh's avatar
Ian Lynagh committed
39
$1_$2_CONFIGURE_OPTS += --package-db=$$(TOP)/$$(BOOTSTRAPPING_CONF)
40
$1_$2_MORE_HC_OPTS += -no-user-$(GHC_PACKAGE_DB_FLAG)
41
$1_$2_MORE_HC_OPTS += -rtsopts
Ian Lynagh's avatar
Ian Lynagh committed
42 43
else
$1_$2_HC_PKGCONF = 
Ian Lynagh's avatar
Ian Lynagh committed
44 45
$1_$2_HC_CONFIG = $$(TOP)/$$(GHC_STAGE1)
$1_$2_HC_CONFIG_DEP = $$(GHC_STAGE1)
46 47
$1_$2_GHC_PKG = $$(TOP)/$$(ghc-pkg_INPLACE)
$1_$2_GHC_PKG_DEP = $$$$(ghc-pkg_INPLACE)
Ian Lynagh's avatar
Ian Lynagh committed
48 49 50 51 52 53
$1_$2_GHC_PKG_OPTS =
# If stage is not 0 then we always use stage1 for making .depend, as later
# stages aren't available early enough
$1_$2_HC_MK_DEPEND = $$(GHC_STAGE1)
$1_$2_HC_MK_DEPEND_DEP = $$($1_$2_HC_MK_DEPEND)
$1_$2_HC_DEP = $$($1_$2_HC)
54
$1_$2_MORE_HC_OPTS += -no-user-package-db
55
$1_$2_MORE_HC_OPTS += -rtsopts
Ian Lynagh's avatar
Ian Lynagh committed
56 57
endif

58 59 60 61 62 63 64
# Used by pretty_commands.mk
label_$1_$2_CC=CC
label_$1_$2_AS=AS
label_$1_$2_AR=AR
label_$1_$2_HC=HC [stage $3]
label_$1_$2_GHC_PKG=GHC PKG

Ian Lynagh's avatar
Ian Lynagh committed
65 66
# Useful later
$1_$2_SLASH_MODS = $$(subst .,/,$$($1_$2_MODULES))
67

68
$(call profEnd, package-config($1,$2,$3))
Ian Lynagh's avatar
Ian Lynagh committed
69
endef