summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2010-01-26 14:22:35 +1100
committerDave Chinner <david@fromorbit.com>2010-01-26 14:22:35 +1100
commit76f1b870d980f9fbef45298028e3a4a14d88c65f (patch)
treec054374e503ba5344f56331248d433cf70a5b56a /include
parent82e1e14dba44ce53b93ef109d5479cafa3ac3596 (diff)
xfstests: Automatic build dependency calculations
Currently the xfstest builds do not have any automatic dependency calculations. It relies on a separate make depend run to build or update dependency information. It also relies on an external makedepend binary. If that binary does not exist, the dependencies do not get calculated. To remove the dependency on makedepend, gcc can be used instead as it has a command to generate dependency information. This patch changes the dependency rule building to use gcc. In case anyone uses an old (several years) gcc compiler or a compiler that doesn't support gcc compatible dependency generation, a new configure check is added to turn off dependency checking so builds can still be done. To use the dependencies automatically, we need to use a special include makefile directive to include the build dependencies into the current makefile. Essentially once the dependencies are calculated, they can be included into the makefile and make will recalculate the build dependencies automatically based on that information. Hence we get a build that automatically calculates and keeps dependencies up to date without dependence on any external tools. Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include')
-rw-r--r--include/builddefs.in4
-rw-r--r--include/buildrules36
2 files changed, 10 insertions, 30 deletions
diff --git a/include/builddefs.in b/include/builddefs.in
index 7827ed5a..23a49917 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -65,18 +65,14 @@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
ifeq ($(PKG_PLATFORM),linux)
PCFLAGS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(GCCFLAGS)
-DEPENDFLAGS = -D__linux__
endif
ifeq ($(PKG_PLATFORM),darwin)
PCFLAGS = -traditional-cpp $(GCCFLAGS)
-DEPENDFLAGS = -D__APPLE__
endif
ifeq ($(PKG_PLATFORM),irix)
PCFLAGS = -nostdinc -I$(ROOT)/usr/include -I$(TOPDIR)/../irix/include
-DEPENDFLAGS = -D__sgi__
endif
ifeq ($(PKG_PLATFORM),freebsd)
-DEPENDFLAGS = -D__FreeBSD__
endif
GCFLAGS = $(OPTIMIZER) $(DEBUG) $(CPPFLAGS) \
diff --git a/include/buildrules b/include/buildrules
index 54283911..5388210e 100644
--- 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
+ $(Q)rm -fr .libs .dep
%-clean:
@echo "Cleaning $*"
@@ -70,32 +70,16 @@ endif # _BUILDRULES_INCLUDED_
$(_FORCE):
-.PHONY : depend
+# dependency build is automatic, relies on gcc -MM to generate.
+.PHONY : depend ltdepend
-DEPENDSCRIPT := $(MAKEDEPEND) $(DEPENDFLAGS) -f - -- $(CFLAGS) -- $(CFILES) | \
- $(SED) -e 's,`pwd`,$(TOPDIR),g' \
- -e 's, */[^ ]*,,g' \
- -e '/^[^ ]*: *$$/d' \
- -e '/^ *$$/d'
+MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
-ifdef LTLIBRARY
-DEPENDSCRIPT := $(DEPENDSCRIPT) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,'
-endif
+ltdepend: $(CFILES) $(HFILES)
+ @echo " [DEP]"
+ $(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .dep
-depend : $(CFILES) $(HFILES) $(addsuffix -depend,$(SUBDIRS))
- $(DEPENDSCRIPT) > .dep
- test -s .dep || rm -f .dep
+depend: $(CFILES) $(HFILES)
+ @echo " [DEP]"
+ $(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1,' > .dep
-%-depend:
- $(MAKE) -C $* depend
-
-# Include dep, but only if it exists
-ifeq ($(shell test -f .dep && echo .dep), .dep)
-include .dep
-else
-ifdef LTLIBRARY
-$(LTOBJECTS): $(HFILES)
-else
-$(OBJECTS): $(HFILES)
-endif
-endif