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$(exeext)
18 ifeq "$(BootingFromHc)" "YES"
20 inplace/bin/ghc-pkg : utils/ghc-pkg/dist-install/build/tmp/$(utils/ghc-pkg_dist_PROG)$(exeext)
21 ifeq "$(Windows)" "YES"
26 echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
27 echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@
33 $(GHC_PKG_INPLACE) : utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext) | $$(dir $$@)/. $(INPLACE_PACKAGE_CONF)/.
34 "$(RM)" $(RM_OPTS) $(INPLACE_PACKAGE_CONF)/*
35 ifeq "$(Windows)" "YES"
40 echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
41 echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@
47 # depend on ghc-cabal, otherwise we build Cabal twice when building in parallel.
48 # (ghc-cabal is an order-only dependency, we don't need to rebuild ghc-pkg
49 # if ghc-cabal is newer).
50 # The binary package is not warning-clean, so we need a few -fno-warns here.
51 utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main.hs utils/ghc-pkg/Version.hs | bootstrapping/. $$(dir $$@)/. $(GHC_CABAL_INPLACE)
52 "$(GHC)" $(SRC_HC_OPTS) --make utils/ghc-pkg/Main.hs -o $@ \
53 -no-user-package-conf \
54 -Wall -fno-warn-unused-imports \
55 -DCABAL_VERSION=$(CABAL_VERSION) \
58 -hidir bootstrapping \
60 -XCPP -XExistentialQuantification -XDeriveDataTypeable \
62 -ilibraries/filepath \
63 -ilibraries/extensible-exceptions \
65 -ilibraries/binary/src \
66 -ilibraries/bin-package-db
69 utils/ghc-pkg/Version.hs: mk/project.mk
71 echo "module Version where" >> $@
72 echo "version, targetOS, targetARCH :: String" >> $@
73 echo "version = \"$(ProjectVersion)\"" >> $@
74 echo "targetOS = \"$(TargetOS_CPP)\"" >> $@
75 echo "targetARCH = \"$(TargetArch_CPP)\"" >> $@
77 $(eval $(call clean-target,utils/ghc-pkg,dist,\
79 utils/ghc-pkg/Version.hs))
81 # -----------------------------------------------------------------------------
82 # Building ghc-pkg with stage 1
84 utils/ghc-pkg_dist-install_USES_CABAL = YES
85 utils/ghc-pkg_PACKAGE = ghc-pkg
87 utils/ghc-pkg_dist-install_PROG = ghc-pkg
88 utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES
89 utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER = YES
90 utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
91 utils/ghc-pkg_dist-install_INSTALL_INPLACE = NO
93 ifeq "$(BootingFromHc)" "YES"
94 utils/ghc-pkg_dist-install_OTHER_OBJS += $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_STAGE1_LIBS) $(ALL_RTS_LIBS) $(libffi_STATIC_LIB)
97 $(eval $(call build-prog,utils/ghc-pkg,dist-install,1))
99 ifeq "$(Windows)" "NO"
100 install: install_utils/ghc-pkg_link
102 .PNONY: install_utils/ghc-pkg_link
103 install_utils/ghc-pkg_link:
104 $(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
105 "$(RM)" $(RM_OPTS) "$(DESTDIR)$(bindir)/ghc-pkg"
106 $(LN_S) ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghc-pkg"