diff mbox series

[XEN,v3,17/25] libs/libs.mk: Rework target headers.chk dependencies

Message ID 20220624160422.53457-18-anthony.perard@citrix.com (mailing list archive)
State Superseded
Headers show
Series Toolstack build system improvement, toward non-recursive makefiles | expand

Commit Message

Anthony PERARD June 24, 2022, 4:04 p.m. UTC
There is no need to call the "headers.chk" target when it isn't
wanted, so it never need to be .PHONY.

Also, there is no more reason to separate the prerequisites from the
recipe.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/libs.mk | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Jürgen Groß June 29, 2022, 10:23 a.m. UTC | #1
On 24.06.22 18:04, Anthony PERARD wrote:
> There is no need to call the "headers.chk" target when it isn't
> wanted, so it never need to be .PHONY.
> 
> Also, there is no more reason to separate the prerequisites from the
> recipe.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Bertrand Marquis July 5, 2022, 1:29 p.m. UTC | #2
Hi Anthony,

> On 24 Jun 2022, at 17:04, Anthony PERARD <anthony.perard@citrix.com> wrote:
> 
> There is no need to call the "headers.chk" target when it isn't
> wanted, so it never need to be .PHONY.
> 
> Also, there is no more reason to separate the prerequisites from the
> recipe.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> tools/libs/libs.mk | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
> index 7aee449370..f778a7df82 100644
> --- a/tools/libs/libs.mk
> +++ b/tools/libs/libs.mk
> @@ -55,22 +55,20 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
> $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
> 
> .PHONY: all
> -all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
> +all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
> 
> ifneq ($(NO_HEADERS_CHK),y)
> -headers.chk:
> +all: headers.chk
> +
> +headers.chk: $(LIBHEADERS) $(AUTOINCS)
> 	for i in $(filter %.h,$^); do \
> 	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
> 	          -S -o /dev/null $$i || exit 1; \
> 	    echo $$i; \
> 	done >$@.new
> 	mv $@.new $@
> -else
> -.PHONY: headers.chk
> endif
> 
> -headers.chk: $(LIBHEADERS) $(AUTOINCS)
> -
> headers.lst: FORCE
> 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
> 	@$(call move-if-changed,$@.tmp,$@)
> -- 
> Anthony PERARD
> 
>
diff mbox series

Patch

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 7aee449370..f778a7df82 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -55,22 +55,20 @@  $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: headers.chk $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
-headers.chk:
+all: headers.chk
+
+headers.chk: $(LIBHEADERS) $(AUTOINCS)
 	for i in $(filter %.h,$^); do \
 	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
 	          -S -o /dev/null $$i || exit 1; \
 	    echo $$i; \
 	done >$@.new
 	mv $@.new $@
-else
-.PHONY: headers.chk
 endif
 
-headers.chk: $(LIBHEADERS) $(AUTOINCS)
-
 headers.lst: FORCE
 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
 	@$(call move-if-changed,$@.tmp,$@)