summaryrefslogtreecommitdiffhomepage
path: root/sysinfo
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-24 11:35:15 -0500
committermidipix <writeonce@midipix.org>2018-12-24 11:38:00 -0500
commit6ffde76c7bf7a2d7d3815936d2d93be3e97fbd9f (patch)
treeec4f7db76c67f1923e3d15b614099f7840bb3ba5 /sysinfo
parent5fdd0723a6383a2050b019d6213ec0be1b6a900c (diff)
downloadntux-6ffde76c7bf7a2d7d3815936d2d93be3e97fbd9f.tar.bz2
ntux-6ffde76c7bf7a2d7d3815936d2d93be3e97fbd9f.tar.xz
build system: version.sh: generate macro for date of last git commit.
Diffstat (limited to 'sysinfo')
-rwxr-xr-xsysinfo/version.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/sysinfo/version.sh b/sysinfo/version.sh
index 1a73794..a9e5992 100755
--- a/sysinfo/version.sh
+++ b/sysinfo/version.sh
@@ -54,11 +54,20 @@ fi
cd "$srcdir"
gitver=$(git rev-parse --verify HEAD 2>/dev/null) || gitver="unknown"
-macro=$(echo "$prefix"_GIT_VERSION | tr '[:lower:]' '[:upper:]')
+cvdate=$(git show -s --format=%ci $gitver)
+vmacro=$(printf '%s' "$prefix"'_GIT_VERSION' | tr '[:lower:]' '[:upper:]')
+dmacro=$(printf '%s' "$prefix"'_GIT_DATE ' | tr '[:lower:]' '[:upper:]')
+
+
+# three
cd "$workdir"
-mkdir -p $(dirname "$output")
-printf "#define $macro\t\"$gitver\"\n" > "$output"
+mkdir -p $(dirname "$output")
+
+printf '#define %s "%s"\n#define %s "%s"\n' \
+ "$vmacro" "$gitver" \
+ "$dmacro" "$cvdate" \
+ > "$output"
# all done
exit 0