# Common makerules for cleaning directory trees. # # COPYRIGHT (c) 2007 The Manticore Project (manticore.cs.uchicago.edu) # All rights reserved. # # This file defines standard rules for the clean, distclean, and devclean # targets. To use, define the following make variables: # # CLEAN_SUBDIRS -- subdirectories to recursively clean # CLEAN_FILES -- extra files to remove for clean target # The default is to remove CM subdirectories, # .o files, .mbi files, and the $(TARGET). # DISTCLEAN_FILES -- extra files to remove for distclean target # The default is to remove Makefile. # DEVCLEAN_FILES -- extra files to remove for devclean target # CLEAN_FILES += $(wildcard *.o) \ $(wildcard *.so) \ $(wildcard *.a) \ $(wildcard *.mbi) \ $(TARGET) DISTCLEAN_FILES += Makefile .PHONY: sub-clean local-clean clean sub-clean: dirs="$(CLEAN_SUBDIRS)"; \ if test -n "$$dirs" ; then \ for dir in $$dirs ; do \ (cd $$dir && $(MAKE) clean) \ done \ fi local-clean: -rm -f $(CLEAN_FILES) find . \( -name .cm -exec rm -rf {} \; -prune -print \) clean: sub-clean local-clean .PHONY: sub-distclean local-distclean distclean sub-distclean: dirs="$(CLEAN_SUBDIRS)"; \ if test -n "$$dirs" ; then \ for dir in $$dirs ; do \ (cd $$dir && $(MAKE) distclean) \ done \ fi local-distclean: local-clean -rm -rf $(DISTCLEAN_FILES) distclean: sub-distclean local-distclean .PHONY: sub-devclean local-devclean devclean sub-devclean: dirs="$(CLEAN_SUBDIRS)"; \ if test -n "$$dirs" ; then \ for dir in $$dirs ; do \ (cd $$dir && $(MAKE) devclean) \ done \ fi local-devclean: local-distclean -rm -rf $(DEVCLEAN_FILES) devclean: sub-devclean local-devclean