From 51d5aa5a6dae21bd2e6995f0f196fdde39088921 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 31 Aug 2004 12:45:36 +0000 Subject: [PATCH] [project @ 2004-08-31 12:45:35 by simonmar] Get the version number into ghc-pkg by creating Version.hs from the Makefile to avoid GHC and possibly shell versionitis. --- ghc/utils/ghc-pkg/Main.hs | 5 +---- ghc/utils/ghc-pkg/Makefile | 34 ++++++++++++++-------------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/ghc/utils/ghc-pkg/Main.hs b/ghc/utils/ghc-pkg/Main.hs index 7eb4f3a..1c18d5a 100644 --- a/ghc/utils/ghc-pkg/Main.hs +++ b/ghc/utils/ghc-pkg/Main.hs @@ -7,6 +7,7 @@ module Main where import Package +import Version ( version ) #if __GLASGOW_HASKELL__ >= 504 import System.Console.GetOpt @@ -82,10 +83,6 @@ isAction _ = True copyright :: String copyright = "GHC package manager version " ++ version ++ "\n" --- hackery to convice cpp to splice GHC_PKG_VERSION into a string -version :: String -version = GHC_PKG_VERSION - usageHeader :: String -> String usageHeader prog = "Usage: " ++ prog ++ " [OPTION...]\n" diff --git a/ghc/utils/ghc-pkg/Makefile b/ghc/utils/ghc-pkg/Makefile index b2dc16c..5280887 100644 --- a/ghc/utils/ghc-pkg/Makefile +++ b/ghc/utils/ghc-pkg/Makefile @@ -10,29 +10,9 @@ INSTALLING=1 # ghc-pkg.bin ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi) -ghc_eq_600 = $(shell if (test $(GhcCanonVersion) -eq 600); then echo YES; else echo NO; fi) -ghc_lt_600 = $(shell if (test $(GhcCanonVersion) -lt 600); then echo YES; else echo NO; fi) SRC_HC_OPTS += -cpp -DPKG_TOOL -DWANT_PRETTY -# <= 6.0.x quotes arguments when invoking utils (using double quotes), hence -# the need to escape the double quotes. >= 6.2.x does not. -# ..but apparently 5.04.x on non-win32 platforms doesn't, so catch this (and -# assume pre-5.04 behave similarly.) -ifeq "$(ghc_lt_600)" "YES" -ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32YES" -SRC_HC_OPTS += -D'GHC_PKG_VERSION=\"$(ProjectVersion)\"' -else -SRC_HC_OPTS += -D'GHC_PKG_VERSION="$(ProjectVersion)"' -endif -else -ifeq "$(ghc_eq_600)" "YES" -SRC_HC_OPTS += -D'GHC_PKG_VERSION=\"$(ProjectVersion)\"' -else -SRC_HC_OPTS += -D'GHC_PKG_VERSION="$(ProjectVersion)"' -endif -endif - ifeq "$(ghc_ge_504)" "NO" SRC_HC_OPTS += -package lang -package util -package text endif @@ -49,6 +29,20 @@ HS_PROG = ghc-pkg.bin INSTALL_LIBEXECS += $(HS_PROG) endif +# -----------------------------------------------------------------------------= +# Create the Version.hs file + +VERSION_HS = Version.hs +EXTRA_SRCS += $(VERSION_HS) + +boot :: $(VERSION_HS) + +Version.hs : $(TOP)/mk/version.mk + @$(RM) -f $(VERSION_HS) + @echo "Creating $(VERSION_HS) ... " + @echo "module Version where" >>$(VERSION_HS) + @echo "version = \"$(ProjectVersion)\"" >> $(VERSION_HS) + # ----------------------------------------------------------------------------- # ghc-pkg script -- 1.7.10.4