[project @ 2005-03-29 14:02:06 by simonmar]
[ghc-hetmet.git] / mk / package.mk
index 098e189..ef22c33 100644 (file)
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: package.mk,v 1.47 2005/02/09 10:11:36 simonmar Exp $
+# $Id: package.mk,v 1.51 2005/03/29 14:02:06 simonmar Exp $
 
 ifneq "$(PACKAGE)" ""
 
@@ -161,10 +161,22 @@ endif
 SRC_HSC2HS_OPTS += -I.
 
 ifeq "$(NON_HS_PACKAGE)" ""
+# Only use -ignore-package if supported by HC; i.e., ghc-6.3 and later.
+# (Don't like the use of slow $(shell ..) in Makefiles, but can't see a way around it here.)
+ifeq "$(STANDALONE_PACKAGE)" "NO"
+SRC_HC_OPTS    += -ignore-package $(PACKAGE)
+else
+ifneq "$(strip $(GHC))" ""
+# Making the assumption here that standalone packages will be using mk/config.mk:GHC
+SRC_HC_OPTS = $(shell if (test $(GhcCanonVersion) -ge 603); then echo "-ignore-package"; else echo "-package-name"; fi) $(PACKAGE)
+else
 SRC_HC_OPTS    += -ignore-package $(PACKAGE)
+endif
+endif # STANDALONE_PACKAGE
+
 SRC_HC_OPTS    += $(GhcLibHcOpts)
 SRC_HC_OPTS     += $(patsubst %, -package %, $(PACKAGE_DEPS))
-endif
+endif # NON_HS_PACKAGE
 
 #      -fgenerics switches on generation of support code for 
 #              derivable type classes.  This is now off by default,
@@ -228,9 +240,6 @@ else
 INSTALL_IFACES += $(HS_IFACES)
 endif
 
-# install library (could be implicitly specified or explicitly, like libHS*_cbits.a)
-INSTALL_LIBS  += $(LIBRARY)
-
 # -----------------------------------------------------------------------------
 # Dependencies
 
@@ -247,6 +256,13 @@ endif
 endif # $(PACKAGE) != ""
 
 #--------------------------------------------------------------
+# Installation
+
+ifneq "$(NO_INSTALL_LIBRARY)" "YES"
+INSTALL_LIBS  += $(LIBRARY) $(GHCI_LIBRARY)
+endif
+
+#--------------------------------------------------------------
 # Building dynamically-linkable libraries for GHCi
 #
 # Build $(GHCI_LIBRARY) whenever we build $(LIBRARY)
@@ -264,7 +280,7 @@ ifeq "$(GhcWithInterpreter)" "YES"
 
 GHCI_LIBRARY = $(patsubst lib%.a,%.o,$(LIBRARY))
 
-ifneq "$(PACKAGE)" ""
+ifneq "$(NO_INSTALL_LIBRARY)" "YES"
 INSTALL_LIBS += $(GHCI_LIBRARY)
 endif
 
@@ -323,7 +339,7 @@ $(DYLD_LIBRARY) : $(LIBOBJS) $(STUBOBJS)
        $(CC) -shared -o $@ $(STUBOBJS) $(LIBOBJS)
 endif
 
-ifneq "$(PACKAGE)" ""
+ifneq "$(NO_INSTALL_LIBRARY)" "YES"
 INSTALL_LIBS += $(DYLD_LIBRARY)
 endif