# -----------------------------------------------------------------------------
-# $Id: package.mk,v 1.48 2005/02/10 13:38:35 simonmar Exp $
+# $Id: package.mk,v 1.52 2005/03/29 14:06:02 simonmar Exp $
ifneq "$(PACKAGE)" ""
# -----------------------------------------------------------------------------
# Building the static library libHS<pkg>.a
+SRC_HSC2HS_OPTS += -I.
+
ifeq "$(STANDALONE_PACKAGE)" "NO"
HC = $(GHC_INPLACE)
-endif
-
-SRC_HSC2HS_OPTS += -I.
+IGNORE_PACKAGE_FLAG = -ignore-package
+else
+# 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 "$(strip $(GHC))" ""
+IGNORE_PACKAGE_FLAG = -ignore-package
+else
+# Making the assumption here that standalone packages will be using mk/config.mk:GHC
+IGNORE_PACKAGE_FLAG = $(shell if (test $(GhcCanonVersion) -ge 603); then echo "-ignore-package"; else echo "-package-name"; fi)
+endif
+endif # STANDALONE_PACKAGE
ifeq "$(NON_HS_PACKAGE)" ""
-SRC_HC_OPTS += -ignore-package $(PACKAGE)
+SRC_HC_OPTS += $(IGNORE_PACKAGE_FLAG) $(PACKAGE)
SRC_HC_OPTS += $(GhcLibHcOpts)
SRC_HC_OPTS += $(patsubst %, -package %, $(PACKAGE_DEPS))
endif
$(CC) -shared -o $@ $(STUBOBJS) $(LIBOBJS)
endif
-ifneq "$(PACKAGE)" ""
+ifneq "$(NO_INSTALL_LIBRARY)" "YES"
INSTALL_LIBS += $(DYLD_LIBRARY)
endif