[PATCH] xfstests: remake dependencies only when necessary

Alex Elder aelder at sgi.com
Sat Feb 13 14:23:54 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           |    4 ++--
 include/buildrules |   16 +++++++++++-----
 lib/Makefile       |    2 +-
 3 files changed, 14 insertions(+), 8 deletions(-)

Index: b/Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -27,8 +27,8 @@ endif
 TESTS = $(shell sed -n -e '/^[0-9][0-9][0-9]*/s/ .*//p' group)
 CONFIGURE = configure include/builddefs include/config.h
 LSRCFILES = configure configure.in aclocal.m4 README VERSION
-LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
-	check.log check.time
+LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
+	conftest* check.log check.time
 
 ifeq ($(HAVE_DMAPI), true)
 DMAPI_MAKEFILE = dmapi/Makefile
Index: b/include/buildrules
===================================================================
--- a/include/buildrules
+++ b/include/buildrules
@@ -8,7 +8,7 @@ include $(TOPDIR)/include/builddefs
 
 clean clobber : $(addsuffix -clean,$(SUBDIRS))
 	$(Q)rm -f $(DIRT)
-	$(Q)rm -fr .libs .dep
+	$(Q)rm -fr .libs .ltdep .dep
 
 %-clean:
 	@echo "Cleaning $*"
@@ -75,11 +75,17 @@ $(_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)[ -n "$(CFILES)" ] && \
+	    $(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep
+
+depend: .dep
 
-depend: $(CFILES) $(HFILES)
+.dep: $(CFILES) $(HFILES)
 	@echo "    [DEP]"
-	$(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep
+	$(Q)[ -n "$(CFILES)" ] && \
+	    $(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep
 
Index: b/lib/Makefile
===================================================================
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -25,4 +25,4 @@ include $(BUILDRULES)
 
 install install-dev: default
 
--include .dep
+-include .ltdep




More information about the xfs mailing list