[project @ 2000-12-01 21:53:59 by simonmar]
[ghc-hetmet.git] / mk / target.mk
index 0a64f06..8f603d8 100644 (file)
@@ -309,7 +309,8 @@ _cbits := _cbits
 endif
 
 ifneq "$(HSLIB)" ""
-LIBRARY = libHS$(HSLIB)$(_cbits)$(_way).a
+LIBRARY      = libHS$(HSLIB)$(_cbits)$(_way).a
+GHCI_LIBRARY = HS$(HSLIB)$(_cbits)$(_way).o
 ifeq "$(LIBOBJS)" ""
   ifneq "$(IS_CBITS_LIB)" "YES"
   LIBOBJS = $(HS_OBJS)
@@ -400,6 +401,36 @@ $(LIBRARY) :: $(STUBOBJS) $(LIBOBJS)
        $(BUILD_LIB)
 endif
 
+#--------------------------------------------------------------
+#      Build dynamically-linkable libraries for GHCi
+#
+
+ifneq "$(GHCI_LIBRARY)" ""
+ifeq "$(GhcWithInterpreter)" "YES"
+
+all :: $(GHCI_LIBRARY)
+
+ifeq "$(GHCI_LIBOBJS)" ""
+GHCI_LIBOBJS = $(LIBOBJS)
+endif
+
+ifneq "$(HS_SRCS)" ""
+ifeq "$(SplitObjs)" "YES"
+$(GHCI_LIBRARY) :: $(GHCI_LIBOBJS)
+       ( echo $(STUBOBJS) ; $(FIND) $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o' -print ) | xargs ld -r -x -o $@
+else # not SplitObjs
+$(GHCI_LIBRARY) :: $(GHCI_LIBOBJS)
+       ld -r -x -o $@ $(GHCI_LIBOBJS)
+endif
+else # no HS_SRCS
+$(GHCI_LIBRARY) :: $(GHCI_LIBOBJS)
+       ld -r -x -o $@ $(GHCI_LIBOBJS)
+endif
+
+CLEAN_FILES += $(GHCI_LIBRARY)
+endif
+endif
+
 #----------------------------------------
 #      Building Win32 DLLs
 #
@@ -893,17 +924,9 @@ ifneq "$(SGML_DOC)" ""
 # multi-file SGML document: main document name is specified in $(SGML_DOC),
 # sub-documents (.sgml files) listed in $(SGML_SRCS).
 
-ifeq "$(VSGML_SRCS)" ""
-VSGML_SRCS = $(wildcard *.vsgml)
-endif
-
 ifeq "$(SGML_SRCS)" ""
-ifneq "$(VSGML_SRCS)" ""
-SGML_SRCS = $(patsubst %.vsgml, %.sgml, $(VSGML_SRCS))
-else
 SGML_SRCS = $(wildcard *.sgml)
 endif
-endif
 
 SGML_TEX  = $(addsuffix .tex,$(SGML_DOC))
 SGML_DVI  = $(addsuffix .dvi,$(SGML_DOC))
@@ -925,7 +948,6 @@ txt  :: $(SGML_TEXT)
 
 CLEAN_FILES += $(SGML_TEXT) $(SGML_TEX) $(SGML_PS) $(SGML_DVI) $(SGML_PDF) $(SGML_RTF) $(SGML_HTML) $(SGML_DOC)-*.html
 # can't use $(SGML_SRCS) here, it was maybe used elsewhere
-MOSTLY_CLEAN_FILES += $(patsubst %.vsgml, %.sgml, $(VSGML_SRCS))
 
 extraclean ::
        $(RM) -rf DBTOHTML_OUTPUT_*