summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlex Elder <aelder@sgi.com>2011-03-04 19:37:41 +0000
committerAlex Elder <aelder@sgi.com>2011-03-11 06:45:19 -0600
commita241a16214feccf5375589d535a42f72cda4b78b (patch)
tree21db1b874b1aca98f662bb198c2cefcd05a8ae96 /include
parent6249f4ae8dc7828041b180a025cbf099583af1c1 (diff)
xfstests: some refinements on "make depend"
Make it so "make depend" is a generic target, like "make clean". Each Makefile has a "depend" target that indicates whether making dependencies means creating ".dep" or creating ".ltdep" (or, I suppose, both, though none do that right now). Both files get created even if there are no CFILES to scan (to ensure the target up-to-date). The "default" target now depends on "depend" (there is no "ltdepend" any more). Remove the "depend" and "ltdepend" definitions from the "buildrules" file; only the actual generated files (".dep" and ".ltdep") remain as generic targets. The "depend' target is still defined as phony. Do a shell trick when expanding the value of CFILES, to avoid a problem that occurs if it is created by "make" by concatentating two empty strings. The problem was that in that case CFILES will contain a space, and that wasn't getting treated as empty as desired. Make the rule for tool/lib dependencies more generic, to reflect the general desire that "lib" subdirectories need to be built before things in the "tool" subdirectories. Signed-off-by: Alex Elder <aelder@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include')
-rw-r--r--include/buildrules31
1 files changed, 21 insertions, 10 deletions
diff --git a/include/buildrules b/include/buildrules
index d8ef6b1e..c8a7c474 100644
--- a/include/buildrules
+++ b/include/buildrules
@@ -6,13 +6,20 @@ _BUILDRULES_INCLUDED_ = 1
include $(TOPDIR)/include/builddefs
+depend: $(addsuffix -depend,$(SUBDIRS))
+
+%-depend:
+ $(Q)$(MAKE) $(MAKEOPTS) -q -C $* depend || \
+ $(MAKE) $(MAKEOPTS) -C $* depend
+
clean clobber : $(addsuffix -clean,$(SUBDIRS))
$(Q)rm -f $(DIRT)
$(Q)rm -fr .libs .ltdep .dep
%-clean:
@echo "Cleaning $*"
- $(Q)$(MAKE) $(MAKEOPTS) -q -C $* clean || $(MAKE) $(MAKEOPTS) -C $* clean
+ $(Q)$(MAKE) $(MAKEOPTS) -q -C $* clean || \
+ $(MAKE) $(MAKEOPTS) -C $* clean
# Never blow away subdirs
ifdef SUBDIRS
@@ -71,21 +78,25 @@ endif # _BUILDRULES_INCLUDED_
$(_FORCE):
# dependency build is automatic, relies on gcc -MM to generate.
-.PHONY : depend ltdepend
+.PHONY : depend
MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
-ltdepend: .ltdep
-
.ltdep: $(CFILES) $(HFILES)
@echo " [LTDEP]"
- $(Q)[ -n "$(CFILES)" ] && \
- $(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep
-
-depend: .dep
+ $(Q)if [ -n "$$( echo $(CFILES))" ]; then \
+ $(MAKEDEP) $(CFILES) | \
+ $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep; \
+ else \
+ cp /dev/null .ltdep; \
+ fi
.dep: $(CFILES) $(HFILES)
@echo " [DEP]"
- $(Q)[ -n "$(CFILES)" ] && \
- $(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep
+ $(Q)if [ -n "$$( echo $(CFILES))" ]; then \
+ $(MAKEDEP) $(CFILES) | \
+ $(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep; \
+ else \
+ cp /dev/null .dep; \
+ fi