From e3f7a9b112f9c247530f1917c5194a8e85fdbd28 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 9 Jan 2017 03:11:46 -0800 Subject: [PATCH] makefile: Add support for proper display of commit id when used as a submodule --- makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/makefile b/makefile index 9a3d5c87..d7a88706 100644 --- a/makefile +++ b/makefile @@ -755,6 +755,12 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) else 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 }') + 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 else