trace-cmd build: If swig is not installed, force NO_PYTHON=1
While trying to build trace-cmd on a box without swig installed, I get an
annoying error during build when the compile tries to build the python
plugins. Force NO_PYTHON=1 when swig is not installed, and give a warning
about it.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
diff --git a/Makefile b/Makefile
index ebae15a..571af62 100644
--- a/Makefile
+++ b/Makefile
@@ -90,6 +90,12 @@
VERBOSE = 0
endif
+SWIG_DEFINED := $(shell if swig -help &> /dev/null; then echo 1; else echo 0; fi)
+ifeq ($(SWIG_DEFINED), 0)
+BUILD_PYTHON := report_noswig
+NO_PYTHON = 1
+endif
+
ifndef NO_PYTHON
PYTHON := ctracecmd.so
PYTHON_GUI := ctracecmd.so ctracecmdgui.so
@@ -615,6 +621,11 @@
##### PYTHON STUFF #####
+report_noswig: force
+ $(Q)echo
+ $(Q)echo " NO_PYTHON forced: swig not installed, not compling python plugins"
+ $(Q)echo
+
PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_VERS)`
PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \
$(shell python2 -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LINKFORSHARED')")