diff options
Diffstat (limited to 'util/getversion.sh')
-rwxr-xr-x | util/getversion.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/util/getversion.sh b/util/getversion.sh index da31eb9428..8b32307a49 100755 --- a/util/getversion.sh +++ b/util/getversion.sh @@ -37,8 +37,6 @@ fi ver="${BOARD}_${vbase}" -gitdate=$(git log -1 --format='%ai' HEAD | cut -d ' ' -f '1 2') - echo "/* This file is generated by util/getversion.sh */" echo "/* Version string for use by common/version.c */" @@ -56,7 +54,11 @@ echo " * in common/version.c. */" echo "#define VERSION \"${ver}\"" echo "#define BUILDER \"${USER}@`hostname`\"" -echo "/* Author date of last commit, in case compile-time is not used. */" -echo "#ifndef DATE" -echo "#define DATE \"${gitdate}\"" -echo "#endif" +if [ -n "$dirty" ]; then + echo "/* Repo is dirty, using time of last compilation */" + echo "#define DATE \"$(date '+%F %T')\"" +else + echo "/* Repo is clean, use the author date of the last commit */" + gitdate=$(git log -1 --format='%ai' HEAD | cut -d ' ' -f '1 2') + echo "#define DATE \"${gitdate}\"" +fi |