[LTP] [RFC PATCH 1/3] Makefile: Add C header with generated LTP version

Petr Vorel pvorel@suse.cz
Tue Jul 4 11:19:31 CEST 2023


It will be used for printing LTP version in C API.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .gitignore   | 1 +
 lib/Makefile | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/.gitignore b/.gitignore
index 915d22104..49e42bb9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,7 @@ autom4te.cache
 /include/mk/config-openposix.mk
 /include/mk/features.mk
 /m4/ltp-version.m4
+/lib/ltp-version.h
 /lib/ltp.pc
 /pan/ltp-bump
 /pan/ltp-pan
diff --git a/lib/Makefile b/lib/Makefile
index 9b9906f25..1cac43cde 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -24,5 +24,9 @@ $(pc_file):
 	test -d "$(@D)" || mkdir -p "$(@D)"
 	install -m $(INSTALL_MODE) "$(builddir)/$(@F)" "$@"
 
+.PHONY: ltp-version.h
+ltp-version.h: $(top_srcdir)/Version
+	echo "#define LTP_VERSION \"LTP version: $$(cat $(top_srcdir)/Version)\"" > "$(top_builddir)/lib/$(@F)"
+
 include $(top_srcdir)/include/mk/lib.mk
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
-- 
2.40.1



More information about the ltp mailing list