Skip to contentSkip to conversation

libtraceevent: Some Makefile updates

PATCH In review Steven Rostedt 2 participants 6 messages Nov 23, 2020 – Nov 24, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

cover libtraceevent: Some Makefile updates

Fixed the links in installing the library, as well as removing the temporary file of libtraceveent.pc that is created by root doing an install.

Steven Rostedt (VMware) (2):
libtraceevent: Add libtraceevent.so.$(EP_VERSION) to targets and fix links
libtracevent: Remove tempfile libtraceevent.pc

----

 Makefile | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
#1 lore raw

PATCH 1/2 libtraceevent: Add libtraceevent.so.$(EP_VERSION) to targets and fix links

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

"make clean" left a broken symbolic link of libtraceevent.so.1 around, because the clean target removes $(TARGET) and *.so, where $(TARGET) removes the so that libtraceevent.so.1 points to, and *.so removes the symbolic link that points to libtraceevent.so.1. But nothing removes libtraceevent.so.1.

Add both libtraceevent.so and libtraceevent.so.<major_version> to the LIB_TARGETS variable (for cleaning them up), and also to fix the links, as before it was:

libtraceevent.so -> libtraceevent.so.1.1.0
libtraceveent.so.1 -> libtraceveent.so.1.1.0

Where it should be a cascade of:

libtraceevent.so -> libtraceevent.so.1
libtraceevent.so.1 -> libtraceevent.so.1.1.0

---
 Makefile | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Makefile +7 -3
index 9e2b428760a4..2a6bfcce814f 100644
@@ -91,7 +91,7 @@ N		=
 
 EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION)
 
-LIB_TARGET  = libtraceevent.a libtraceevent.so.$(EVENT_PARSE_VERSION)
+LIB_TARGET  = libtraceevent.a libtraceevent.so libtraceevent.so.$(EP_VERSION) libtraceevent.so.$(EVENT_PARSE_VERSION)
 LIB_INSTALL = libtraceevent.a libtraceevent.so*
 LIB_INSTALL := $(addprefix $(OUTPUT),$(LIB_INSTALL))
 
@@ -139,8 +139,12 @@ $(TE_IN): force
 
 $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
 	$(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
-	@ln -sf $(@F) $(OUTPUT)libtraceevent.so
-	@ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
+
+$(OUTPUT)libtraceevent.so: $(OUTPUT)libtraceevent.so.$(EP_VERSION)
+	@ln -sf $(<F) $@
+
+$(OUTPUT)libtraceevent.so.$(EP_VERSION): $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION)
+	@ln -sf $(<F) $@
 
 $(OUTPUT)libtraceevent.a: $(TE_IN)
 	$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
Signature · 1 line
2.28.0
#3 lore raw

PATCH 2/2 libtracevent: Remove tempfile libtraceevent.pc

In reply to Steven Rostedt

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

"make install" copies libtraceevent.pc.template to libtraceevent.pc and then modifies it for the installation. This command is usually executed as root, and when finished, it leaves behind the libtraceevent.pc file owned by root.

Have the "make install" clean up and remove the temporary libtraceevent.pc file, so that root owned files do not get left behind.

---
 Makefile | 1 +
 1 file changed, 1 insertion(+)
Makefile +1 -0
index 2a6bfcce814f..775fbd2b3f0e 100644
@@ -218,6 +218,7 @@ define do_install_pkgconfig_file
 		sed -i "s|LIB_DIR|${libdir}|g" ${PKG_CONFIG_FILE}; \
 		sed -i "s|HEADER_DIR|$(includedir)|g" ${PKG_CONFIG_FILE}; \
 		$(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); 	\
+		${RM} ${PKG_CONFIG_FILE}; \
 	else 									\
 		(echo Failed to locate pkg-config directory) 1>&2;		\
 	fi
Signature · 1 line
2.28.0
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] libtraceevent: Add libtraceevent.so.$(EP_VERSION) to targets and fix links

In reply to Steven Rostedt
Quoted 54 lines · Steven Rostedt

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

"make clean" left a broken symbolic link of libtraceevent.so.1 around, because the clean target removes $(TARGET) and *.so, where $(TARGET) removes the so that libtraceevent.so.1 points to, and *.so removes the symbolic link that points to libtraceevent.so.1. But nothing removes libtraceevent.so.1.

