linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] libtracefs: Clean up of the source directory
@ 2020-12-08 21:54 Steven Rostedt
  2020-12-08 21:54 ` [PATCH 1/6] libtracefs: Move features.mk into scripts directory Steven Rostedt
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Steven Rostedt @ 2020-12-08 21:54 UTC (permalink / raw)
  To: linux-trace-devel

Steven Rostedt (VMware) (6):
      libtracefs: Move features.mk into scripts directory
      libtracefs: Remove LIBTRACEFS_DIR as it is the same as bdir
      libtracefs: Use LIBTRACEFS_STATIC/SHARED instead of open coding them
      libtracefs: Move source files to new src/ directory
      libtracefs: Use pkg-config to find libtraceevent
      libtracefs: Have make clean remove the .so.X file

----
 Makefile                                     | 54 +++++++++++-----------------
 features.mk => scripts/features.mk           |  0
 tracefs-events.c => src/tracefs-events.c     |  0
 tracefs-instance.c => src/tracefs-instance.c |  0
 tracefs-utils.c => src/tracefs-utils.c       |  0
 utest/Makefile                               |  2 +-
 6 files changed, 22 insertions(+), 34 deletions(-)
 rename features.mk => scripts/features.mk (100%)
 rename tracefs-events.c => src/tracefs-events.c (100%)
 rename tracefs-instance.c => src/tracefs-instance.c (100%)
 rename tracefs-utils.c => src/tracefs-utils.c (100%)

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

* [PATCH 1/6] libtracefs: Move features.mk into scripts directory
  2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
@ 2020-12-08 21:54 ` Steven Rostedt
  2020-12-08 21:54 ` [PATCH 2/6] libtracefs: Remove LIBTRACEFS_DIR as it is the same as bdir Steven Rostedt
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2020-12-08 21:54 UTC (permalink / raw)
  To: linux-trace-devel

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

In order to clean up the directory structure, move the features.mk into the
scripts directory. That's where the helper files for the Makefile should
live anyway.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile                           | 2 +-
 features.mk => scripts/features.mk | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename features.mk => scripts/features.mk (100%)

diff --git a/Makefile b/Makefile
index 284f8f2a17ab..e84b41408b54 100644
--- a/Makefile
+++ b/Makefile
@@ -142,7 +142,7 @@ include scripts/utils.mk
 INCLUDES = -I$(src)/include
 INCLUDES += -I$(src)/include/tracefs
 
-include $(src)/features.mk
+include $(src)/scripts/features.mk
 
 # Set compile option CFLAGS if not set elsewhere
 CFLAGS ?= -g -Wall
diff --git a/features.mk b/scripts/features.mk
similarity index 100%
rename from features.mk
rename to scripts/features.mk
-- 
2.28.0



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

* [PATCH 2/6] libtracefs: Remove LIBTRACEFS_DIR as it is the same as bdir
  2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
  2020-12-08 21:54 ` [PATCH 1/6] libtracefs: Move features.mk into scripts directory Steven Rostedt
@ 2020-12-08 21:54 ` Steven Rostedt
  2020-12-08 21:54 ` [PATCH 3/6] libtracefs: Use LIBTRACEFS_STATIC/SHARED instead of open coding them Steven Rostedt
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2020-12-08 21:54 UTC (permalink / raw)
  To: linux-trace-devel

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

Remove the variable LIBTRACEFS_DIR as it is simply bdir, and makes the
Makefile confusing. Simply use $(bdir) where $(LIBTRACEFS_DIR) is currently
used.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile       | 11 +++++------
 utest/Makefile |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index e84b41408b54..5aa2ba4b5145 100644
--- a/Makefile
+++ b/Makefile
@@ -123,16 +123,15 @@ src		:= $(srctree)
 obj		:= $(objtree)
 bdir		:= $(obj)/lib/tracefs
 
-export prefix bindir src obj
+export prefix bindir src obj bdir
 
-LIBTRACEFS_DIR = $(obj)/lib/tracefs
-LIBTRACEFS_STATIC = $(LIBTRACEFS_DIR)/libtracefs.a
-LIBTRACEFS_SHARED = $(LIBTRACEFS_DIR)/libtracefs.so.$(TRACEFS_VERSION)
+LIBTRACEFS_STATIC = $(bdir)/libtracefs.a
+LIBTRACEFS_SHARED = $(bdir)/libtracefs.so.$(TRACEFS_VERSION)
 
