From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- 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