All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier
@ 2020-12-16 20:11 Steven Rostedt
  2020-12-16 20:11 ` [PATCH 1/8] libtracefs: Clean up tracefs.h Steven Rostedt
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel


Steven Rostedt (VMware) (8):
      libtracefs: Clean up tracefs.h
      libtracefs: Use $(objtree) instead of $(OUTPUT) for ld.so test
      libtracefs: Do not hardcode location of libtraceevent
      libtracefs: Use $(obj) instead of $(OUTPUT) for libtracefs.pc file
      libtracefs: Allow the pkg-config libs and cflags prefix to be overwritten
      libtracefs: Remove unneccessary TRACE_LIBS variable
      libtracefs: Have only one definition of overriding CFLAGS
      libtracefs: Add -rpath to libtracefs.so

----
 Makefile               | 30 +++++++++++++-----------------
 include/tracefs.h      |  4 ++--
 libtracefs.pc.template |  4 ++--
 scripts/utils.mk       |  2 +-
 4 files changed, 18 insertions(+), 22 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/8] libtracefs: Clean up tracefs.h
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  2020-12-16 20:11 ` [PATCH 2/8] libtracefs: Use $(objtree) instead of $(OUTPUT) for ld.so test Steven Rostedt
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Fix a typo, and use <traceevent/event-parse.h> instead of
"traceevent/event-parse.h" for the include name.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/tracefs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/tracefs.h b/include/tracefs.h
index ce8b09ca5bd0..5cbe8982d1bc 100644
--- a/include/tracefs.h
+++ b/include/tracefs.h
@@ -6,8 +6,8 @@
 #ifndef _TRACE_FS_H
 #define _TRACE_FS_H
 
+#include <traceevent/event-parse.h>
 #include <sched.h>
-#include "traceevent/event-parse.h"
 
 char *tracefs_get_tracing_file(const char *name);
 void tracefs_put_tracing_file(char *name);
@@ -18,7 +18,7 @@ const char *tracefs_get_tracing_dir(void);
 /* tracefs_find_tracing_dir must be freed */
 char *tracefs_find_tracing_dir(void);
 
