[project @ 2002-03-11 10:55:11 by simonmar]
[ghc-hetmet.git] / mk / target.mk
index cf73e23..620b51a 100644 (file)
@@ -296,7 +296,7 @@ SRC_HC_OPTS += -split-objs
 ifeq "$(ArSupportsInput)" ""
 define BUILD_LIB
 $(RM) $@ $@.tmp
-(echo $(STUBOBJS); $(FIND) $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o') | xargs ar q $@.tmp
+(echo $(STUBOBJS); $(FIND) $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) -name '*.$(way_)o') | xargs ar q $@.tmp
 $(RANLIB) $@.tmp
 $(MV) $@.tmp $@
 endef
@@ -304,7 +304,7 @@ else
 define BUILD_LIB
 $(RM) $@ $@.tmp
 echo $(STUBOBJS) > $@.list
-$(FIND) $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o' >> $@.list
+$(FIND) $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) -name '*.$(way_)o' >> $@.list
 $(AR) $(AR_OPTS) $@.tmp $(ArSupportsInput) $@.list
 $(RM) $@.list
 $(RANLIB) $@.tmp
@@ -315,10 +315,10 @@ endif
 # Extra stuff for compiling Haskell files with $(SplitObjs):
 
 HC_SPLIT_PRE = \
-    $(RM) $@; if [ ! -d $(basename $@) ]; then mkdir $(basename $@); else \
-    $(FIND) $(basename $@) -name '*.$(way_)o' | xargs $(RM) __rm_food; fi
+    $(RM) $@; if [ ! -d $(basename $@)_split ]; then mkdir $(basename $@)_split; else \
+    $(FIND) $(basename $@)_split -name '*.$(way_)o' | xargs $(RM) __rm_food; fi
 ifeq "$(GhcWithInterpreter)" "YES"
-HC_SPLIT_POST = $(LD) -r $(LD_X) -o $@ $(basename $@)/*.$(way_)o
+HC_SPLIT_POST = $(LD) -r $(LD_X) -o $@ $(basename $@)_split/*.$(way_)o
 else
 HC_SPLIT_POST = touch $@
 endif # GhcWithInterpreter == YES
@@ -333,8 +333,8 @@ SRC_HC_POST_OPTS += $(HC_SPLIT_POST);
 #
 
 extraclean ::
-       $(FIND) $(patsubst %.$(way_)o,%,$(HS_OBJS)) -name '*.$(way_)o' -print | xargs $(RM) __rm_food
-       -rmdir $(patsubst %.$(way_)o,%,$(HS_OBJS)) > /dev/null 2>&1
+       $(FIND) $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) -name '*.$(way_)o' -print | xargs $(RM) __rm_food
+       -rmdir $(patsubst %.$(way_)o,%_split,$(HS_OBJS)) > /dev/null 2>&1
 
 endif # $(way) == u
 endif # $(SplitObjs)
@@ -347,7 +347,7 @@ endif # $(HS_SRCS)
 ifeq "$(StripLibraries)" "YES"
 ifeq "$(SplitObjs)" "YES"
 SRC_HC_POST_OPTS += \
-  for i in $(basename $@)/*; do \
+  for i in $(basename $@)_split/*; do \
        $(LD) -r $(LD_X) -o $$i.tmp $$i; \
        $(MV) $$i.tmp $$i; \
   done
@@ -357,7 +357,10 @@ SRC_HC_POST_OPTS += \
 endif # SplitObjs
 endif # StripLibraries
 
-$(LIBRARY) : $(STUBOBJS) $(LIBOBJS)
+# Note: $(STUBOBJS) isn't depended on here, but included when building the lib.
+#       (i.e., the assumption is that $(STUBOBJS) are created as a side-effect
+#       of building $(LIBOBJS)).
+$(LIBRARY) : $(LIBOBJS)
        $(BUILD_LIB)
 endif # LIBRARY = ""
 
@@ -671,17 +674,6 @@ install-dirs ::
 # within the various install targets instead.
 #install:: install-dirs
 
-# Install libraries automatically
-# ToDo: this is a bit magical, maybe do this for packages only? --SDM
-ifneq "$(LIBRARY)" ""
-INSTALL_LIBS  += $(LIBRARY)
-ifeq "$(DLLized)" "YES"
-INSTALL_PROGS += $(DLL_NAME)
-INSTALL_LIBS += $(patsubst %.a,%_imp.a, $(LIBRARY))
-endif
-INSTALL_DATAS += $(HS_IFACES)
-endif
-
 ifneq "$(INSTALL_PROGS)" ""
 
 #
@@ -771,6 +763,14 @@ install:: $(INSTALL_DATAS)
        done
 endif
 
+ifneq "$(INSTALL_DATAS_WITH_DIRS)" ""
+install:: $(INSTALL_DATAS_WITH_DIRS)
+       @$(INSTALL_DIR) $(datadir)
+       for i in $(INSTALL_DATAS_WITH_DIRS); do \
+               $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(datadir)/`dirname $$i`; \
+       done
+endif
+
 ifneq "$(INSTALL_INCLUDES)" ""
 install:: $(INSTALL_INCLUDES)
        @$(INSTALL_DIR) $(includedir)
@@ -1100,6 +1100,7 @@ endif
 # the --no-print-directory flag which is passed to recursive
 # invocations of make.
 #
+ifeq "$(way)" ""
 ifneq "$(SUBDIRS)" ""
 
 # we override the 'boot', 'all' and 'install' targets in the top
@@ -1146,6 +1147,7 @@ $(ALL_TARGET) docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean main
        @echo "------------------------------------------------------------------------"
 
 endif
+endif
 
 #
 # Selectively building subdirectories.