[project @ 2001-03-25 11:08:42 by panne]
authorpanne <unknown>
Sun, 25 Mar 2001 11:08:42 +0000 (11:08 +0000)
committerpanne <unknown>
Sun, 25 Mar 2001 11:08:42 +0000 (11:08 +0000)
OK, here comes the third try to get a simple string from the Makefile
into the Haskell sources in a "portable" way... Perhaps we should use
compiler/main/Config.hs's technique here.

ghc/utils/ghc-pkg/Main.hs
ghc/utils/ghc-pkg/Makefile

index 0caefe6..c80912a 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.4 2001/03/24 18:34:05 qrczak Exp $
+-- $Id: Main.hs,v 1.5 2001/03/25 11:08:42 panne Exp $
 --
 -- Package management tool
 -----------------------------------------------------------------------------
@@ -18,7 +18,11 @@ import Directory
 import System
 import IO
 
-default_pkgconf = clibdir ++ "/package.conf"
+-- HACK: The confusing cpp tricks below introduce a leading space. Note that
+-- cpp's stringify operator # doesn't work because of the -traditional flag.
+-- TEXT SUBSTITUTION IS EVIL. TEXT SUBSTITUTION IS EVIL. TEXT SUBSTITUTION...
+default_pkgconf = "\ 
+   \ clibdir" ++ "/package.conf"
 
 main = do
   args <- getArgs
@@ -48,7 +52,7 @@ flags = [
 runit clis = do
   conf_file <- 
      case [ f | Config f <- clis ] of
-        []  -> return default_pkgconf
+        []  -> return (tail default_pkgconf)   -- HACK: Remove leading space
         [f] -> return f
         _   -> die (usageInfo usageHeader flags)
 
index 0d22015..00f9ede 100644 (file)
@@ -1,12 +1,12 @@
 # -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.5 2001/03/24 18:34:05 qrczak Exp $
+# $Id: Makefile,v 1.6 2001/03/25 11:08:42 panne Exp $
 
 TOP=../..
 include $(TOP)/mk/boilerplate.mk
 
 HS_PROG           = ghc-pkg
 SRC_HC_OPTS      += -cpp -DPKG_TOOL -DWANT_PRETTY -package lang \
-                   -package util -package text -Dclibdir="\"$(libdir)\""
+                   -package util -package text -Dclibdir="$(libdir)"
 
 INSTALL_PROGS = $(HS_PROG)