[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] build: generic top-level rule to build individual files



commit 8eec96b7b8d937d40e2e7988edb8bbd08598c715
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Mar 29 15:48:15 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 29 15:48:15 2022 +0200

    build: generic top-level rule to build individual files
    
    In particular when cross-compiling or having in place other tool chain
    overrides, invoking make to build individual files (e.g. object,
    preprocessed, or assembly ones) so far involves putting the various
    overrides on the command line instead of simply getting them from
    ./.config.
    
    Furthermore this helps working around a yet unaddressed make quirk [1]:
    Variables put on the command line are invisible to $(shell ...), unless
    invoked from a recursive make: During the recursive invocation such
    variables are put in the recursive make's environment and hence become
    "visible".
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    
    [1] https://savannah.gnu.org/bugs/?10593
---
 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Makefile b/Makefile
index 346d73a0dc..b93b22c752 100644
--- a/Makefile
+++ b/Makefile
@@ -75,6 +75,13 @@ ifeq (x86_64,$(XEN_TARGET_ARCH))
        XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom pv-grub-if-enabled
 endif
 
+define do-subtree
+$(1)/%: FORCE
+       $$(MAKE) -C $(1) $$*
+endef
+
+$(foreach m,$(wildcard */Makefile),$(eval $(call do-subtree,$(patsubst 
%/Makefile,%,$(m)))))
+
 .PHONY: build-docs
 build-docs:
        $(MAKE) -C docs build
@@ -334,3 +341,6 @@ uninstall: uninstall-tools-public-headers $(TARGS_UNINSTALL)
 .PHONY: xenversion
 xenversion:
        @$(MAKE) --no-print-directory -C xen xenversion
+
+.PHONY: FORCE
+FORCE:
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.