10629aaa2fc1fc28dee2f7542b048024fb0c56a0
[ghc.git] / rules / manual-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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13
14 define manual-package-config # args: $1 = dir
15 $(call trace, manual-package-config($1))
16 $(call profStart, manual-package-config($1))
17
18 $1/dist/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(dir $$$$@)/.
19 $$(CPP) $$(RAWCPP_FLAGS) -P \
20 -DTOP='"$$(TOP)"' \
21 $$($1_PACKAGE_CPP_OPTS) \
22 -x c $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) $$< -o $$@.raw
23 grep -v '^#pragma GCC' $$@.raw | \
24 sed -e 's/""//g' -e 's/:[ ]*,/: /g' > $$@
25
26 "$$(ghc-pkg_INPLACE)" update --force $$@
27
28 # This is actually a real file, but we need to recreate it on every
29 # "make install", so we declare it as phony
30 .PHONY: $1/dist/package.conf.install
31 $1/dist/package.conf.install: | $$$$(dir $$$$@)/.
32 $$(CPP) $$(RAWCPP_FLAGS) -P \
33 -DINSTALLING \
34 -DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))"' \
35 -DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/include"' \
36 $$($1_PACKAGE_CPP_OPTS) \
37 -x c $$(addprefix -I,$$(GHC_INCLUDE_DIRS)) $1/package.conf.in -o $$@.raw
38 grep -v '^#pragma GCC' $$@.raw | \
39 sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$$@
40
41 $(call profEnd, manual-package-config($1))
42 endef