-TRACE_LIBS = -L$(LIBTRACEFS_DIR) -ltracefs
+TRACE_LIBS = -L$(bdir) -ltracefs
 
 export LIBS TRACE_LIBS
-export LIBTRACEFS_STATIC LIBTRACEFS_SHARED LIBTRACEFS_DIR
+export LIBTRACEFS_STATIC LIBTRACEFS_SHARED
 
 export Q SILENT VERBOSE EXT
 
diff --git a/utest/Makefile b/utest/Makefile
index a26d7a9a24af..9f96c4e397c1 100644
--- a/utest/Makefile
+++ b/utest/Makefile
@@ -11,7 +11,7 @@ OBJS += tracefs-utest.o
 
 LIBS += -lcunit				\
 	-ldl				\
-	-L$(LIBTRACEFS_DIR) -ltracefs
+	-L$(bdir) -ltracefs
 
 OBJS := $(OBJS:%.o=$(bdir)/%.o)
 DEPS := $(OBJS:$(bdir)/%.o=$(bdir)/.%.d)
-- 
2.28.0



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

* [PATCH 3/6] libtracefs: Use LIBTRACEFS_STATIC/SHARED instead of open coding them
  2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
  2020-12-08 21:54 ` [PATCH 1/6] libtracefs: Move features.mk into scripts directory Steven Rostedt
  2020-12-08 21:54 ` [PATCH 2/6] libtracefs: Remove LIBTRACEFS_DIR as it is the same as bdir Steven Rostedt
@ 2020-12-08 21:54 ` Steven Rostedt
  2020-12-08 21:54 ` [PATCH 4/6] libtracefs: Move source files to new src/ directory Steven Rostedt
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2020-12-08 21:54 UTC (permalink / raw)
  To: linux-trace-devel

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

The macros LIBTRACEFS_STATIC is defined as $(bdir)/libtracefs.a and
LIBTRACEFS_SHARED is defined as $(bdir)/libtracefs.so.$(TRACE_VERSION).
Instead of open coding them elsewhere in the file, simply use the defined
macros.

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 5aa2ba4b5145..5a250eeb03b1 100644
--- a/Makefile
+++ b/Makefile
@@ -252,7 +252,7 @@ force:
 # information in a variable so we can use it in if_changed and friends.
 .PHONY: $(PHONY)
 
-DEFAULT_TARGET = $(bdir)/libtracefs.a
+DEFAULT_TARGET = $(LIBTRACEFS_STATIC)
 
 OBJS =
 OBJS += tracefs-utils.o
@@ -272,10 +272,10 @@ $(DEPS): | $(bdir)
 
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
 
-$(bdir)/libtracefs.a: $(OBJS)
+$(LIBTRACEFS_STATIC): $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
-$(bdir)/libtracefs.so.$(TRACEFS_VERSION): $(OBJS)
+$(LIBTRACEFS_SHARED): $(OBJS)
 	$(Q)$(call do_compile_shared_library)
 	@ln -sf $(@F) $(bdir)/libtracefs.so
 	@ln -sf $(@F) $(bdir)/libtracefs.so.$(TFS_VERSION)
-- 
2.28.0



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

* [PATCH 4/6] libtracefs: Move source files to new src/ directory
  2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
                   ` (2 preceding siblings ...)
  2020-12-08 21:54 ` [PATCH 3/6] libtracefs: Use LIBTRACEFS_STATIC/SHARED instead of open coding them Steven Rostedt
@ 2020-12-08 21:54 ` Steven Rostedt
  2020-12-08 21:54 ` [PATCH 5/6] libtracefs: Use pkg-config to find libtraceevent Steven Rostedt
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2020-12-08 21:54 UTC (permalink / raw)
  To: linux-trace-devel

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

In cleaning up the directory structure, move the C files into their own
"src/" directory.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile                                     | 28 ++++----------------
 tracefs-events.c => src/tracefs-events.c     |  0
 tracefs-instance.c => src/tracefs-instance.c |  0
 tracefs-utils.c => src/tracefs-utils.c       |  0
 4 files changed, 5 insertions(+), 23 deletions(-)
 rename tracefs-events.c => src/tracefs-events.c (100%)
 rename tracefs-instance.c => src/tracefs-instance.c (100%)
 rename tracefs-utils.c => src/tracefs-utils.c (100%)

