Skip to contentSkip to conversation

libtracefs: Fix soft links to have a proper order

PATCH New Steven Rostedt 1 participant 1 message Dec 11, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Fix soft links to have a proper order

From: "Steven Rostedt (VMware)" <[email protected]>

Currently the libraries created have both the .so and the .so.X soft links pointing to the full verision .so.X.Y.Z. It's better to have them point serially instead of directly, as it is more common and also makes it easier to change the .so to point to a different .so.X if needed.

Now the links will be:

.so -> .so.X
.so.X -> .so.X.Y.Z

Also clean up the dependencies a little in the Makefile.

---
 Makefile     |  2 +-
 src/Makefile | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
Makefile +1 -1
index 035f4de..b4d0a72 100644
@@ -293,7 +293,7 @@ $(LIBTRACEFS_STATIC): force
 
 $(bdir)/libtracefs.so.$(TRACEFS_VERSION): force
 	$(Q)mkdir -p $(bdir)
-	$(Q)$(MAKE) -C $(src)/src $@
+	$(Q)$(MAKE) -C $(src)/src libtracefs.so
 
 clean:
 	$(MAKE) -C $(src)/utest clean
src/Makefile +11 -2
index 1b06655..52f17af 100644
@@ -10,13 +10,22 @@ OBJS += tracefs-events.o
 OBJS := $(OBJS:%.o=$(bdir)/%.o)
 DEPS := $(OBJS:$(bdir)/%.o=$(bdir)/.%.d)
 
+LIBTRACEFS_SHARED_SO = $(bdir)/libtracefs.so
+LIBTRACEFS_SHARED_VERSION = $(bdir)/libtracefs.so.$(TFS_VERSION)
+
 $(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)
+
+$(LIBTRACEFS_SHARED_VERSION): $(LIBTRACEFS_SHARED)
+	@ln -sf $(<F) $@
+
+$(LIBTRACEFS_SHARED_SO): $(LIBTRACEFS_SHARED_VERSION)
+	@ln -sf $(<F) $@
+
+libtracefs.so: $(LIBTRACEFS_SHARED_SO)
 
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
Signature · 1 line
2.25.4