+endif # LIBRARY = ""
+
+#--------------------------------------------------------------
+# Build dynamically-linkable libraries for GHCi
+#
+# Build $(GHCI_LIBRARY) from $(LIBOBJS)+$(STUBOBJS)
+#
+# Why? GHCi can only link .o files (at the moment), not .a files
+# so we have to build libFoo.o as well as libFoo.a
+#
+# Furthermore, GHCi currently never loads
+# profiling libraries (or other non-std ways)
+#
+# Inputs:
+# $(GHCI_LIBRARY)
+#
+# Outputs:
+# Rule to build $(GHCI_LIBRARY)
+
+
+ifneq "$(GHCI_LIBRARY)" ""
+ifeq "$(way)" ""
+ifeq "$(GhcWithInterpreter)" "YES"
+
+
+INSTALL_LIBS += $(GHCI_LIBRARY)
+CLEAN_FILES += $(GHCI_LIBRARY)
+
+all :: $(GHCI_LIBRARY)
+
+ifneq "$(DONT_WANT_STD_GHCI_LIB_RULE)" "YES"
+# If you don't want to build GHCI_LIBRARY the 'standard' way,
+# set DONT_WANT_STD_GHCI_LIB_RULE to YES. The Prelude and
+# hslibs/Win32 uses this 'feature'.
+#
+$(GHCI_LIBRARY) :: $(LIBOBJS)
+ $(LD) -r $(LD_X) -o $@ $(LIBOBJS) $(STUBOBJS)
+
+endif # DONT_WANT_STD_GHCI_LIB_RULE
+endif # GhcWithInterpreter
+endif # way
+endif # GHCI_LIBRARY != ""
+