diff --git a/Makefile b/Makefile
index 5a250eeb03b1..f6b6a9ede5c0 100644
--- a/Makefile
+++ b/Makefile
@@ -267,35 +267,17 @@ all: $(DEFAULT_TARGET)
 $(bdir):
 	@mkdir -p $(bdir)
 
-$(OBJS): | $(bdir)
-$(DEPS): | $(bdir)
-
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
 
-$(LIBTRACEFS_STATIC): $(OBJS)
-	$(Q)$(call do_build_static_lib)
-
-$(LIBTRACEFS_SHARED): $(OBJS)
-	$(Q)$(call do_compile_shared_library)
-	@ln -sf $(@F) $(bdir)/libtracefs.so
-	@ln -sf $(@F) $(bdir)/libtracefs.so.$(TFS_VERSION)
-
-$(bdir)/%.o: %.c
-	$(Q)$(call do_fpic_compile)
-
-$(DEPS): $(bdir)/.%.d: %.c
-	$(Q)$(CC) -M -MT $(bdir)/$*.o $(CPPFLAGS) $(CFLAGS) $< > $@
+$(LIBTRACEFS_STATIC): force
+	$(Q)$(MAKE) -C $(src)/src $@
 
-$(OBJS): $(bdir)/%.o : $(bdir)/.%.d
-
-dep_includes := $(wildcard $(DEPS))
-
-ifneq ($(dep_includes),)
-  include $(dep_includes)
-endif
+$(bdir)/libtracefs.so.$(TRACEFS_VERSION): force
+	$(Q)$(MAKE) -C $(src)/src $@
 
 clean:
 	$(MAKE) -C $(src)/utest clean
+	$(MAKE) -C $(src)/src clean
 	$(RM) $(TARGETS) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
 	$(RM) $(PKG_CONFIG_FILE)
 
diff --git a/tracefs-events.c b/src/tracefs-events.c
similarity index 100%
rename from tracefs-events.c
rename to src/tracefs-events.c
diff --git a/tracefs-instance.c b/src/tracefs-instance.c
similarity index 100%
rename from tracefs-instance.c
rename to src/tracefs-instance.c
diff --git a/tracefs-utils.c b/src/tracefs-utils.c
similarity index 100%
rename from tracefs-utils.c
rename to src/tracefs-utils.c
-- 
2.28.0



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

* [PATCH 5/6] libtracefs: Use pkg-config to find libtraceevent
  2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
                   ` (3 preceding siblings ...)
  2020-12-08 21:54 ` [PATCH 4/6] libtracefs: Move source files to new src/ directory Steven Rostedt
