diff mbox series

trace-cmd: Add LOCAL_LIBS variable to force building the local libraries

Message ID 20201221095845.1a6f2aa7@gandalf.local.home (mailing list archive)
State Accepted
Commit 70a9862b59bb2194bb965c6230d5e52c1b8ee132
Headers show
Series trace-cmd: Add LOCAL_LIBS variable to force building the local libraries | expand

Commit Message

Steven Rostedt Dec. 21, 2020, 2:58 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

In the process of changing the API for libtracefs before it becomes live,
add LOCAL_LIBS make command line variable to allow overriding the check if
libtracevent and libtracefs exist. If LOCAL_LIBS=1 is set on the make
command line, then the local versions of the libraries are built.

This is mostly for debug purposes, so it does not need to be documented.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 7aef50b3..eb833f67 100644
--- a/Makefile
+++ b/Makefile
@@ -232,7 +232,15 @@  LIBTRACEFS=libtracefs
 LIBTRACEFS_DIR = $(obj)/lib/tracefs
 LIBTRACEFS_STATIC = $(LIBTRACEFS_DIR)/libtracefs.a
 
-ifeq ($(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y"), y)
+# In the special case (debugging), that the local versions of the
+# libraries need to be built, adding "LOCAL_LIBS=1" to the make
+# command line will skip the check if they are installed.
+ifneq ("$(origin LOCAL_LIBS)", "command line")
+TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y")
+TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS) > /dev/null 2>&1 && echo y")
+endif
+
+ifeq ("$(TEST_LIBTRACEEVENT)", "y")
 LIBTRACEEVENT_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
 LIBTRACEEVENT_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
 else
@@ -243,7 +251,7 @@  endif
 
 export LIBTRACEEVENT_CFLAGS LIBTRACEEVENT_LDLAGS
 
-ifeq ($(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS) > /dev/null 2>&1 && echo y"), y)
+ifeq ("$(TEST_LIBTRACEFS)", "y")
 LIBTRACEFS_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS)")
 LIBTRACEFS_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEFS)")
 else