[v2,17/24] trace-cmd: Fix the logic behind SWIG_DEFINED in the Makefile
diff mbox series

Message ID 20180206084906.9854-18-vladislav.valtchev@gmail.com
State New, archived
Headers show
  • trace-cmd: restructure the project's source tree
Related show

Commit Message

Vladislav Valtchev (VMware) Feb. 6, 2018, 8:48 a.m. UTC
At least on Ubuntu, the $(shell ...) command used in the master Makefile to test
for the existence of the 'swig' command does not work in the negative case.
That causes the build to report ugly errors in case 'swig' is not installed on
the system.
This one-line patch, fixes the problem by using the POSIX 'comamnd -v {CMD}'
in $(shell ...) to detect the presence of the swig and restores this way the
fake report_noswig target.

Signed-off-by: Vladislav Valtchev (VMware) <vladislav.valtchev@gmail.com>
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff mbox series

diff --git a/Makefile b/Makefile
index cc96534..6016bec 100644
--- a/Makefile
+++ b/Makefile
@@ -103,7 +103,7 @@  ifndef VERBOSE
   VERBOSE = 0
-SWIG_DEFINED := $(shell if swig -help &> /dev/null; then echo 1; else echo 0; fi)
+SWIG_DEFINED := $(shell if command -v swig; then echo 1; else echo 0; fi)
 ifeq ($(SWIG_DEFINED), 0)
 BUILD_PYTHON := report_noswig
@@ -116,7 +116,7 @@  PYTHON_GUI	:= ctracecmd.so ctracecmdgui.so
 PYTHON_VERS ?= python
 # Can build python?
-ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && which swig && echo y"), y)
+ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && echo y"), y)
 	PYTHON_PLUGINS := plugin_python.so