@ 2020-12-08 21:54 ` Steven Rostedt
  2020-12-08 21:54 ` [PATCH 6/6] libtracefs: Have make clean remove the .so.X file Steven Rostedt
  2020-12-09 14:49 ` [PATCH 0/6] libtracefs: Clean up of the source directory Tzvetomir Stoyanov
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2020-12-08 21:54 UTC (permalink / raw)
  To: linux-trace-devel

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

As libtracefs is dependent on libtraceevent, use the proper pkg-config
method to find where libtraceevent is installed.

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

diff --git a/Makefile b/Makefile
index f6b6a9ede5c0..be57682d37c9 100644
--- a/Makefile
+++ b/Makefile
@@ -62,6 +62,13 @@ pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) 		\
 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)
+
+ifeq ("$(LIBTRACEEVENT_INCLUDES)","")
+$(error libtraceevent.so not installed)
+endif
+
 ifeq ($(prefix),/usr/local)
 etcdir ?= /etc
 else
@@ -128,7 +135,7 @@ export prefix bindir src obj bdir
 LIBTRACEFS_STATIC = $(bdir)/libtracefs.a
 LIBTRACEFS_SHARED = $(bdir)/libtracefs.so.$(TRACEFS_VERSION)
 
-TRACE_LIBS = -L$(bdir) -ltracefs
+TRACE_LIBS = $(LIBTRACEEVENT_LIBS)
 
 export LIBS TRACE_LIBS
 export LIBTRACEFS_STATIC LIBTRACEFS_SHARED
@@ -155,7 +162,7 @@ export CFLAGS
 export INCLUDES
 
 # Required CFLAGS
-override CFLAGS += -D_GNU_SOURCE
+override CFLAGS += -D_GNU_SOURCE $(LIBTRACEEVENT_INCLUDES)
 
 # Append required CFLAGS
 override CFLAGS += $(INCLUDES)
-- 
2.28.0



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

* [PATCH 6/6] libtracefs: Have make clean remove the .so.X file
  2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
                   ` (4 preceding siblings ...)
  2020-12-08 21:54 ` [PATCH 5/6] libtracefs: Use pkg-config to find libtraceevent Steven Rostedt
@ 2020-12-08 21:54 ` Steven Rostedt
  2020-12-09 14:49 ` [PATCH 0/6] libtracefs: Clean up of the source directory Tzvetomir Stoyanov
  6 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2020-12-08 21:54 UTC (permalink / raw)
  To: linux-trace-devel

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

"make clean" was leaving behind libtracefs.so.0, in the lib/tracefs
directory. Add $(bdir)/*.so.* to the remove line to catch these files as
well.

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

diff --git a/Makefile b/Makefile
index be57682d37c9..5d11abc82e6a 100644
--- a/Makefile
+++ b/Makefile
@@ -285,7 +285,7 @@ $(bdir)/libtracefs.so.$(TRACEFS_VERSION): force
 clean:
 	$(MAKE) -C $(src)/utest clean
 	$(MAKE) -C $(src)/src clean
-	$(RM) $(TARGETS) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
+	$(RM) $(TARGETS) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.so.* $(bdir)/*.o $(bdir)/.*.d
 	$(RM) $(PKG_CONFIG_FILE)
 
 .PHONY: clean
-- 
2.28.0



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

* Re: [PATCH 0/6] libtracefs: Clean up of the source directory
  2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
                   ` (5 preceding siblings ...)
  2020-12-08 21:54 ` [PATCH 6/6] libtracefs: Have make clean remove the .so.X file Steven Rostedt
@ 2020-12-09 14:49 ` Tzvetomir Stoyanov
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov @ 2020-12-09 14:49 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Linux Trace Devel

On Tue, Dec 8, 2020 at 11:57 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Steven Rostedt (VMware) (6):
>       libtracefs: Move features.mk into scripts directory
>       libtracefs: Remove LIBTRACEFS_DIR as it is the same as bdir
>       libtracefs: Use LIBTRACEFS_STATIC/SHARED instead of open coding them
>       libtracefs: Move source files to new src/ directory
>       libtracefs: Use pkg-config to find libtraceevent
>       libtracefs: Have make clean remove the .so.X file
>

The changes look good to me.
Acked-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
> ----
>  Makefile                                     | 54 +++++++++++-----------------
>  features.mk => scripts/features.mk           |  0
>  tracefs-events.c => src/tracefs-events.c     |  0
>  tracefs-instance.c => src/tracefs-instance.c |  0
>  tracefs-utils.c => src/tracefs-utils.c       |  0
>  utest/Makefile                               |  2 +-
>  6 files changed, 22 insertions(+), 34 deletions(-)
>  rename features.mk => scripts/features.mk (100%)
>  rename tracefs-events.c => src/tracefs-events.c (100%)
>  rename tracefs-instance.c => src/tracefs-instance.c (100%)
>  rename tracefs-utils.c => src/tracefs-utils.c (100%)



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

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

end of thread, other threads:[~2020-12-09 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 21:54 [PATCH 0/6] libtracefs: Clean up of the source directory Steven Rostedt
2020-12-08 21:54 ` [PATCH 1/6] libtracefs: Move features.mk into scripts directory Steven Rostedt
2020-12-08 21:54 ` [PATCH 2/6] libtracefs: Remove LIBTRACEFS_DIR as it is the same as bdir Steven Rostedt
2020-12-08 21:54 ` [PATCH 3/6] libtracefs: Use LIBTRACEFS_STATIC/SHARED instead of open coding them Steven Rostedt
2020-12-08 21:54 ` [PATCH 4/6] libtracefs: Move source files to new src/ directory Steven Rostedt
2020-12-08 21:54 ` [PATCH 5/6] libtracefs: Use pkg-config to find libtraceevent Steven Rostedt
2020-12-08 21:54 ` [PATCH 6/6] libtracefs: Have make clean remove the .so.X file Steven Rostedt
2020-12-09 14:49 ` [PATCH 0/6] libtracefs: Clean up of the source directory Tzvetomir Stoyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).