[project @ 2003-03-27 22:35:28 by sof]
[ghc-hetmet.git] / ghc / utils / ghc-pkg / Makefile
index ba72ce1..13b02be 100644 (file)
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.17 2002/05/29 22:11:59 sof Exp $
+# $Id: Makefile,v 1.21 2002/11/18 10:45:45 simonmar Exp $
 
 TOP=../..
 include $(TOP)/mk/boilerplate.mk
@@ -10,16 +10,24 @@ INSTALLING=1
 # -----------------------------------------------------------------------------
 # ghc-pkg.bin
 
-SRC_HC_OPTS      += -cpp -DPKG_TOOL -DWANT_PRETTY -package lang \
-                   -package util -package text
+SRC_HC_OPTS      += -cpp -DPKG_TOOL -DWANT_PRETTY
 
-HS_PROG           = ghc-pkg.bin
-INSTALL_LIBEXECS += $(HS_PROG)
+ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)
+
+ifeq "$(ghc_ge_504)" "NO"
+SRC_HC_OPTS +=  -package lang -package util -package text
+endif
 
+# On Windows, ghc-pkg is a standalone program
+# ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script
+# to pass the appropriate flag to the real binary
+# ($libexecdir/ghc-pkg.bin) so that it can find package.conf.
 ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32"
 HS_PROG           = ghc-pkg.exe
 INSTALL_PROGS    += $(HS_PROG)
-SRC_HC_OPTS      += -package win32
+else
+HS_PROG           = ghc-pkg.bin
+INSTALL_LIBEXECS += $(HS_PROG)
 endif
 
 # -----------------------------------------------------------------------------