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

[xen master] build: fix make warning if there is no cppcheck



commit 890b23a43345785aafd5e55ccd91a80d3ad76f36
Author:     Bertrand Marquis <bertrand.marquis@xxxxxxx>
AuthorDate: Wed May 25 11:07:46 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed May 25 11:07:46 2022 +0200

    build: fix make warning if there is no cppcheck
    
    If cppcheck is not present, the following warning appears during build:
    which: no cppcheck in ([...])
    /bin/sh: cppcheck: command not found
    
    Fix the problem by using shell code inside the cppcheck-version rule to
    also prevent unneeded call of which when something else than cppcheck is
    built.
    
    Reported-by: Julien Grall <julien@xxxxxxx>
    Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/Makefile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 15388703bc..82f5310b12 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -694,12 +694,14 @@ $(objtree)/%.c.cppcheck: $(srctree)/%.c 
$(objtree)/include/generated/autoconf.h
        $(call if_changed,cppcheck_xml)
 
 cppcheck-version:
-ifeq ($(shell which $(CPPCHECK)),)
-       $(error Cannot find cppcheck executable: $(CPPCHECK))
-endif
-ifeq ($(shell $(CPPCHECK) --version | awk '{print ($$2 < 2.7)}'),1)
-       $(error Please upgrade your cppcheck to version 2.7 or greater)
-endif
+       $(Q)if ! which $(CPPCHECK) > /dev/null 2>&1; then \
+               echo "Cannot find cppcheck executable: $(CPPCHECK)"; \
+               exit 1; \
+       fi
+       $(Q)if [ "$$($(CPPCHECK) --version | awk '{print ($$2 < 2.7)}')" -eq 1 
]; then \
+               echo "Please upgrade your cppcheck to version 2.7 or greater"; \
+               exit 1; \
+       fi
 
 # Put this in generated headers this way it is cleaned by include/Makefile
 $(objtree)/include/generated/compiler-def.h:
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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