-/* ftarce instances */
+/* ftrace instances */
 struct tracefs_instance;
 
 void tracefs_instance_free(struct tracefs_instance *instance);
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/8] libtracefs: Use $(objtree) instead of $(OUTPUT) for ld.so test
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
  2020-12-16 20:11 ` [PATCH 1/8] libtracefs: Clean up tracefs.h Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  2020-12-16 20:11 ` [PATCH 3/8] libtracefs: Do not hardcode location of libtraceevent Steven Rostedt
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Use the variable $(objtree) to build the test program in the O=path
directory, as there is no $(OUTPUT) variable defined.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index a7d58081bf4b..f675d5e60db1 100644
--- a/Makefile
+++ b/Makefile
@@ -224,14 +224,14 @@ ifeq ("$(DESTDIR)", "")
 define install_ld_config
 	$(LDCONFIG); \
 	if ! grep "^$(libdir)$$" $(LD_SO_CONF_PATH)/* &> /dev/null ; then \
-		$(CC) -o $(OUTPUT)test $(srctree)/test.c -I $(includedir_SQ) \
+		$(CC) -o $(objtree)/test $(srctree)/test.c -I $(includedir_SQ) \
 			-L $(libdir_SQ) -ltracefs &> /dev/null; \
-		if ! $(OUTPUT)test &> /dev/null; then \
+		if ! $(objtree)/test &> /dev/null; then \
 			$(call print_install, trace.conf, $(LD_SO_CONF_PATH)) \
 			echo $(libdir_SQ) >> $(LD_SO_CONF_PATH)/trace.conf; \
 			$(LDCONFIG); \
 		fi; \
-		$(RM) $(OUTPUT)test; \
+		$(RM) $(objtree)/test; \
 	fi
 endef
 else
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/8] libtracefs: Do not hardcode location of libtraceevent
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
  2020-12-16 20:11 ` [PATCH 1/8] libtracefs: Clean up tracefs.h Steven Rostedt
  2020-12-16 20:11 ` [PATCH 2/8] libtracefs: Use $(objtree) instead of $(OUTPUT) for ld.so test Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  2020-12-16 20:11 ` [PATCH 4/8] libtracefs: Use $(obj) instead of $(OUTPUT) for libtracefs.pc file Steven Rostedt
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The Makefile has LIBS = -L$(obj)/lib/traceevent, which can be incorrect and
should not be used. Remove it.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Makefile b/Makefile
index f675d5e60db1..dec05e3e3a6a 100644
--- a/Makefile
+++ b/Makefile
@@ -312,8 +312,6 @@ all: $(DEFAULT_TARGET)
 $(bdir):
 	@mkdir -p $(bdir)
 
-LIBS = -L$(obj)/lib/traceevent -ltraceevent
-
 $(LIBTRACEFS_STATIC): force
 	$(Q)mkdir -p $(bdir)
 	$(Q)$(MAKE) -C $(src)/src $@
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/8] libtracefs: Use $(obj) instead of $(OUTPUT) for libtracefs.pc file
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
                   ` (2 preceding siblings ...)
  2020-12-16 20:11 ` [PATCH 3/8] libtracefs: Do not hardcode location of libtraceevent Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  2020-12-16 20:11 ` [PATCH 5/8] libtracefs: Allow the pkg-config libs and cflags prefix to be overwritten Steven Rostedt
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The location of libtracefs.pc was incorrectly using $(OUTPUT) which does not
even exist, where it should have been using $(obj) instead.

Also need to move the variable declarations down below where $(obj) is
defined.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index dec05e3e3a6a..ab64ef3e4f54 100644
--- a/Makefile
+++ b/Makefile
@@ -61,9 +61,6 @@ includedir_SQ = '$(subst ','\'',$(includedir))'
 pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) 		\
 			--variable pc_path pkg-config | tr ":" " "))
 
-PKG_CONFIG_SOURCE_FILE = libtracefs.pc
-PKG_CONFIG_FILE := $(addprefix $(OUTPUT),$(PKG_CONFIG_SOURCE_FILE))
-
 LIBTRACEEVENT_INCLUDES = $(shell $(PKG_CONFIG) --cflags libtraceevent)
 LIBTRACEEVENT_LIBS = $(shell $(PKG_CONFIG) --libs libtraceevent)
 
@@ -133,6 +130,9 @@ LIBTRACEFS_SHARED = $(bdir)/libtracefs.so.$(TRACEFS_VERSION)
 
 TRACE_LIBS = $(LIBTRACEEVENT_LIBS)
 
+PKG_CONFIG_SOURCE_FILE = libtracefs.pc
+PKG_CONFIG_FILE := $(addprefix $(obj)/,$(PKG_CONFIG_SOURCE_FILE))
+
 export LIBS TRACE_LIBS
 export LIBTRACEFS_STATIC LIBTRACEFS_SHARED
 
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/8] libtracefs: Allow the pkg-config libs and cflags prefix to be overwritten
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
                   ` (3 preceding siblings ...)
  2020-12-16 20:11 ` [PATCH 4/8] libtracefs: Use $(obj) instead of $(OUTPUT) for libtracefs.pc file Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  2020-12-16 20:11 ` [PATCH 6/8] libtracefs: Remove unneccessary TRACE_LIBS variable Steven Rostedt
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

In case libtracecmd needs to be built in a destination directory where
libtracefs will be located, and not on the host machine, it will need a
way to override the location of the include and library directories.
Facilitate this by having them use the ${prefix} variable.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile               | 7 ++++---
 libtracefs.pc.template | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index ab64ef3e4f54..142b824ca421 100644
--- a/Makefile
+++ b/Makefile
@@ -56,7 +56,8 @@ man_dir = $(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
 libdir = $(prefix)/$(libdir_relative)
 libdir_SQ = '$(subst ','\'',$(libdir))'
-includedir = $(prefix)/include/tracefs
+includedir_relative ?= include/tracefs
+includedir = $(prefix)/$(includedir_relative)
 includedir_SQ = '$(subst ','\'',$(includedir))'
 pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) 		\
 			--variable pc_path pkg-config | tr ":" " "))
@@ -193,8 +194,8 @@ define do_make_pkgconfig_file
 	cp -f ${PKG_CONFIG_SOURCE_FILE}.template ${PKG_CONFIG_FILE};	\
 	sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
 	sed -i "s|LIB_VERSION|${TRACEFS_VERSION}|g" ${PKG_CONFIG_FILE}; \
-	sed -i "s|LIB_DIR|${libdir}|g" ${PKG_CONFIG_FILE}; \
-	sed -i "s|HEADER_DIR|$(includedir)|g" ${PKG_CONFIG_FILE};
+	sed -i "s|LIB_DIR|${libdir_relative}|g" ${PKG_CONFIG_FILE}; \
+	sed -i "s|HEADER_DIR|$(includedir_relative)|g" ${PKG_CONFIG_FILE};
 endef
 
 BUILD_PREFIX := $(BUILD_OUTPUT)/build_prefix
diff --git a/libtracefs.pc.template b/libtracefs.pc.template
index 5e7d54a4456c..a674fee24007 100644
--- a/libtracefs.pc.template
+++ b/libtracefs.pc.template
@@ -1,6 +1,6 @@
 prefix=INSTALL_PREFIX
-libdir=LIB_DIR
-includedir=HEADER_DIR
+libdir=${prefix}/LIB_DIR
+includedir=${prefix}/HEADER_DIR
 
 Name: libtracefs
 URL: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/8] libtracefs: Remove unneccessary TRACE_LIBS variable
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
                   ` (4 preceding siblings ...)
  2020-12-16 20:11 ` [PATCH 5/8] libtracefs: Allow the pkg-config libs and cflags prefix to be overwritten Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  2020-12-16 20:11 ` [PATCH 7/8] libtracefs: Have only one definition of overriding CFLAGS Steven Rostedt
  2020-12-16 20:11 ` [PATCH 8/8] libtracefs: Add -rpath to libtracefs.so Steven Rostedt
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The TRACE_LIBS variable in the Makefile is not not used anywhere. Simply
have LIBS equal LIBTRACEEVENT_LIBS, and export LIBS instead.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 142b824ca421..a8b888958614 100644
--- a/Makefile
+++ b/Makefile
@@ -129,12 +129,12 @@ export prefix bindir src obj bdir
 LIBTRACEFS_STATIC = $(bdir)/libtracefs.a
 LIBTRACEFS_SHARED = $(bdir)/libtracefs.so.$(TRACEFS_VERSION)
 
-TRACE_LIBS = $(LIBTRACEEVENT_LIBS)
-
 PKG_CONFIG_SOURCE_FILE = libtracefs.pc
 PKG_CONFIG_FILE := $(addprefix $(obj)/,$(PKG_CONFIG_SOURCE_FILE))
 
-export LIBS TRACE_LIBS
+LIBS = $(LIBTRACEEVENT_LIBS)
+
+export LIBS
 export LIBTRACEFS_STATIC LIBTRACEFS_SHARED
 
 export Q SILENT VERBOSE EXT
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/8] libtracefs: Have only one definition of overriding CFLAGS
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
                   ` (5 preceding siblings ...)
  2020-12-16 20:11 ` [PATCH 6/8] libtracefs: Remove unneccessary TRACE_LIBS variable Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  2020-12-16 20:11 ` [PATCH 8/8] libtracefs: Add -rpath to libtracefs.so Steven Rostedt
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

For some reason, there's two places CFLAGS gets overridden. There only needs
to be one. Consolidate them.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index a8b888958614..47ac4f5e8c8c 100644
--- a/Makefile
+++ b/Makefile
@@ -158,11 +158,8 @@ export CUNIT_INSTALLED
 export CFLAGS
 export INCLUDES
 
-# Required CFLAGS
-override CFLAGS += -D_GNU_SOURCE $(LIBTRACEEVENT_INCLUDES)
-
 # Append required CFLAGS
-override CFLAGS += $(INCLUDES)
+override CFLAGS += -D_GNU_SOURCE $(LIBTRACEEVENT_INCLUDES) $(INCLUDES)
 
 all: all_cmd
 
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 8/8] libtracefs: Add -rpath to libtracefs.so
  2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
                   ` (6 preceding siblings ...)
  2020-12-16 20:11 ` [PATCH 7/8] libtracefs: Have only one definition of overriding CFLAGS Steven Rostedt
@ 2020-12-16 20:11 ` Steven Rostedt
  7 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2020-12-16 20:11 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Pass in "-rpath=$ORIGIN" to the linker when building libtracefs.so, such
that the path for libtraceevent.so might be found if it is installed in the
same location as libtracefs.

Suggested-by: Yordan Karadzhov <ykaradzhov@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 scripts/utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/utils.mk b/scripts/utils.mk
index 0d3c3194f6c5..7742e1981cef 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -56,7 +56,7 @@ do_build_static_lib =				\
 
 do_compile_shared_library =			\
 	($(print_shared_lib_compile)		\
-	$(CC) --shared $^ -Wl,-soname,$(@F) -o $@ $(LIBS))
+	$(CC) --shared $^ '-Wl,-soname,$(@F),-rpath=$$ORIGIN' -o $@ $(LIBS))
 
 do_compile_plugin_obj =				\
 	($(print_plugin_obj_compile)		\
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-12-16 20:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 20:11 [PATCH 0/8] libtracefs: More Makefile updates to make packaging the library easier Steven Rostedt
2020-12-16 20:11 ` [PATCH 1/8] libtracefs: Clean up tracefs.h Steven Rostedt
2020-12-16 20:11 ` [PATCH 2/8] libtracefs: Use $(objtree) instead of $(OUTPUT) for ld.so test Steven Rostedt
2020-12-16 20:11 ` [PATCH 3/8] libtracefs: Do not hardcode location of libtraceevent Steven Rostedt
2020-12-16 20:11 ` [PATCH 4/8] libtracefs: Use $(obj) instead of $(OUTPUT) for libtracefs.pc file Steven Rostedt
2020-12-16 20:11 ` [PATCH 5/8] libtracefs: Allow the pkg-config libs and cflags prefix to be overwritten Steven Rostedt
2020-12-16 20:11 ` [PATCH 6/8] libtracefs: Remove unneccessary TRACE_LIBS variable Steven Rostedt
2020-12-16 20:11 ` [PATCH 7/8] libtracefs: Have only one definition of overriding CFLAGS Steven Rostedt
2020-12-16 20:11 ` [PATCH 8/8] libtracefs: Add -rpath to libtracefs.so Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.