Add both libtraceevent.so and libtraceevent.so.<major_version> to the LIB_TARGETS variable (for cleaning them up), and also to fix the links, as before it was:

libtraceevent.so -> libtraceevent.so.1.1.0
libtraceveent.so.1 -> libtraceveent.so.1.1.0

Where it should be a cascade of:

libtraceevent.so -> libtraceevent.so.1
libtraceevent.so.1 -> libtraceevent.so.1.1.0

---
 Makefile | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Makefile +7 -4
index 9e2b428760a4..2a6bfcce814f 100644
@@ -91,7 +91,7 @@ N             =
 
 EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION)
 
-LIB_TARGET  = libtraceevent.a libtraceevent.so.$(EVENT_PARSE_VERSION)
+LIB_TARGET  = libtraceevent.a libtraceevent.so libtraceevent.so.$(EP_VERSION) libtraceevent.so.$(EVENT_PARSE_VERSION)
 LIB_INSTALL = libtraceevent.a libtraceevent.so*
 LIB_INSTALL := $(addprefix $(OUTPUT),$(LIB_INSTALL))
 
@@ -139,8 +139,12 @@ $(TE_IN): force
 
 $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
        $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
-       @ln -sf $(@F) $(OUTPUT)libtraceevent.so
-       @ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
+
+$(OUTPUT)libtraceevent.so: $(OUTPUT)libtraceevent.so.$(EP_VERSION)
+       @ln -sf $(<F) $@
+
+$(OUTPUT)libtraceevent.so.$(EP_VERSION): $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION)
+       @ln -sf $(<F) $@
 
 $(OUTPUT)libtraceevent.a: $(TE_IN)
        $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
--
Quoted 3 lines

2.28.0

Thanks Steven!

Signature · 2 lines
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
#4 lore raw

Re: [PATCH 2/2] libtracevent: Remove tempfile libtraceevent.pc

In reply to Steven Rostedt
Quoted 9 lines · Steven Rostedt

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

"make install" copies libtraceevent.pc.template to libtraceevent.pc and then modifies it for the installation. This command is usually executed as root, and when finished, it leaves behind the libtraceevent.pc file owned by root.

Have the "make install" clean up and remove the temporary libtraceevent.pc file, so that root owned files do not get left behind.

Isn't it useful to have this file after the "make install" command, for debug purposes - to see how exactly it was modified ? The file is removed by "make clean".

Quoted 22 lines
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)
Makefile +1 -1
index 2a6bfcce814f..775fbd2b3f0e 100644
@@ -218,6 +218,7 @@ define do_install_pkgconfig_file
                sed -i "s|LIB_DIR|${libdir}|g" ${PKG_CONFIG_FILE}; \
                sed -i "s|HEADER_DIR|$(includedir)|g" ${PKG_CONFIG_FILE}; \
                $(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644);     \
+               ${RM} ${PKG_CONFIG_FILE}; \
        else                                                                    \
                (echo Failed to locate pkg-config directory) 1>&2;              \
        fi
--

2.28.0

Signature · 2 lines
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
#5 lore raw

Re: [PATCH 2/2] libtracevent: Remove tempfile libtraceevent.pc

Quoted 8 lines · On Tue, 24 Nov 2020 07:26:25 +0200 Tzvetomir Stoyanov <[email protected]>…
Quoted 7 lines · Steven Rostedt

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

"make install" copies libtraceevent.pc.template to libtraceevent.pc and then modifies it for the installation. This command is usually executed as root, and when finished, it leaves behind the libtraceevent.pc file owned by root.

Quoted 6 lines
Quoted 2 lines

Have the "make install" clean up and remove the temporary libtraceevent.pc file, so that root owned files do not get left behind.

Isn't it useful to have this file after the "make install" command, for debug purposes - to see how exactly it was modified ? The file is removed by "make clean".

Then it needs to be created via normal make. "make install" should leave no "artifacts" lying around. It's usually done as root, and anything left may be stuck there for the normal user (not be able to delete it).

The files removed by "make clean" are only those created by normal makes.

I can change the patch to have the creation of the package config created by "make" and not by "make install", and then have it removed by "make clean".

-- Steve