diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 838994bd0..b18fbf026 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -15,6 +15,10 @@ CVSCLEAN = $(call FIND_TOOL,cvsclean.pl) cvsclean: $(PERL) $(CVSCLEAN) +DEPCLEAN = $(call FIND_TOOL,depclean.pl) +depclean: + $(PERL) $(DEPCLEAN) + realuninstall: uninstallDirs $(RMDIR) $(INSTALL_LOCATION_BIN) $(RMDIR) $(INSTALL_LOCATION_LIB) @@ -73,12 +77,14 @@ help: @echo " uninstall - Remove install directories created by this hostarch." @echo " realuninstall - Removes ALL install dirs" @echo " distclean - Same as realclean cvsclean realuninstall." + @echo " depclean - Removes all .d files from O. directories." @echo " cvsclean - Removes cvs .#* files in all dirs of directory tree" @echo " help - Prints this list of valid make targets " @echo "Indiv. object targets are supported by O. level Makefile .e.g" @echo " xxxRecord.o" -.PHONY: cleandirs distclean cvsclean realuninstall archuninstall uninstallDirs +.PHONY: cleandirs distclean cvsclean depclean +.PHONY: realuninstall archuninstall uninstallDirs .PHONY: uninstall help # Include /cfg/TOP_RULES* files from tops defined in RELEASE* files diff --git a/src/tools/Makefile b/src/tools/Makefile index d07092271..b7d6582cb 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -20,6 +20,7 @@ PERL_MODULES += EPICS/Getopts.pm PERL_SCRIPTS += assembleSnippets.pl PERL_SCRIPTS += convertRelease.pl PERL_SCRIPTS += cvsclean.pl +PERL_SCRIPTS += depclean.pl PERL_SCRIPTS += dos2unix.pl PERL_SCRIPTS += expandVars.pl PERL_SCRIPTS += fullPathName.pl diff --git a/src/tools/depclean.pl b/src/tools/depclean.pl new file mode 100644 index 000000000..cbf6077d1 --- /dev/null +++ b/src/tools/depclean.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl +#************************************************************************* +# Copyright (c) 2018 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# This file is distributed subject to a Software License Agreement found +# in the file LICENSE that is included with this distribution. +#************************************************************************* + +# Find and delete dependency files from all build dirs in the source tree. +# The extension for dependency files is assumed to be .d (currently true). + +use File::Find; + +@ARGV = ('.') unless @ARGV; + +sub check { + unlink if -f && m(/O\.[^/]+/[^/]+\.d$); +} + +find({ wanted => \&check, no_chdir => 1 }, @ARGV);