update submodules for GHC.HetMet.GArrow -> Control.GArrow renaming
[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 $(call profStart, manual-package-config($1))
17
18 $1/package.conf.inplace : $1/package.conf.in $(GHC_PKG_INPLACE)
19         $$(CPP) $$(RAWCPP_FLAGS) -P \
20                 -DTOP='"$$(TOP)"' \
21                 $$($1_PACKAGE_CPP_OPTS) \
22                 -x c -I$$(GHC_INCLUDE_DIR) $$< -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/package.conf.install
31 $1/package.conf.install:
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 -I$$(GHC_INCLUDE_DIR) $1/package.conf.in -o $$@.raw
38         grep -v '^#pragma GCC' $$@.raw | \
39             sed -e 's/""//g' -e 's/:[   ]*,/: /g' >$$@
40
41 distclean : clean_$1_package.conf
42 .PHONY: clean_$1_package.conf
43 clean_$1_package.conf :
44         "$$(RM)" $$(RM_OPTS) $1/package.conf.install $1/package.conf.inplace
45
46 $(call profEnd, manual-package-config($1))
47 endef