ifneq "$(SUBDIRS)" ""
-all docs runtests boot TAGS clean veryclean maintainer-clean install info html ps dvi txt::
+all docs runtests boot TAGS clean distclean mostlyclean maintainer-clean install info html ps dvi txt::
@echo "------------------------------------------------------------------------"
@echo "===fptools== Recursively making \`$@' in $(SUBDIRS) ..."
@echo "PWD = $(shell pwd)"
$(MAKE) -C $@ $(MFLAGS)
endif
-ifneq "$(WAYS)" ""
-ifeq "$(way)" ""
-
-# NB: the targets exclude
-# boot info TAGS runtests
-# since these are way-independent
-all docs TAGS clean veryclean maintainer-clean install ::
- @echo "------------------------------------------------------------------------"
- @echo "===fptools== Recursively making \`$@' for ways: $(WAYS) ..."
- @echo "PWD = $(shell pwd)"
- @echo "------------------------------------------------------------------------"
-# Don't rely on -e working, instead we check exit return codes from sub-makes.
- @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
- for i in $(WAYS) ; do \
- echo "------------------------------------------------------------------------"; \
- echo "==fptools== $(MAKE) way=$$i $@;"; \
- echo "PWD = $(shell pwd)"; \
- echo "------------------------------------------------------------------------"; \
- $(MAKE) way=$$i --no-print-directory $(MFLAGS) $@ ; \
- if [ $$? -eq 0 ] ; then true; else exit $$x_on_err; fi; \
- done
- @echo "------------------------------------------------------------------------"
- @echo "===fptools== Finished recursively making \`$@' for ways: $(WAYS) ..."
- @echo "PWD = $(shell pwd)"
- @echo "------------------------------------------------------------------------"
-
-endif
-endif
-
##################################################################
# FPtools standard targets
#
define BUILD_LIB
$(RM) $@
-$(AR) $(AR_OPTS) $@ $(LIBOBJS)
+$(AR) $(AR_OPTS) $@ $(STUBOBJS) $(LIBOBJS)
$(RANLIB) $@
endef
#
ifneq "$(HS_SRCS)" ""
-ifneq "$(filter -split-objs,$(HC_OPTS))" ""
+ifeq "$(SplitObjs)" "YES"
+
+SRC_HC_OPTS += -split-objs
+
define BUILD_LIB
$(RM) $@
-TMPDIR=$(TMPDIR); export TMPDIR; find $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o' -print | xargs ar q $@
+TMPDIR=$(TMPDIR); export TMPDIR; ( echo $(STUBOBJS) ; $(FIND) $(patsubst %.$(way_)o,%,$(LIBOBJS)) -name '*.$(way_)o' -print ) | xargs ar q $@
$(RANLIB) $@
endef
-endif # $(filter...
-endif
+
+# Extra stuff for compiling Haskell files with $(SplitObjs):
+
+HC_SPLIT_PRE= \
+if [ ! -d $(basename $@) ]; then mkdir $(basename $@); else \
+ $(FIND) $(basename $@) -name '*.$(way_)o' -print | xargs $(RM) __rm_food ; fi
+HC_SPLIT_POST = touch $@
+
+SRC_HC_PRE_OPTS += $(HC_SPLIT_PRE) ;
+SRC_HC_POST_OPTS += $(HC_SPLIT_POST) ;
+
+#
+# If (Haskell) object files are split, cleaning up
+# consist of descending into the directories where
+# the myriads of object files have been put.
+#
+
+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
+
+endif # $(SplitObjs)
+endif # $(HS_SRCS)
#
# Remove local symbols from library objects if requested.
#
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; \
endif
endif
-$(LIBRARY) :: $(LIBOBJS)
+$(LIBRARY) :: $(STUBOBJS) $(LIBOBJS)
$(BUILD_LIB)
endif
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
#
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..
#
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
#
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
# can't use $(SGML_SRCS) here, it was maybe used elsewhere
MOSTLY_CLEAN_FILES += $(patsubst %.vsgml, %.sgml, $(VSGML_SRCS))
-clean ::
+extraclean ::
$(RM) -rf $(SGML_DOC)
endif
#
###########################################
-.PHONY: realclean mostlyclean clean distclean maintainer-clean
+# we have to be careful about recursion here; since all the clean
+# targets are recursive, we don't want to make eg. distclean depend on
+# clean because that would result in far too many recursive calls.
-# realclean is just a synonym for maintainer-clean
-realclean: maintainer-clean
+.PHONY: mostlyclean clean distclean maintainer-clean
-
-ifneq "$(MOSTLY_CLEAN_FILES)" ""
mostlyclean::
rm -f $(MOSTLY_CLEAN_FILES)
-endif
-
-ifneq "$(CLEAN_FILES)" ""
-clean:: mostlyclean
- rm -f $(CLEAN_FILES)
-endif
+# extraclean is used for adding actions to the clean target.
+extraclean::
-ifneq "$(DIST_CLEAN_FILES)" ""
-distclean:: mostlyclean clean
- rm -f $(DIST_CLEAN_FILES)
-endif
+clean:: extraclean
+ rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES)
+distclean:: extraclean
+ rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) $(DIST_CLEAN_FILES)
-ifneq "$(MAINTAINER_CLEAN_FILES)" ""
-maintainer-clean:: mostlyclean clean distclean
+maintainer-clean:: extraclean
@echo 'This command is intended for maintainers to use; it'
@echo 'deletes files that may need special tools to rebuild.'
- rm -f $(MAINTAINER_CLEAN_FILES)
-endif
-
-#
-# If (Haskell) object files are split, cleaning up
-# consist of descending into the directories where
-# the myriads of object files have been put.
-#
-
-ifneq "$(HS_OBJS)" ""
-ifneq "$(filter -split-objs,$(HC_OPTS))" ""
-clean ::
- 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
-
+ rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) $(MAINTAINER_CLEAN_FILES)
#################################################################################
#
$(MAKE) $(MFLAGS) $@ way=$(subst .,,$(suffix $(subst _,.,$(basename $@))))
endif # if way
+
+ifneq "$(WAYS)" ""
+ifeq "$(way)" ""
+
+# NB: the targets exclude
+# boot runtests
+# since these are way-independent
+all docs TAGS clean distclean mostlyclean maintainer-clean install ::
+ @echo "------------------------------------------------------------------------"
+ @echo "===fptools== Recursively making \`$@' for ways: $(WAYS) ..."
+ @echo "PWD = $(shell pwd)"
+ @echo "------------------------------------------------------------------------"
+# Don't rely on -e working, instead we check exit return codes from sub-makes.
+ @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
+ for i in $(WAYS) ; do \
+ echo "------------------------------------------------------------------------"; \
+ echo "==fptools== $(MAKE) way=$$i $@;"; \
+ echo "PWD = $(shell pwd)"; \
+ echo "------------------------------------------------------------------------"; \
+ $(MAKE) way=$$i --no-print-directory $(MFLAGS) $@ ; \
+ if [ $$? -eq 0 ] ; then true; else exit $$x_on_err; fi; \
+ done
+ @echo "------------------------------------------------------------------------"
+ @echo "===fptools== Finished recursively making \`$@' for ways: $(WAYS) ..."
+ @echo "PWD = $(shell pwd)"
+ @echo "------------------------------------------------------------------------"
+
+endif
+endif