Only trace cap/capset events if we're tracing anything else
[ghc.git] / utils / ghc-pkg / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009-2012 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 # Bootstrapping ghc-pkg
15
16 utils/ghc-pkg/dist/build/Version.hs \
17 utils/ghc-pkg/dist-install/build/Version.hs: mk/project.mk | $$(dir $$@)/.
18 $(call removeFiles,$@)
19 echo "module Version where" >> $@
20 echo "version, targetOS, targetARCH :: String" >> $@
21 echo "version = \"$(ProjectVersion)\"" >> $@
22 echo "targetOS = \"$(TargetOS_CPP)\"" >> $@
23 echo "targetARCH = \"$(TargetArch_CPP)\"" >> $@
24
25 utils/ghc-pkg_PACKAGE = ghc-pkg
26
27 # Note [Why build certain utils twice?]
28 #
29 # We build certain utils twice: once with stage0, and once with stage1.
30 # Examples are ghc-pkg and hsc2hs.
31 #
32 # These tools are needed during the bootstrapping process, so we have to use
33 # stage0 to build them at first (stage1 doesn't exist yet). (side note: they're
34 # also used later in the build process). We install them inplace.
35 #
36 # But we can't install these copies when you run 'make install'. The reason is
37 # that when DYNAMIC_GHC_PROGRAMS=YES, we want to install copies that are
38 # dynamically linked. But the stage0 copies are either statically linked, or
39 # linked against libraries on the build machine.
40 #
41 # Therefore we build fresh copies, using the stage1 compiler, and install them
42 # when you run 'make install'. They are not used for any other purpose.
43
44 # -----------------------------------------------------------------------------
45 # Build ghc-pkg with the stage0 compiler in the dist directory, and install
46 # inplace. This is the copy we use during in-tree development.
47 utils/ghc-pkg_dist_USES_CABAL = YES
48 utils/ghc-pkg_dist_PROGNAME = ghc-pkg
49 utils/ghc-pkg_dist_SHELL_WRAPPER = YES
50 utils/ghc-pkg_dist_INSTALL_INPLACE = YES
51
52 # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
53 ifeq "$(Stage1Only)" "YES"
54 # Install the copy of ghc-pkg from the dist directory when running 'make
55 # install' (it's the only copy we have at this stage).
56 utils/ghc-pkg_dist_INSTALL = YES
57 utils/ghc-pkg_dist_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
58 endif
59
60 $(eval $(call build-prog,utils/ghc-pkg,dist,0))
61
62 $(ghc-pkg_INPLACE) : | $(INPLACE_PACKAGE_CONF)/.
63
64 utils/ghc-pkg/dist/package-data.mk: \
65 utils/ghc-pkg/dist/build/Version.hs
66
67 # -----------------------------------------------------------------------------
68 # Build another copy of ghc-pkg with the stage1 compiler in the dist-install
69 # directory. Don't install it inplace (we use the dist copy there), but do
70 # install it when running 'make install'.
71 #
72 # See Note [Why build certain utils twice?].
73
74 # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
75 ifneq "$(Stage1Only)" "YES"
76 utils/ghc-pkg_dist-install_USES_CABAL = YES
77 utils/ghc-pkg_dist-install_PROGNAME = ghc-pkg
78 utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES
79 utils/ghc-pkg_dist-install_INSTALL_INPLACE = NO
80 utils/ghc-pkg_dist-install_INSTALL = YES
81 utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
82
83 $(eval $(call build-prog,utils/ghc-pkg,dist-install,1))
84
85 utils/ghc-pkg/dist-install/package-data.mk: \
86 utils/ghc-pkg/dist-install/build/Version.hs
87 endif
88
89 # -----------------------------------------------------------------------------
90 # Link ghc-pkg to ghc-pkg-$(ProjectVersion) when installing
91
92 ifeq "$(Windows_Host)" "NO"
93 install: install_utils/ghc-pkg_link
94
95 .PHONY: install_utils/ghc-pkg_link
96 install_utils/ghc-pkg_link:
97 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
98 $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg")
99 $(LN_S) $(CrossCompilePrefix)ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg"
100 endif