1 # -----------------------------------------------------------------------------
3 # (c) 2009 The University of Glasgow
5 # This file is part of the GHC build system.
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
11 # -----------------------------------------------------------------------------
13 # -----------------------------------------------------------------------------
14 # Bootstrapping ghc-pkg
16 utils/ghc-pkg_dist_PROG = ghc-pkg
18 $(GHC_PKG_INPLACE) : utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext) $(MKDIRHIER)
19 $(MKDIRHIER) $(dir $(INPLACE_PACKAGE_CONF))
20 echo "[]" > $(INPLACE_PACKAGE_CONF)
21 ifeq "$(Windows)" "YES"
26 echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
27 echo '$(TOP)/utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG) --global-conf $$PKGCONF $${1+"$$@"}' >> $@
31 # depend on ghc-cabal, otherwise we build Cabal twice when building in parallel
32 utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main.hs utils/ghc-pkg/Version.hs $(GHC_CABAL_INPLACE) $(MKDIRHIER)
33 $(MKDIRHIER) bootstrapping
34 $(MKDIRHIER) utils/ghc-pkg/dist/build
35 $(GHC) --make utils/ghc-pkg/Main.hs -o $@ \
37 -DCABAL_VERSION=$(CABAL_VERSION) \
39 -hidir bootstrapping \
41 -XCPP -XExistentialQuantification -XDeriveDataTypeable \
43 -ilibraries/filepath \
44 -ilibraries/extensible-exceptions \
47 utils/ghc-pkg/Version.hs: mk/config.mk
49 echo "module Version where" >> $@
50 echo "version, targetOS, targetARCH :: String" >> $@
51 echo "version = \"$(ProjectVersion)\"" >> $@
52 echo "targetOS = \"$(TargetOS_CPP)\"" >> $@
53 echo "targetARCH = \"$(TargetArch_CPP)\"" >> $@
55 $(eval $(call clean-target,utils/ghc-pkg,dist,\
57 utils/ghc-pkg/Version.hs))
59 # -----------------------------------------------------------------------------
60 # Building ghc-pkg with stage 1
62 utils/ghc-pkg_dist-install_PROG = ghc-pkg
63 utils/ghc-pkg_dist-install_MODULES = Main Version
64 utils/ghc-pkg_dist-install_DEPS = Cabal
65 utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES
66 utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER = YES
67 utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
68 utils/ghc-pkg_dist-install_INSTALL_INPLACE = NO
70 $(eval $(call build-prog,utils/ghc-pkg,dist-install,1))
72 ifeq "$(Windows)" "NO"
73 install: install_utils/ghc-pkg_link
75 .PNONY: install_utils/ghc-pkg_link
76 install_utils/ghc-pkg_link:
77 $(MKDIRHIER) $(DESTDIR)$(bindir)
78 $(RM) -f $(DESTDIR)$(bindir)/ghc-pkg
79 $(LN_S) ghc-pkg-$(ProjectVersion) $(DESTDIR)$(bindir)/ghc-pkg