aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPA4WDH2023-05-21 11:08:14 +0200
committerPA4WDH2023-05-21 11:08:14 +0200
commit07a65f52a767da72845eafba22a9e44798409b6f (patch)
treed2e968f90ae7fcd78bfb6a2fb060bf6e1ba81c3e
parentImprove error handling (diff)
downloadcputemp2maxfreq-07a65f52a767da72845eafba22a9e44798409b6f.tar.gz
cputemp2maxfreq-07a65f52a767da72845eafba22a9e44798409b6f.tar.bz2
cputemp2maxfreq-07a65f52a767da72845eafba22a9e44798409b6f.zip
Improve automatic versioning
-rwxr-xr-x.nfs000000000004027700000003bin0 -> 21328 bytes
-rw-r--r--Makefile2
-rw-r--r--cputemp2maxfreq.c2
-rwxr-xr-xgenerate_version_h.sh1
-rw-r--r--version.c7
5 files changed, 10 insertions, 2 deletions
diff --git a/.nfs000000000004027700000003 b/.nfs000000000004027700000003
new file mode 100755
index 0000000..778e9c5
--- /dev/null
+++ b/.nfs000000000004027700000003
Binary files 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;
+}
+