[PATCH] xfsdump: remake dependencies only when necessary

Alex Elder aelder at sgi.com
Sat Feb 13 14:24:12 CST 2010


There's no need to re-make the dependency file all the time.  Make
it so the "depend" target rebuilds the ".dep" file only if necessary.
Also change the name of the dependency file created for "ltdepend"
to be ".ltdep".

Signed-off-by: Alex Elder <aelder at sgi.com>

---
 Makefile           |    6 +++---
 dump/Makefile      |    2 +-
 include/buildrules |   14 +++++++++-----
 librmt/Makefile    |    2 +-
 restore/Makefile   |    2 +-
 5 files changed, 15 insertions(+), 11 deletions(-)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,9 @@ SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.
 CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
 LSRCFILES = configure.in release.sh README VERSION $(CONFIGURE)
 
-LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
-	built .census install.* install-dev.* *.gz autom4te.cache/* libtool \
-	include/builddefs include/config.h
+LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
+	conftest* built .census install.* install-dev.* *.gz \
+	autom4te.cache/* libtool include/builddefs include/config.h
 
 ifeq ($(HAVE_BUILDDEFS), yes)
 LDIRDIRT = $(SRCDIR)
Index: b/dump/Makefile
===================================================================
--- a/dump/Makefile
+++ b/dump/Makefile
@@ -105,7 +105,7 @@ install: default
 	$(INSTALL) -S $(PKG_ROOT_SBIN_DIR)/$(LTCOMMAND) $(PKG_SBIN_DIR)/$(LTCOMMAND)
 install-dev:
 
-depend: $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
+.dep: $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
 
 $(COMMINCL) $(COMMON):
 	@echo "    [LN]     $@"
Index: b/include/buildrules
===================================================================
--- a/include/buildrules
+++ b/include/buildrules
@@ -7,7 +7,7 @@ _BUILDRULES_INCLUDED_ = 1
 include $(TOPDIR)/include/builddefs
 
 clean clobber : $(addsuffix -clean,$(SUBDIRS))
-	@rm -f $(DIRT) .dep
+	@rm -f $(DIRT) .ltdep .dep
 	@rm -fr $(DIRDIRT)
 %-clean:
 	@echo "Cleaning $*"
@@ -94,10 +94,14 @@ $(_FORCE):
 
 MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
 
-ltdepend: $(CFILES) $(HFILES)
+ltdepend: .ltdep
+
+.ltdep: $(CFILES) $(HFILES)
 	@echo "    [DEP]"
-	$(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .dep
+	$(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep
+
+depend: .dep
 
-depend: $(CFILES) $(HFILES)
+.dep: $(CFILES) $(HFILES)
 	@echo "    [DEP]"
-	$(Q)$(MAKEDEP) $(CFILES) > .dep
+	$(Q)[ -n "$(CFILES)" ] && $(MAKEDEP) $(CFILES) > .dep
Index: b/librmt/Makefile
===================================================================
--- a/librmt/Makefile
+++ b/librmt/Makefile
@@ -21,4 +21,4 @@ include $(BUILDRULES)
 
 install install-dev: default
 
--include .dep
+-include .ltdep
Index: b/restore/Makefile
===================================================================
--- a/restore/Makefile
+++ b/restore/Makefile
@@ -117,7 +117,7 @@ install: default
 	$(INSTALL) -S $(PKG_ROOT_SBIN_DIR)/$(LTCOMMAND) $(PKG_SBIN_DIR)/$(LTCOMMAND)
 install-dev:
 
-depend: $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
+.dep: $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
 
 $(COMMINCL) $(COMMON):
 	@echo "    [LN]     $@"




More information about the xfs mailing list