diff mbox series

trace-cmd: Add compile time overrides for libraries

Message ID 20220826225904.1824344-1-warthog9@eaglescrag.net (mailing list archive)
State Accepted
Commit e512b22d64c2ec627fa0a58b3da10e126f252842
Headers show
Series trace-cmd: Add compile time overrides for libraries | expand

Commit Message

John 'Warthog9' Hawley Aug. 26, 2022, 10:59 p.m. UTC
Continuing in the ld.lld link issues trace-cmd needs to override
-lrt -lpthread and -ldl.  This adds the ability, from the command line,
adjust LIBS, LRT and LPTHREAD

Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
---
 Makefile               | 2 +-
 lib/trace-cmd/Makefile | 4 +++-
 tracecmd/Makefile      | 5 ++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

Comments

Steven Rostedt Sept. 22, 2022, 1:47 a.m. UTC | #1
On Fri, 26 Aug 2022 15:59:04 -0700
John 'Warthog9' Hawley <warthog9@eaglescrag.net> wrote:

> Continuing in the ld.lld link issues trace-cmd needs to override
> -lrt -lpthread and -ldl.  This adds the ability, from the command line,
> adjust LIBS, LRT and LPTHREAD
> 
> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
> ---

Applied. Thanks John!

-- Steve
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 7178d7a9..92ba4ba4 100644
--- a/Makefile
+++ b/Makefile
@@ -216,7 +216,7 @@  export pkgconfig_dir PKG_CONFIG_FILE
 
 export prefix bindir src obj
 
-LIBS = -ldl
+LIBS ?= -ldl
 
 LIBTRACECMD_DIR = $(obj)/lib/trace-cmd
 LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 81cde3de..28b4afc6 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -52,7 +52,9 @@  $(DEPS): | $(bdir)
 $(LIBTRACECMD_STATIC): $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
-LIBS = $(LIBTRACEEVENT_LDLAGS) $(LIBTRACEFS_LDLAGS) $(ZLIB_LDLAGS) $(LIBZSTD_LDLAGS) -lpthread
+LPTHREAD ?= -lpthread
+
+LIBS = $(LIBTRACEEVENT_LDLAGS) $(LIBTRACEFS_LDLAGS) $(ZLIB_LDLAGS) $(LIBZSTD_LDLAGS) $(LPTHREAD)
 
 $(LIBTRACECMD_SHARED_VERSION): $(LIBTRACECMD_SHARED)
 	@ln -sf $(<F) $@
diff --git a/tracecmd/Makefile b/tracecmd/Makefile
index 8207c54b..66387526 100644
--- a/tracecmd/Makefile
+++ b/tracecmd/Makefile
@@ -49,8 +49,11 @@  ALL_OBJS := $(TRACE_CMD_OBJS:%.o=$(bdir)/%.o)
 all_objs := $(sort $(ALL_OBJS))
 all_deps := $(all_objs:$(bdir)/%.o=$(bdir)/.%.d)
 
+LPTHREAD ?= -lpthread
+LRT ?= -lrt
+
 CONFIG_INCLUDES =
-CONFIG_LIBS	= -lrt -lpthread $(TRACE_LIBS) $(ZLIB_LDLAGS) $(LIBZSTD_LDLAGS)
+CONFIG_LIBS	= $(LRT) $(LPTHREAD) $(TRACE_LIBS) $(ZLIB_LDLAGS) $(LIBZSTD_LDLAGS)
 CONFIG_FLAGS	=
 
 all: $(TARGETS)