From b2e22c852d56a5115bace51dc36b205c52e9f79f Mon Sep 17 00:00:00 2001 From: midipix Date: Dec 24 2018 16:38:01 +0000 Subject: build system: version.sh: generate macro for date of last git commit. --- 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