aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2020-12-15 23:36:39 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-12-16 14:57:00 -0500
commit2146a81b298d1a4071d9b91a72e70743be2ca790 (patch)
tree11724e42a635c4b68db10d8a0317de4e2ce9a4c6
parent642a66d420adbda521344f1757bd6df920c713a3 (diff)
downloadlibtraceevent-2146a81b298d1a4071d9b91a72e70743be2ca790.tar.gz
libtraceevent: Update libtraceevent.pc if prefix is different
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. Link: https://lore.kernel.org/linux-trace-devel/20201216043717.009188125@goodmis.org Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--Makefile17
-rw-r--r--scripts/Makefile.include1
2 files changed, 17 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index c85114b..f795e05 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 d505b2f..1c9266c 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) \