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

[Xen-changelog] [xen stable-4.8] xen/test/Makefile: Fix clean target, broken by pattern rule



commit 8d3dafb43f61c6deb4fc3612f836d04afab21bbe
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Mon Jun 19 15:04:08 2017 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Wed Jun 21 11:54:08 2017 +0100

    xen/test/Makefile: Fix clean target, broken by pattern rule
    
    In "xen/test/livepatch: Regularise Makefiles" we reworked
    xen/test/Makefile to use a pattern rule.  However, there are two
    problems with this.  Both are related to the way that xen/Rules.mk is
    implicitly part of this Makefile because of the way that Makefiles
    under xen/ are invoked by their parent directory Makefiles.
    
    Firstly, the Rules.mk `clean' target overrides the pattern rule in
    xen/test/Makefile.  The result is that `make -C xen clean' does not
    actually run the livepatch clean target.
    
    The Rules.mk clean target does have provision for recursing into
    subdirectories, but that feature is tangled up with complex object
    file iteration machinery which is not desirable here.  However, we can
    extend the Rules.mk clean target since it is a double-colon rule.
    
    Sadly this involves duplicating the SUBDIR iteration boilerplate.  (A
    make function could be used but the cure would be worse than the
    disease.)
    
    Secondly, Rules.mk has a number of -include directives.  make likes to
    try to (re)build files mentioned in includes.  With the % pattern
    rule, this applies to those files too.
    
    As a result, make -C xen clean would try to build `.*.d' (for example)
    in xen/test.  This would fail with an error message.  The error would
    be ignored because of the `-', but it's annoying and ugly.
    
    Solve this by limiting the % pattern rule to the targets we expect it
    to handle.  These are those listed in the top-level Makefile help
    message, apart from: those which are subdir- or component-qualified;
    clean targets (which are handled specially, even distclean); and dist,
    src-tarball-*, etc. (which are converted to install by an earlier
    Makefile).
    
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
    Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
    Release-acked-by: Julien Grall <julien.grall@xxxxxxx>
    (cherry picked from commit 592e834522086009975bd48d59386094771bd06b)
    (cherry picked from commit b38b1479a532f08fedd7f3b761673bc78b66739d)
---
 xen/test/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/test/Makefile b/xen/test/Makefile
index aa1a23b..aaa4996 100644
--- a/xen/test/Makefile
+++ b/xen/test/Makefile
@@ -7,7 +7,12 @@ ifneq ($(XEN_TARGET_ARCH),x86_32)
 SUBDIRS += livepatch
 endif
 
-%:
+install build subtree-force-update uninstall: %:
        set -e; for s in $(SUBDIRS); do \
                $(MAKE) -f $(BASEDIR)/Rules.mk -C $$s $*; \
        done
+
+clean::
+       set -e; for s in $(SUBDIRS); do \
+               $(MAKE) -f $(BASEDIR)/Rules.mk -C $$s $@; \
+       done
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.8

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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