diff mbox series

[XEN,v6,11/31] build: fix clean targets when subdir-y is used

Message ID 20210701141011.785641-12-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen: Build system improvements | expand

Commit Message

Anthony PERARD July 1, 2021, 2:09 p.m. UTC
The make variable $(subdir-y) isn't used yet but will be in a
following patch. Anything in $(subdir-y) doesn't to have a '/' as
suffix as we already now it's a directory.

Rework the rules so that it doesn't matter whether there is a '/' or
not. It also mimic more closely to the way Linux's Kbuild descend in
subdirectories.

FORCE phony target isn't needed anymore running clean, so it can be
removed.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/scripts/Makefile.clean | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Jan Beulich July 7, 2021, 3:15 p.m. UTC | #1
On 01.07.2021 16:09, Anthony PERARD wrote:
> The make variable $(subdir-y) isn't used yet but will be in a
> following patch. Anything in $(subdir-y) doesn't to have a '/' as
> suffix as we already now it's a directory.
> 
> Rework the rules so that it doesn't matter whether there is a '/' or
> not. It also mimic more closely to the way Linux's Kbuild descend in
> subdirectories.
> 
> FORCE phony target isn't needed anymore running clean, so it can be
> removed.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

> --- a/xen/scripts/Makefile.clean
> +++ b/xen/scripts/Makefile.clean
> @@ -12,19 +12,18 @@ include Makefile
>  # Figure out what we need to clean from the various variables
>  # ==========================================================================
>  subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
> -              $(filter %/, $(obj-y) $(obj-n) $(obj-))
> +              $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))

Isn't this a normalization which also wants doing in xen/Rules.mk for
subdir-y? Or perhaps this is part of one of the subsequent patches
already?

Jan
Anthony PERARD July 12, 2021, 2:54 p.m. UTC | #2
On Wed, Jul 07, 2021 at 05:15:44PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > The make variable $(subdir-y) isn't used yet but will be in a
> > following patch. Anything in $(subdir-y) doesn't to have a '/' as
> > suffix as we already now it's a directory.
> > 
> > Rework the rules so that it doesn't matter whether there is a '/' or
> > not. It also mimic more closely to the way Linux's Kbuild descend in
> > subdirectories.
> > 
> > FORCE phony target isn't needed anymore running clean, so it can be
> > removed.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks.

> > --- a/xen/scripts/Makefile.clean
> > +++ b/xen/scripts/Makefile.clean
> > @@ -12,19 +12,18 @@ include Makefile
> >  # Figure out what we need to clean from the various variables
> >  # ==========================================================================
> >  subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
> > -              $(filter %/, $(obj-y) $(obj-n) $(obj-))
> > +              $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
> 
> Isn't this a normalization which also wants doing in xen/Rules.mk for
> subdir-y? Or perhaps this is part of one of the subsequent patches
> already?

Indeed, a similar change is done as part of
    build: build everything from the root dir, use obj=$subdir

Cheers,
diff mbox series

Patch

diff --git a/xen/scripts/Makefile.clean b/xen/scripts/Makefile.clean
index 53379e6102cc..027c200c0efc 100644
--- a/xen/scripts/Makefile.clean
+++ b/xen/scripts/Makefile.clean
@@ -12,19 +12,18 @@  include Makefile
 # Figure out what we need to clean from the various variables
 # ==========================================================================
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
-              $(filter %/, $(obj-y) $(obj-n) $(obj-))
+              $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
 DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
 .PHONY: clean
-clean:: $(addprefix _clean_, $(subdir-all))
+clean:: $(subdir-all)
 	rm -f *.o .*.o.tmp *~ core $(DEPS_RM)
 
 # Descending
 # ---------------------------------------------------------------------------
 
-_clean_%/: FORCE
-	$(MAKE) $(clean) $*
+PHONY += $(subdir-all)
+$(subdir-all):
+	$(MAKE) $(clean) $@
 
-# Force execution of pattern rules (for which PHONY cannot be directly used).
-.PHONY: FORCE
-FORCE:
+.PHONY: $(PHONY)