* [PATCH] libtracecmd: Update libtracecmd.pc when version changes
@ 2021-04-09 22:19 Steven Rostedt
0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2021-04-09 22:19 UTC (permalink / raw)
To: Linux Trace Devel
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
When the libtracecmd version changes, the libtracecmd.pc needs to be
updated, otherwise it may install the wrong version number.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
.gitignore | 1 +
Makefile | 32 ++++++++++++++++++++++++++++++--
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index af9bf6c0..f0719c5e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@ libtracecmd.pc
build_prefix
build_install
build_libs_install
+ltc_version.h
diff --git a/Makefile b/Makefile
index 6e330e47..48d45809 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,8 @@ export LIBTC_PATCHLEVEL
export LIBTC_EXTRAVERSION
export LIBTRACECMD_VERSION
+VERSION_FILE = ltc_version.h
+
LIBTRACEEVENT_MIN_VERSION = 1.1
LIBTRACEFS_MIN_VERSION = 1.1
@@ -371,7 +373,7 @@ BUILD_PREFIX := $(BUILD_OUTPUT)/build_prefix
$(BUILD_PREFIX): force
$(Q)$(call build_prefix,$(prefix))
-$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX)
+$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX) $(VERSION_FILE)
$(Q) $(call do_make_pkgconfig_file,$(prefix))
$(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
@@ -392,6 +394,32 @@ libtracecmd.so: $(LIBTRACECMD_SHARED)
libs: $(LIBTRACECMD_SHARED) $(PKG_CONFIG_FILE)
+VERSION = $(LIBTC_VERSION)
+PATCHLEVEL = $(LIBTC_PATCHLEVEL)
+EXTRAVERSION = $(LIBTC_EXTRAVERSION)
+
+define make_version.h
+ (echo '/* This file is automatically generated. Do not modify. */'; \
+ echo \#define VERSION_CODE $(shell \
+ expr $(VERSION) \* 256 + $(PATCHLEVEL)); \
+ echo '#define EXTRAVERSION ' $(EXTRAVERSION); \
+ echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \
+ ) > $1
+endef
+
+define update_version.h
+ ($(call make_version.h, $@.tmp); \
+ if [ -r $@ ] && cmp -s $@ $@.tmp; then \
+ rm -f $@.tmp; \
+ else \
+ echo ' UPDATE $@'; \
+ mv -f $@.tmp $@; \
+ fi);
+endef
+
+$(VERSION_FILE): force
+ $(Q)$(call update_version.h)
+
gui: force $(CMD_TARGETS)
$(MAKE) $(kshark-dir)/build/Makefile
$(Q)$(MAKE) $(S) -C $(kshark-dir)/build
@@ -490,7 +518,7 @@ install_doc_gui:
clean:
$(RM) *.o *~ *.a *.so .*.d
- $(RM) tags TAGS cscope* $(PKG_CONFIG_SOURCE_FILE)
+ $(RM) tags TAGS cscope* $(PKG_CONFIG_SOURCE_FILE) $(VERSION_FILE)
$(MAKE) -C $(src)/lib/trace-cmd clean
$(MAKE) -C $(src)/lib/trace-cmd/plugins clean
$(MAKE) -C $(src)/utest clean
--
2.29.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-09 22:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-09 22:19 [PATCH] libtracecmd: Update libtracecmd.pc when version changes Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).