summaryrefslogtreecommitdiff
path: root/rules/manual-package-config.mk
blob: 298fe47d480f8203b778e821d65b05426077cd16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -----------------------------------------------------------------------------
#
# (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
#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------


define manual-package-config # args: $1 = dir

$1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
	$(CPP) $(RAWCPP_FLAGS) -P \
		-DTOP='"$$(TOP)"' \
		$$($1_PACKAGE_CPP_OPTS) \
		-x c -I$$(GHC_INCLUDE_DIR) $$< | \
	grep -v '^#pragma GCC' | \
	sed -e 's/""//g' -e 's/:[ 	]*,/: /g' >$$@

	$(GHC_PKG_INPLACE) update --force $$@

# This is actually a real file, but we need to recreate it on every
# "make install", so we declare it as phony
.PHONY: $1/package.conf.install
$1/package.conf.install:
	$(CPP) $(RAWCPP_FLAGS) -P \
		-DINSTALLING \
		-DLIB_DIR='"$$(libdir)"' \
		-DINCLUDE_DIR='"$$(libdir)/include"' \
		$$($1_PACKAGE_CPP_OPTS) \
		-x c -I$$(GHC_INCLUDE_DIR) $1/package.conf.in | \
	grep -v '^#pragma GCC' | \
	sed -e 's/""//g' -e 's/:[ 	]*,/: /g' >$$@

distclean : clean_$1_package.conf
.PHONY: clean_$1_package.conf
clean_$1_package.conf :
	$(RM) $1/package.conf.install $1/package.conf.inplace

endef