[PATCH 2/3] libtraceevent: Update libtraceevent.pc if prefix is different

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

If a build is done with different DESTDIR and the prefix is changed, the
the libtraceevent.pc is not updated with the new prefix, and the one used may
not work with the installation being performed.

Add a "build_prefix" dependency, that creates a file "build_prefix" that has
the last prefix used to build the library. And if a new prefix is used, then
that file gets updated and so does libtraceevent.pc.

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
 Makefile                 | 17 ++++++++++++++++-
 scripts/Makefile.include |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c85114beef96..f795e05d22a7 100644
--- a/Makefile
+++ b/Makefile
@@ -213,6 +213,21 @@ TAGS:	force
 	find . -name '*.[ch]' | xargs etags \
 	--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
 
+define build_prefix
+	(echo $1 > $@.tmp;	\
+	if [ -r $@ ] && cmp -s $@ $@.tmp; then				\
+		rm -f $@.tmp;						\
+	else								\
+		$(PRINT_GEN)						\
+		mv -f $@.tmp $@;					\
+	fi);
+endef
+
+BUILD_PREFIX := $(OUTPUT)build_prefix
+
+$(BUILD_PREFIX): force
+	$(Q)$(call build_prefix,$(prefix))
+
 define do_install_mkdir
 	if [ ! -d '$(DESTDIR_SQ)$1' ]; then		\
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1';	\
@@ -232,7 +247,7 @@ define do_make_pkgconfig_file
 	sed -i "s|HEADER_DIR|$(includedir)|g" ${PKG_CONFIG_FILE};
 endef
 
-$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template
+$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX)
 	$(QUIET_GEN) $(call do_make_pkgconfig_file,$(prefix))
 
 define do_install_pkgconfig_file
diff --git a/scripts/Makefile.include b/scripts/Makefile.include
index d505b2f20b92..1c9266c34d2a 100644
--- a/scripts/Makefile.include
+++ b/scripts/Makefile.include
@@ -110,6 +110,7 @@ ifneq ($(silent),1)
 	QUIET_AR       = @echo '  AR       '$@;
 	QUIET_LINK     = @echo '  LINK     '$@;
 	QUIET_MKDIR    = @echo '  MKDIR    '$@;
+	PRINT_GEN      = echo '  GEN      '$@;
 	QUIET_GEN      = @echo '  GEN      '$@;
 	QUIET_SUBDIR0  = +@subdir=
 	QUIET_SUBDIR1  = ;$(NO_SUBDIR) \
-- 
2.29.2





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux