[project @ 2000-04-17 11:39:56 by simonmar]
[ghc-hetmet.git] / mk / target.mk
index ad77c21..88140d0 100644 (file)
@@ -449,13 +449,30 @@ endef
 #
 
 ifneq "$(HS_SRCS)" ""
-ifneq "$(filter -split-objs,$(HC_OPTS))" ""
+ifeq "$(SplitObjs)" "YES"
+
 define BUILD_LIB
 $(RM) $@
-TMPDIR=$(TMPDIR); export TMPDIR; find $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o' -print | xargs ar q $@
+TMPDIR=$(TMPDIR); export TMPDIR; $(FIND) $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o' -print | xargs ar q $@
 $(RANLIB) $@
 endef
-endif # $(filter...
+
+# Extra stuff for compiling Haskell files with $(SplitObjs):
+
+HC_SPLIT_PRE= \
+ $(RM) $@ ; if [ ! -d $(basename $@) ]; then mkdir $(basename $@); else \
+ $(FIND) $(basename $@) -name '*.$(way_)o' -print | xargs $(RM) __rm_food ; fi
+HC_SPLIT_POST  = touch $@
+
+ifeq "$(SplitObjs)" "YES"
+HC_PRE__  = $(HC_SPLIT_PRE) ;
+HC_POST__ = $(HC_SPLIT_POST) ;
+endif
+
+SRC_HC_POST_OPTS += $(HC_POST__)
+SRC_HC_PRE_OPTS  += $(HC_PRE__)
+
+endif # $(SplitObjs)
 endif
 
 #
@@ -463,7 +480,7 @@ endif
 #
 
 ifeq "$(StripLibraries)" "YES"
-ifneq "$(filter -split-objs,$(HC_OPTS))" ""
+ifeq "$(SplitObjs)" "YES"
 SRC_HC_POST_OPTS += \
   for i in $(basename $@)/*; do \
        ld -r -x -o $$i.tmp $$i; \
@@ -495,8 +512,7 @@ DLL_IMPLIB_NAME = $(patsubst %.a, %_imp.a, $(LIBRARY))
 endif
 
 $(DLL_NAME) :: $(LIBRARY)
-       $(BLD_DLL) --output-lib $(DLL_IMPLIB_NAME) -o $(DLL_NAME) $(LIBRARY) $(BLD_DLL_OPTS) 
-       touch dLL_ifs.hi
+       $(BLD_DLL) --output-lib $(DLL_IMPLIB_NAME) -o $(DLL_NAME) $(LIBRARY) $(BLD_DLL_OPTS)
 endif
 
 #
@@ -807,6 +823,14 @@ install:: $(INSTALL_DATAS)
        done
 endif
 
+ifneq "$(INSTALL_INCLUDES)" ""
+install:: $(INSTALL_INCLUDES)
+       @$(INSTALL_DIR) $(includedir)
+       for i in $(INSTALL_INCLUDES); do \
+               $(INSTALL_DATA) $(INSTALL_OPTS) $$i $(includedir); \
+       done
+endif
+
 #
 # Use with care..
 #
@@ -911,8 +935,8 @@ endif
 dist-pre::
        -rm -rf $(SRC_DIST_DIR)
        -rm -f $(SRC_DIST_NAME).tar.gz
-       (cd $(FPTOOLS_TOP_ABS); find $(SRC_DIST_DIRS) -type d \( -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -exec $(MKDIRHIER) $(SRC_DIST_DIR)/{} \; \) ; )
-       (cd $(FPTOOLS_TOP_ABS); find $(SRC_DIST_DIRS) -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -name "*~" -prune -o -name ".cvsignore" -prune -o -name "\#*" -prune -o -name ".\#*" -prune -o -type l -exec $(LN_S) $(FPTOOLS_TOP_ABS)/{} $(SRC_DIST_DIR)/{} \; )
+       (cd $(FPTOOLS_TOP_ABS); $(FIND) $(SRC_DIST_DIRS) -type d \( -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -exec $(MKDIRHIER) $(SRC_DIST_DIR)/{} \; \) ; )
+       (cd $(FPTOOLS_TOP_ABS); $(FIND) $(SRC_DIST_DIRS) -name CVS -prune -o -name SRC -prune -o -name tests -prune -o -name "*~" -prune -o -name ".cvsignore" -prune -o -name "\#*" -prune -o -name ".\#*" -prune -o -type l -exec $(LN_S) $(FPTOOLS_TOP_ABS)/{} $(SRC_DIST_DIR)/{} \; )
 
 #
 # After having created a shadow distribution tree and copied/linked
@@ -924,13 +948,13 @@ dist-pre::
 #
 dist-post::
        @echo Deleting the following empty directories..
-       ( cd $(SRC_DIST_DIR) ; cd .. ; find $(SRC_DIST_NAME) -type d -exec sh -c 'test x`ls $$0 | wc -l | sed -e "s/ //g"` = x0' {} \; -print -exec rm -rf {} \; -prune )
+       ( cd $(SRC_DIST_DIR) ; cd .. ; $(FIND) $(SRC_DIST_NAME) -type d -exec sh -c 'test x`ls $$0 | wc -l | sed -e "s/ //g"` = x0' {} \; -print -exec rm -rf {} \; -prune )
        ( cd $(SRC_DIST_DIR) ; cd .. ; chmod -R a+rw $(SRC_DIST_NAME) ) 
 
 # Automatic generation of a MANIFEST file for a source distribution
 # tree that is ready to go.
 dist-manifest ::
-       cd $(SRC_DIST_DIR); find . \( -type l -o -type f \) -exec ls -lLG {} \; | sed -e 's/\.\///' > /tmp/MANIFEST ; mv /tmp/MANIFEST MANIFEST
+       cd $(SRC_DIST_DIR); $(FIND) . \( -type l -o -type f \) -exec ls -lLG {} \; | sed -e 's/\.\///' > /tmp/MANIFEST ; mv /tmp/MANIFEST MANIFEST
 
 dist-package:: dist-package-tar-gz
 
@@ -1078,7 +1102,7 @@ endif
 ifneq "$(HS_OBJS)" ""
 ifneq "$(filter -split-objs,$(HC_OPTS))" ""
 clean ::
-       find $(patsubst %.$(way_)o,%,$(HS_OBJS)) -name '*.$(way_)o' -print | xargs $(RM) __rm_food
+       $(FIND) $(patsubst %.$(way_)o,%,$(HS_OBJS)) -name '*.$(way_)o' -print | xargs $(RM) __rm_food
        -rmdir $(patsubst %.$(way_)o,%,$(HS_OBJS)) > /dev/null 2>&1
 endif
 endif