summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg/ghc.mk
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-04-26 11:42:15 +0000
committerIan Lynagh <igloo@earth.li>2009-04-26 11:42:15 +0000
commit34cc75e1a62638f2833815746ebce0a9114dc26b (patch)
treeef21e8fd7af1356beea9cce7d6efb8a65374e24c /utils/ghc-pkg/ghc.mk
parent74e1368d4688ee16f6decdf2cd3ebe27506b26ba (diff)
downloadhaskell-34cc75e1a62638f2833815746ebce0a9114dc26b.tar.gz
GHC new build system megapatch
Diffstat (limited to 'utils/ghc-pkg/ghc.mk')
-rw-r--r--utils/ghc-pkg/ghc.mk69
1 files changed, 69 insertions, 0 deletions
diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
new file mode 100644
index 0000000000..388af0d5b9
--- /dev/null
+++ b/utils/ghc-pkg/ghc.mk
@@ -0,0 +1,69 @@
+# -----------------------------------------------------------------------------
+# Bootstrapping ghc-pkg
+
+utils/ghc-pkg_dist_PROG = ghc-pkg
+
+$(GHC_PKG_INPLACE) : utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG)$(exeext) $(MKDIRHIER)
+ $(MKDIRHIER) $(dir $(INPLACE_PACKAGE_CONF))
+ echo "[]" > $(INPLACE_PACKAGE_CONF)
+ifeq "$(Windows)" "YES"
+ cp $< $@
+else
+ $(RM) $@
+ echo "#!/bin/sh" >>$@
+ echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@
+ echo '$(TOP)/utils/ghc-pkg/dist/build/$(utils/ghc-pkg_dist_PROG) --global-conf $$PKGCONF $${1+"$$@"}' >> $@
+ chmod +x $@
+endif
+
+# depend on ghc-cabal, otherwise we build Cabal twice when building in parallel
+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)
+ $(MKDIRHIER) bootstrapping
+ $(MKDIRHIER) utils/ghc-pkg/dist/build
+ $(GHC) --make utils/ghc-pkg/Main.hs -o $@ \
+ -Wall \
+ -DCABAL_VERSION=$(CABAL_VERSION) \
+ -odir bootstrapping \
+ -hidir bootstrapping \
+ -iutils/ghc-pkg \
+ -XCPP -XExistentialQuantification -XDeriveDataTypeable \
+ -ilibraries/Cabal \
+ -ilibraries/filepath \
+ -ilibraries/extensible-exceptions \
+ -ilibraries/hpc
+
+utils/ghc-pkg/Version.hs: mk/config.mk
+ $(RM) -f $@
+ echo "module Version where" >> $@
+ echo "version, targetOS, targetARCH :: String" >> $@
+ echo "version = \"$(ProjectVersion)\"" >> $@
+ echo "targetOS = \"$(TargetOS_CPP)\"" >> $@
+ echo "targetARCH = \"$(TargetArch_CPP)\"" >> $@
+
+$(eval $(call clean-target,utils/ghc-pkg,dist,\
+ utils/ghc-pkg/dist \
+ utils/ghc-pkg/Version.hs))
+
+# -----------------------------------------------------------------------------
+# Building ghc-pkg with stage 1
+
+utils/ghc-pkg_dist-install_PROG = ghc-pkg
+utils/ghc-pkg_dist-install_MODULES = Main Version
+utils/ghc-pkg_dist-install_DEPS = Cabal
+utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES
+utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER = YES
+utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
+utils/ghc-pkg_dist-install_INSTALL_INPLACE = NO
+
+$(eval $(call build-prog,utils/ghc-pkg,dist-install,1))
+
+ifeq "$(Windows)" "NO"
+install: install_utils/ghc-pkg_link
+
+.PNONY: install_utils/ghc-pkg_link
+install_utils/ghc-pkg_link:
+ $(MKDIRHIER) $(DESTDIR)$(bindir)
+ $(RM) -f $(DESTDIR)$(bindir)/ghc-pkg
+ $(LN_S) ghc-pkg-$(ProjectVersion) $(DESTDIR)$(bindir)/ghc-pkg
+endif
+