]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - include/buildrules
xfs: fix off-by-one error in xfs_rtalloc_query_range
[thirdparty/xfsprogs-dev.git] / include / buildrules
index fdc60e6460c092c1f47b4881fae9a17e3c39bac9..3480b1f1c4d74e07246e25bd66ae202f76c1f589 100644 (file)
@@ -7,12 +7,25 @@ _BUILDRULES_INCLUDED_ = 1
 include $(TOPDIR)/include/builddefs
 
 clean clobber : $(addsuffix -clean,$(SUBDIRS))
-       @rm -f $(DIRT)
+       @rm -f $(DIRT) .ltdep .dep
        @rm -fr $(DIRDIRT)
 %-clean:
        @echo "Cleaning $*"
        $(Q)$(MAKE) $(MAKEOPTS) -C $* clean
 
+ifdef HDR_SUBDIRS
+.PHONY: .xfs
+
+headers: $(addsuffix -headers, $(HDR_SUBDIRS))
+
+%-headers: .xfs
+       @echo "   [HEADERS] $*"
+       $(Q)$(MAKE) $(MAKEOPTS) -C $* NODEP=1 install-headers
+
+.xfs:
+       @mkdir -p include/xfs
+endif
+
 # Never blow away subdirs
 ifdef SUBDIRS
 .PRECIOUS: $(SUBDIRS)
@@ -23,17 +36,6 @@ $(SUBDIRS):
        $(Q)$(MAKE) $(MAKEOPTS) -q -C $@ || $(MAKE) $(MAKEOPTS) -C $@
 endif
 
-source-link: 
-       @test -z "$$DIR" && DIR="."; \
-       for f in `echo $(SRCFILES) $(SUBDIRS) $(POTHEAD)`; do \
-           if test -d $$f ; then \
-               mkdir $(TOPDIR)/$(PKG_NAME)-$(PKG_VERSION)/$$DIR/$$f || exit $$?; \
-               $(MAKEF) DIR=$$DIR/$$f -C $$f $@ || exit $$?; \
-           else \
-               ln $$f $(TOPDIR)/$(PKG_NAME)-$(PKG_VERSION)/$$DIR/$$f || exit $$?; \
-           fi; \
-       done
-
 #
 # Standard targets
 #
@@ -66,7 +68,7 @@ $(POTHEAD): $(XGETTEXTFILES)
 
 # Update translations
 update-po: $(POTHEAD) $(wildcard $(TOPDIR)/po/*.po)
-       catalogs=$(wildcard $(TOPDIR)/po/*.po); \
+       catalogs="$(wildcard $(TOPDIR)/po/*.po)"; \
        for cat in $$catalogs; do \
          lang=`basename $$cat .po`; \
          mv $$lang.po $$lang.old.po; \
@@ -89,33 +91,31 @@ endif # _BUILDRULES_INCLUDED_
 
 $(_FORCE):
 
-.PHONY : depend install-qa
+# dependency build is automatic, relies on gcc -MM to generate.
+#
+# This is a bit messy. It regenerates the dependencies on each build so
+# that we catch files being added and removed. There are other ways of doing
+# this (e.g. per-file dependency files) but that requires more in-depth changes
+# to the build system. Compile time is not an issue for us, so the
+# rebuild on every make invocation isn't a problem we need to care about. Just
+# do it silently so it doesn't make the build unnecessarily noisy.
 
-DEPENDSCRIPT := $(MAKEDEPEND) $(DEPENDFLAGS) -f - -- $(CFLAGS) -- $(CFILES) | \
-       $(SED) \
-           -e 's,`pwd`,$(TOPDIR),g' \
-           -e 's,  */[^ ]*,,g' \
-           -e '/^[^ ]*: *$$/d' \
-           -e '/^ *$$/d'
+.PHONY : depend ltdepend
 
-ifdef LTLIBRARY
-DEPENDSCRIPT := $(DEPENDSCRIPT) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,'
-endif
+MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
 
-depend : $(CFILES) $(HFILES) $(addsuffix -depend,$(SUBDIRS))
-       $(DEPENDSCRIPT) > .dep
-       test -s .dep || rm -f .dep
+ltdepend: rmltdep .ltdep
 
-%-depend:
-       $(MAKE) -C $* depend
+rmltdep:
+       $(Q)rm -f .ltdep
 
-# 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
+.ltdep: $(CFILES) $(HFILES)
+       $(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep
+
+depend: rmdep .dep
+
+rmdep:
+       $(Q)rm -f .dep
+
+.dep: $(CFILES) $(HFILES)
+       $(Q)$(MAKEDEP) $(CFILES) > .dep