From 07a65f52a767da72845eafba22a9e44798409b6f Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Sun, 21 May 2023 11:08:14 +0200 Subject: Improve automatic versioning --- .nfs000000000004027700000003 | Bin 0 -> 21328 bytes Makefile | 2 +- cputemp2maxfreq.c | 2 +- generate_version_h.sh | 1 + version.c | 7 +++++++ 5 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 .nfs000000000004027700000003 create mode 100644 version.c diff --git a/.nfs000000000004027700000003 b/.nfs000000000004027700000003 new file mode 100755 index 0000000..778e9c5 Binary files /dev/null and b/.nfs000000000004027700000003 differ diff --git a/Makefile b/Makefile index efcb459..aa4ec70 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -cputemp2maxfreq: version.h debug.o sysfs.o cpufreq.o failsafe.o +cputemp2maxfreq: version.o debug.o sysfs.o cpufreq.o failsafe.o version.h: generate_version_h.sh .git/index ./generate_version_h.sh > version.h diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c index 00d8f4f..20a3046 100644 --- a/cputemp2maxfreq.c +++ b/cputemp2maxfreq.c @@ -26,7 +26,7 @@ int main() long int diff; long int newfreq; - printf("Version %s, buildtime %s %s\n",VERSION_FULL,__DATE__,__TIME__); + printf("Version %s, buildtime %s %s\n",version(),__DATE__,__TIME__); // Print configuration printf("Configuration:\n"); diff --git a/generate_version_h.sh b/generate_version_h.sh index fed5fa0..75df5a2 100755 --- a/generate_version_h.sh +++ b/generate_version_h.sh @@ -8,3 +8,4 @@ echo "#define VERSION \"$VERSION\"" echo "#define HASH \"$HASH\"" echo "#define BRANCH \"$BRANCH\"" echo "#define VERSION_FULL VERSION\"-\"HASH\" (\"BRANCH\")\"" +echo "char* version();" diff --git a/version.c b/version.c new file mode 100644 index 0000000..d4f10ec --- /dev/null +++ b/version.c @@ -0,0 +1,7 @@ +#include "version.h" + +char* version() +{ + return VERSION_FULL; +} + -- cgit v1.2.3