Add new 'depclean' make target at top level

It deletes all dependency (.d) files in the O.arch directories.
This is useful when headers get moved or removed; recreating just
the dependency data is much faster than rebuilding the whole tree.
It is also possible to run the depclean.pl script manually when
only part of the tree needs its dependencies regenerating.
This commit is contained in:
Andrew Johnson
2018-10-20 22:20:03 -05:00
parent 5f68d62f40
commit c08b1ef5d1
3 changed files with 28 additions and 1 deletions

View File

@ -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.<arch> 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.<arch> 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 <top>/cfg/TOP_RULES* files from tops defined in RELEASE* files

View File

@ -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

20
src/tools/depclean.pl Normal file
View File

@ -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);