From bf7d690e36f200c429b82b1eba0102675bfe4aa4 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Thu, 3 Apr 2014 16:32:58 -0700 Subject: Add the git version to the banner --- py/py-version.sh | 16 ++++++++++++++++ py/py.mk | 10 +++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 py/py-version.sh (limited to 'py') diff --git a/py/py-version.sh b/py/py-version.sh new file mode 100755 index 000000000..f574b574f --- /dev/null +++ b/py/py-version.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +git_hash="$(git rev-parse --short HEAD 2> /dev/null || echo unknown)" +git_files_are_clean=1 +# Check if there are any modified files. +git diff --no-ext-diff --quiet --exit-code 2> /dev/null || git_files_are_clean=0 +# Check if there are any staged files. +git diff-index --cached --quiet HEAD -- 2> /dev/null || git_files_are_clean=0 +if [ "${git_files_are_clean}" != "1" ]; then + git_hash="${git_hash}-dirty" +fi +cat < $@.tmp + $(Q)if [ -f "$@" ] && cmp -s $@ $@.tmp; then rm $@.tmp; else echo "Generating $@"; mv $@.tmp $@; fi + # qstr data # Adding an order only dependency on $(PY_BUILD) causes $(PY_BUILD) to get @@ -104,7 +112,7 @@ $(PY_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqst # the right .o's to get recompiled if the generated.h file changes. Adding # an order-only dependendency to all of the .o's will cause the generated .h # to get built before we try to compile any of them. -$(PY_O): | $(PY_BUILD)/qstrdefs.generated.h +$(PY_O): | $(PY_BUILD)/qstrdefs.generated.h $(PY_BUILD)/py-version.h # emitters -- cgit v1.2.3