aboutsummaryrefslogtreecommitdiff
path: root/Makefile.main
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2014-08-13 15:19:05 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-08-13 16:15:45 +1000
commite25644b4d573deee46bb520ce2a0d9493cbbcfd8 (patch)
tree4c7b616fd37f4ddf2b86a6394a618ef720b4bdeb /Makefile.main
parent50d2e37faf5bb2fd154d4a1eeac465f8016e1f65 (diff)
downloadskiboot-e25644b4d573deee46bb520ce2a0d9493cbbcfd8.zip
skiboot-e25644b4d573deee46bb520ce2a0d9493cbbcfd8.tar.gz
skiboot-e25644b4d573deee46bb520ce2a0d9493cbbcfd8.tar.bz2
Fix gitid generation when not in a git repository
If skiboot doesn't live in a git repository, the makefile will go searching up the directory tree for one. To save confusion, only look in the source tree for the git repository. The gitid can be overridden by passing GIT_SHA=foo as an argument to make. This is useful for doing builds outside of a git tree, as buildroot does. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'Makefile.main')
-rw-r--r--Makefile.main4
1 files changed, 3 insertions, 1 deletions
diff --git a/Makefile.main b/Makefile.main
index 68a3807..599372a 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -128,8 +128,10 @@ $(SUBDIRS):
# Set V=1 if you want to see everything.
include $(SRC)/Makefile.rules
+GIT_SHA ?= $(shell cd $(SRC); GIT_DIR=$(SRC)/.git git describe --always --dirty 2> /dev/null)
+
gitid.c:
- @echo "const char gitid[] = \"`cd $(SRC); git describe --always --dirty`\";" > $@
+ @echo "const char gitid[] = \"$(GIT_SHA)\";" > $@
include $(shell find $(SRC)/* -name Makefile.check)