makefile: Add support for proper display of commit id when used as a submodule

This commit is contained in:
Mark Pizzolato 2017-01-09 03:11:46 -08:00
parent 0461008991
commit e3f7a9b112

View file

@ -755,6 +755,12 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
else else
ifeq (,$(shell grep 'define SIM_GIT_COMMIT_ID' sim_rev.h | grep 'Format:')) ifeq (,$(shell grep 'define SIM_GIT_COMMIT_ID' sim_rev.h | grep 'Format:'))
GIT_COMMIT_ID=$(shell grep 'define SIM_GIT_COMMIT_ID' sim_rev.h | awk '{ print $$3 }') GIT_COMMIT_ID=$(shell grep 'define SIM_GIT_COMMIT_ID' sim_rev.h | awk '{ print $$3 }')
else
ifeq (git-submodule,$(shell if $(TEST) -d ../.git; then echo git-submodule; fi))
ifeq (submodule,$(shell grep 'submodule "simh"' ../.gitmodules | awk 'BEGIN { FS = " " } ; { print $$1 }' | awk 'BEGIN { FS = "\[" } ; { print $$2 }'))
GIT_COMMIT_ID=$(shell cd .. ; git submodule status | grep simh | awk '{ print $$1 }')
endif
endif
endif endif
endif endif
else else