Skip to content

Commit 96046c0

Browse files
committed
Adds MaikoGitVersion string to vdate.o
The variable MaikoGitVersion will contain a git revision from the head of the source tree along with an indication if the status was "dirty". If git is not present on the system or the directory that the build happened in was not under git control the version will be "none".
1 parent 578b265 commit 96046c0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bin/mkvdate

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
#!/bin/sh
2+
if command -v "git" >/dev/null 2>&1; then
3+
MAIKO_REV="$(git status --porcelain)"
4+
if [ $? == 0 ]; then
5+
if [ ! -z "$(git status --porcelain)" ]; then
6+
MAIKO_REV="$(git rev-parse --short HEAD)-dirty"
7+
else
8+
MAIKO_REV="$(git rev-parse --short HEAD)"
9+
fi
10+
else
11+
MAIKO_REV="none"
12+
fi
13+
else
14+
MAIKO_REV = "none"
15+
fi
216
cat <<EOF
317
#include <time.h>
418
extern const time_t MDate;
519
const time_t MDate = $(date +%s);
20+
extern const char *MaikoGitVersion;
21+
const char *MaikoGitVersion = "maiko git version: $MAIKO_REV";
622
EOF

0 commit comments

Comments
 (0)