All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 04/13] trace-cmd: Add versioning to libtracecmd.so
Date: Fri, 11 Dec 2020 12:08:46 -0500	[thread overview]
Message-ID: <20201211171013.568512006@goodmis.org> (raw)
In-Reply-To: 20201211170842.611554918@goodmis.org

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

In preparation to installing libtracecmd.so as a system library, it is
required that it has a versioning in the name. Add three levels:

 LIBTC_VERSION : The main version level that is updated on breakage of apiS
 LIBTC_PATCHLEVEL: That is updated for new functionality
 LIBTC_EXTRAVERSION: That is updated for minor bug fixes

The main .so binary will have the full version which includes:

 libtracecmd.so.$(LIBTC_VERSION).$(LIBTC_PATCHLEVEL).$(LIBTC_EXTRAVERSION)

Then soft links will be created to this as follows:

 libtracecmd.so -> libtracecmd.so.$(LIBTC_VERSION)
 libtracecmd.so.$(LIBTC_VERSION) ->
      libtracecmd.so.$(LIBTC_VERSION).$(LIBTC_PATCHLEVEL).$(LIBTC_EXTRAVERSION)

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile               | 14 ++++++++++++--
 lib/trace-cmd/Makefile | 19 +++++++++++++++++--
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 8edd217b87b5..ea07e9ee7081 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,16 @@ export TC_PATCHLEVEL
 export TC_EXTRAVERSION
 export TRACECMD_VERSION
 
+LIBTC_VERSION = 0
+LIBTC_PATCHLEVEL = 0
+LIBTC_EXTRAVERSION = 1
+LIBTRACECMD_VERSION = $(LIBTC_VERSION).$(LIBTC_PATCHLEVEL).$(LIBTC_EXTRAVERSION)
+
+export LIBTC_VERSION
+export LIBTC_PATCHLEVEL
+export LIBTC_EXTRAVERSION
+export LIBTRACECMD_VERSION
+
 MAKEFLAGS += --no-print-directory
 
 # Makefiles suck: This macro sets a default value of $(2) for the
@@ -200,7 +210,7 @@ LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so
 
 LIBTRACECMD_DIR = $(obj)/lib/trace-cmd
 LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a
-LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so
+LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so.$(LIBTRACECMD_VERSION)
 
 LIBTRACEFS=libtracefs
 LIBTRACEFS_DIR = $(obj)/lib/tracefs
@@ -347,7 +357,7 @@ $(LIBTRACECMD_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
 
 $(LIBTRACECMD_SHARED): force $(LIBTRACEEVENT_SHARED_BUILD)
-	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
+	$(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so
 
 $(LIBTRACEFS_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/tracefs $@
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 42f1f5c447eb..ec68831de610 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -40,7 +40,19 @@ $(LIBTRACECMD_STATIC): $(OBJS)
 
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
 
-$(bdir)/libtracecmd.so: $(OBJS)
+LIBTRACECMD_SHARED_VERSION = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
+
+LIBTRACECMD_SHARED_SO = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
+
+$(LIBTRACECMD_SHARED_VERSION): $(LIBTRACECMD_SHARED)
+	@ln -sf $(<F) $@
+
+$(LIBTRACECMD_SHARED_SO): $(LIBTRACECMD_SHARED_VERSION)
+	@ln -sf $(<F) $@
+
+libtracecmd.so: force $(LIBTRACECMD_SHARED_SO)
+
+$(LIBTRACECMD_SHARED): $(OBJS)
 	$(Q)$(call do_compile_shared_library)
 
 $(bdir)/%.o: %.c
@@ -58,6 +70,9 @@ ifneq ($(dep_includes),)
 endif
 
 clean:
-	$(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
+	$(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.so.* $(bdir)/*.o $(bdir)/.*.d
 
 .PHONY: clean
+
+PHONY += force
+force:
-- 
2.29.2



  parent reply	other threads:[~2020-12-11 18:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
2020-12-11 17:08 ` [PATCH 01/13] trace-cmd: Add missing SPDX headers Steven Rostedt
2020-12-11 17:08 ` [PATCH 02/13] trace-cmd: Allow overriding of pkg-config Steven Rostedt
2020-12-11 17:08 ` [PATCH 03/13] trace-cmd: Use $(LIBTRACECMD_STATIC) instead of open coding in Makefile Steven Rostedt
2020-12-11 17:08 ` Steven Rostedt [this message]
2020-12-11 17:08 ` [PATCH 05/13] trace-cmd: Add pkg-config configuration for libtracecmd.so Steven Rostedt
2020-12-11 17:08 ` [PATCH 06/13] trace-cmd: Clean up the Makefiles a little Steven Rostedt
2020-12-11 17:08 ` [PATCH 07/13] trace-cmd: Remove making of ld.so.conf.d/trace.conf Steven Rostedt
2020-12-11 17:08 ` [PATCH 08/13] trace-cmd: Install libtracecmd in the proper lib directory Steven Rostedt
2020-12-11 17:08 ` [PATCH 09/13] trace-cmd: Move the installing of libtracecmd to the lib/trace-cmd Makefile Steven Rostedt
2020-12-11 17:08 ` [PATCH 10/13] trace-cmd: Install the soft links for libtracecmd.so Steven Rostedt
2020-12-11 17:08 ` [PATCH 11/13] trace-cmd: Do not install libtracefs nor libtraceevent libraries Steven Rostedt
2020-12-11 17:08 ` [PATCH 12/13] trace-cmd: Do not build shared libraries for libtracefs and libtraceevent Steven Rostedt
2020-12-11 17:08 ` [PATCH 13/13] trace-cmd: Add warning if libtracefs or libtraceevent are not found Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201211171013.568512006@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.