diff mbox series

[08/13] trace-cmd: Install libtracecmd in the proper lib directory

Message ID 20201211171014.219970193@goodmis.org (mailing list archive)
State Accepted
Commit 758f7edb41eb7a6043fa11454b02bb78a289460e
Headers show
Series trace-cmd: Clean ups to the Makefile for using external libraries | expand

Commit Message

Steven Rostedt Dec. 11, 2020, 5:08 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Instead of installing libtracecmd library into its own directory under lib/,
where the dynamic linker ld has trouble finding it, use the appropriate lib
path (lib or lib64) to place libtracecmd.*

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 0c5da92b54b6..041bd79b5aec 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,14 @@  INSTALL = install
 DESTDIR ?=
 DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
 
+LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+ifeq ($(LP64), 1)
+  libdir_relative_temp = lib64
+else
+  libdir_relative_temp = lib
+endif
+
+libdir_relative ?= $(libdir_relative_temp)
 prefix ?= /usr/local
 bindir_relative = bin
 bindir = $(prefix)/$(bindir_relative)
@@ -57,7 +65,7 @@  html_install = $(prefix)/share/kernelshark/html
 html_install_SQ = '$(subst ','\'',$(html_install))'
 img_install = $(prefix)/share/kernelshark/html/images
 img_install_SQ = '$(subst ','\'',$(img_install))'
-libdir ?= $(prefix)/lib
+libdir = $(prefix)/$(libdir_relative)
 libdir_SQ = '$(subst ','\'',$(libdir))'
 includedir = $(prefix)/include
 includedir_SQ = '$(subst ','\'',$(includedir))'
@@ -473,7 +481,7 @@  install_tracefs: $(LIBTRACEFS_STATIC_BUILD)
 	$(Q)$(call do_install,$(src)/include/tracefs/tracefs.h,$(includedir_SQ)/tracefs)
 
 install_libs: libs $(INSTALL_TRACEEVENT) $(INSTALL_TRACEFS)
-	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)/trace-cmd)
+	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
 	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
 
 doc: