From 2711c31f22cd5f550671724bef59186c5189935a Mon Sep 17 00:00:00 2001 From: simonmar <unknown> Date: Thu, 27 Apr 2000 10:40:43 +0000 Subject: [PATCH] [project @ 2000-04-27 10:40:43 by simonmar] Further cleanups to the clean targets. Don't recurse too much for distclean and maintainer-clean. --- mk/target.mk | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/mk/target.mk b/mk/target.mk index 629930d0dba9..b8410cd2c96e 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -446,7 +446,7 @@ SRC_HC_POST_OPTS += $(HC_SPLIT_POST) ; # the myriads of object files have been put. # -clean :: +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 @@ -1030,7 +1030,7 @@ CLEAN_FILES += $(SGML_TEXT) $(SGML_TEX) $(SGML_PS) $(SGML_DVI) $(SGML_PDF) $(SGM # 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 @@ -1041,32 +1041,28 @@ endif # ########################################### +# 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. + .PHONY: mostlyclean clean distclean maintainer-clean -ifneq "$(MOSTLY_CLEAN_FILES)" "" mostlyclean:: rm -f $(MOSTLY_CLEAN_FILES) -endif -clean:: mostlyclean -ifneq "$(CLEAN_FILES)" "" -clean:: - rm -f $(CLEAN_FILES) -endif +# extraclean is used for adding actions to the clean target. +extraclean:: -distclean:: clean -ifneq "$(DIST_CLEAN_FILES)" "" -distclean:: - 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) -maintainer-clean:: distclean -ifneq "$(MAINTAINER_CLEAN_FILES)" "" -maintainer-clean:: +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 + rm -f $(MOSTLY_CLEAN_FILES) $(CLEAN_FILES) $(MAINTAINER_CLEAN_FILES) ################################################################################# # -- GitLab