For a non-recursive let, make sure we extend the value environment
[ghc-hetmet.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://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 #      http://hackage.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
17 $1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
18         $$(CPP) $$(RAWCPP_FLAGS) -P \
19                 -DTOP='"$$(TOP)"' \
20                 $$($1_PACKAGE_CPP_OPTS) \
21                 -x c -I$$(GHC_INCLUDE_DIR) $$< -o $$@.raw
22         grep -v '^#pragma GCC' $$@.raw | \
23             sed -e 's/""//g' -e 's/:[   ]*,/: /g' > $$@
24
25         "$$(GHC_PKG_INPLACE)" update --force $$@
26
27 # This is actually a real file, but we need to recreate it on every
28 # "make install", so we declare it as phony
29 .PHONY: $1/package.conf.install
30 $1/package.conf.install:
31         $$(CPP) $$(RAWCPP_FLAGS) -P \
32                 -DINSTALLING \
33                 -DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))"' \
34                 -DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/include"' \
35                 $$($1_PACKAGE_CPP_OPTS) \
36                 -x c -I$$(GHC_INCLUDE_DIR) $1/package.conf.in -o $$@.raw
37         grep -v '^#pragma GCC' $$@.raw | \
38             sed -e 's/""//g' -e 's/:[   ]*,/: /g' >$$@
39
40 distclean : clean_$1_package.conf
41 .PHONY: clean_$1_package.conf
42 clean_$1_package.conf :
43         "$$(RM)" $$(RM_OPTS) $1/package.conf.install $1/package.conf.inplace
44
45 endef