From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> Update the Makefiles so that "make test" will use the system libraries of libtraceevent and libtracefs if they are present, and only build them locally if they are not. Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- Makefile | 5 ++++- utest/Makefile | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c6cdeeaef46d..8d82db567a52 100644 --- a/Makefile +++ b/Makefile @@ -215,6 +215,8 @@ LIBTRACEEVENT_LDLAGS = -L$(LIBTRACEEVENT_DIR) -ltraceevent LIBTRACEEVENT_STATIC_BUILD = $(LIBTRACEEVENT_STATIC) endif +export LIBTRACEEVENT_CFLAGS LIBTRACEEVENT_LDLAGS + ifeq ($(shell sh -c "pkg-config --cflags $(LIBTRACEFS) > /dev/null 2>&1 && echo y"), y) LIBTRACEFS_CFLAGS = $(shell sh -c "pkg-config --cflags $(LIBTRACEFS)") LIBTRACEFS_LDLAGS = $(shell sh -c "pkg-config --libs $(LIBTRACEFS)") @@ -224,6 +226,7 @@ LIBTRACEFS_LDLAGS = -L$(LIBTRACEFS_DIR) -ltracefs LIBTRACEFS_STATIC_BUILD = $(LIBTRACEFS_STATIC) endif +export LIBTRACEFS_CFLAGS LIBTRACEFS_LDLAGS TRACE_LIBS = -L$(LIBTRACECMD_DIR) -ltracecmd \ $(LIBTRACEEVENT_LDLAGS) $(LIBTRACEFS_LDLAGS) @@ -358,7 +361,7 @@ libtracefs.so: $(LIBTRACEFS_SHARED) libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) $(LIBTRACEFS_SHARED) -test: force $(LIBTRACEEVENT_STATIC) $(LIBTRACEFS_STATIC) $(LIBTRACECMD_STATIC) +test: force $(LIBTRACEEVENT_STATIC_BUILD) $(LIBTRACEFS_STATIC_BUILD) $(LIBTRACECMD_STATIC) ifneq ($(CUNIT_INSTALLED),1) $(error CUnit framework not installed, cannot build unit tests)) endif diff --git a/utest/Makefile b/utest/Makefile index d635650d46e1..55828abb59e3 100644 --- a/utest/Makefile +++ b/utest/Makefile @@ -9,9 +9,7 @@ OBJS = OBJS += trace-utest.o OBJS += tracefs-utest.o -LIBS += -lcunit \ - -L$(LIBTRACEFS_DIR) -ltracefs \ - -L$(LIBTRACEEVENT_DIR) -ltraceevent +LIBS += -lcunit $(LIBTRACEEVENT_LDLAGS) $(LIBTRACEFS_LDLAGS) OBJS := $(OBJS:%.o=$(bdir)/%.o) DEPS := $(OBJS:$(bdir)/%.o=$(bdir)/.%.d) -- 2.29.2