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

[PATCH] 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 this by hiding the error output from which and only try to execute
cppcheck --version if we have a cppcheck.

Reported-by: Julien Grall <julien@xxxxxxx>
Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 15388703bc..f42be3d0ab 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -694,12 +694,13 @@ $(objtree)/%.c.cppcheck: $(srctree)/%.c 
$(objtree)/include/generated/autoconf.h
        $(call if_changed,cppcheck_xml)
 
 cppcheck-version:
-ifeq ($(shell which $(CPPCHECK)),)
+ifeq ($(shell which $(CPPCHECK) 2> /dev/null),)
        $(error Cannot find cppcheck executable: $(CPPCHECK))
-endif
+else
 ifeq ($(shell $(CPPCHECK) --version | awk '{print ($$2 < 2.7)}'),1)
        $(error Please upgrade your cppcheck to version 2.7 or greater)
 endif
+endif
 
 # Put this in generated headers this way it is cleaned by include/Makefile
 $(objtree)/include/generated/compiler-def.h:
-- 
2.25.1




 


Rackspace

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