From: <sg...@us...> - 2003-08-31 20:22:18
|
Update of /cvsroot/libfunutil/libfunutil/toc/make In directory sc8-pr-cvs1:/tmp/cvs-serv19739/toc/make Modified Files: cleaner.make Log Message: we now clean subdirs depth-first. Index: cleaner.make =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/toc/make/cleaner.make,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- cleaner.make 26 Aug 2003 00:58:54 -0000 1.4 +++ cleaner.make 31 Aug 2003 20:22:15 -0000 1.5 @@ -1,4 +1,4 @@ -# makefile snippet. +#!/usr/bin/make -f # Usage: # # CLEAN_FILES += *~ foo bar @@ -11,22 +11,25 @@ CLEAN_FILES += $(DEPS_FILE) $(DIST_LISTFILE) -toc_clean_files = test -z "$(1)" && exit 0; \ +toc_clean_files = test "x$(1)" = "x" && exit 0; \ echo Cleaning: $(1); \ - for x in $(1) ""; do test -z "$$x" && continue; \ - rm $$x &> /dev/null; \ + for x in $(1) ""; do test -z "$${x}" && continue; \ + test -w $$x || continue; \ + rm $$x || exit; \ done; \ exit 0 clean-.: - @$(call toc_clean_files,$(CLEAN_FILES)) -clean: clean-. -# it is important that subdirs get added as clean deps AFTER clean-. is, -# unless you want to completely customize the clean order, in which case -# you should comment-out 'clean: clean-.' and order them yourself. - + @$(call toc_clean_files,$(wildcard $(CLEAN_FILES))) +clean-subdirs: +clean: clean-subdirs clean-. +# we clean depth-first to keep some top-level generated files from being nuked :/ +# todo: fix this by moving those files into a generated-files-only dir. +# # Note: distclean does not depend on clean so that a recursive distclean does not # climb down the tree twice :/ -distclean: - @$(call toc_clean_files,$(CLEAN_FILES) $(DISTCLEAN_FILES)) +distclean-.: + @$(call toc_clean_files,$(wildcard $(CLEAN_FILES) $(DISTCLEAN_FILES))) +distclean-subdirs: +distclean: distclean-subdirs distclean-. |