From: Dave Chinner Date: Tue, 30 Jun 2015 01:21:25 +0000 (+1000) Subject: build: populate include/xfs before building X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83d7c7d055497d894871bfc5dad401eb39a610e6;p=thirdparty%2Fxfsprogs-dev.git build: populate include/xfs before building To avoid conflicts between dependency generation and header installation, we need to separate the header installation out into a separate step in the build that needs to be done before the actual build. Add a "HEADER_SUBDIRS" list to indicate which directories we need to build headers in, and iterate it before the SUBDIRS build target. Replace the implicit header installation rules in makefiles with explict header targets so this will work. Signed-off-by: Dave Chinner --- diff --git a/Makefile b/Makefile index 24b9e2e11..6d6803bbc 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,8 @@ LDIRDIRT = $(SRCDIR) LDIRT += $(SRCTAR) endif +# header install rules to populate include/xfs correctly +HDR_SUBDIRS = include libxfs DLIB_SUBDIRS = libxlog libxcmd libhandle libdisk LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) @@ -53,6 +55,7 @@ default: include/builddefs include/platform_defs.h ifeq ($(HAVE_BUILDDEFS), no) $(Q)$(MAKE) $(MAKEOPTS) -C . $@ else + $(Q)$(MAKE) $(MAKEOPTS) headers $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS) endif diff --git a/include/Makefile b/include/Makefile index 6b9c7f0bf..a0a6554d6 100644 --- a/include/Makefile +++ b/include/Makefile @@ -54,14 +54,14 @@ LSRCFILES += $(DKHFILES) $(LIBHFILES) LDIRT = disk LDIRDIRT = xfs -default install: .xfs disk +default install: disk disk: @echo " [LN] $@" $(Q)$(LN_S) . $@ # set up include/xfs header directory -.xfs: $(addsuffix -hdrs, $(HFILES) $(QAHFILES) $(PHFILES) $(DKHFILES) $(LIBHFILES)) +headers: $(addsuffix -hdrs, $(HFILES) $(QAHFILES) $(PHFILES) $(DKHFILES) $(LIBHFILES)) %-hdrs: xfs $(Q)$(LN_S) -f $(PWD)/include/$* xfs/$* diff --git a/include/buildrules b/include/buildrules index dbd9e10a7..1c9fe2819 100644 --- a/include/buildrules +++ b/include/buildrules @@ -13,6 +13,11 @@ clean clobber : $(addsuffix -clean,$(SUBDIRS)) @echo "Cleaning $*" $(Q)$(MAKE) $(MAKEOPTS) -C $* clean +headers: $(addsuffix -headers, $(HDR_SUBDIRS)) +%-headers: + @echo " [HEADERS] $*" + $(Q)$(MAKE) $(MAKEOPTS) -C $* headers + # Never blow away subdirs ifdef SUBDIRS .PRECIOUS: $(SUBDIRS) diff --git a/libxfs/Makefile b/libxfs/Makefile index a3c9ab53a..afd0af3d4 100644 --- a/libxfs/Makefile +++ b/libxfs/Makefile @@ -102,7 +102,7 @@ DEBUG = -DNDEBUG LDIRT = gen_crc32table crc32table.h crc32selftest -default: xfs crc32selftest ltdepend $(LTLIBRARY) +default: crc32selftest ltdepend $(LTLIBRARY) crc32table.h: gen_crc32table.c @echo " [CC] gen_crc32table" @@ -121,7 +121,7 @@ crc32selftest: gen_crc32table.c crc32table.h crc32.c $(Q) ./$@ # set up include/xfs header directory -xfs: $(addsuffix -hdrs, $(PKGHFILES) $(QAHFILES)) +headers: $(addsuffix -hdrs, $(PKGHFILES) $(QAHFILES)) %-hdrs: $(Q)$(LN_S) -f $(PWD)/libxfs/$* $(TOPDIR)/include/xfs/$*