aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-04-17 02:46:11 -0500
committerRob Landley <rob@landley.net>2015-04-17 02:46:11 -0500
commit90afbad4c1f115d5363fe99eb797d2458cd298a0 (patch)
tree9f4a491d440272389b332908eb4dc34d8a9d8196 /scripts
parent17499c3731273d2cffdd96d011cf8ed6aca103da (diff)
downloadtoybox-90afbad4c1f115d5363fe99eb797d2458cd298a0.tar.gz
Make toybox --version use the "git describe" info if it's available.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/make.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 4cb19272..3d9eed3f 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -58,9 +58,11 @@ fi
# Extract a list of toys/*/*.c files to compile from the data in $KCONFIG_CONFIG
# (First command names, then filenames with relevant {NEW,OLD}TOY() macro.)
+GITHASH="$(git describe --tags --abbrev=12 2>/dev/null)"
+[ ! -z "$GITHASH" ] && GITHASH="-DTOYBOX_VERSION=\"$GITHASH\""
TOYFILES="$(sed -n 's/^CONFIG_\([^=]*\)=.*/\1/p' "$KCONFIG_CONFIG" | xargs | tr ' [A-Z]' '|[a-z]')"
TOYFILES="$(egrep -l "TOY[(]($TOYFILES)[ ,]" toys/*/*.c)"
-BUILD="$(echo ${CROSS_COMPILE}${CC} $CFLAGS -I . $OPTIMIZE)"
+BUILD="$(echo ${CROSS_COMPILE}${CC} $CFLAGS -I . $OPTIMIZE $GITHASH)"
FILES="$(echo lib/*.c main.c $TOYFILES)"
genbuildsh()