From 861d9c8d9cc46ff26ec5d585f086fb1cb59928d6 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 14 Jan 2017 12:09:00 -0800 Subject: [PATCH] makefile: Generalized git-id determination when simh is used as a submodule This will support arbitrary location and naming of the simh submodule in the parent repo's working directory. It probably won't work for sub sub modules. Suggestions welcome. --- makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index c73c06da..d2639f1a 100644 --- a/makefile +++ b/makefile @@ -756,10 +756,10 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) 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 + ifeq (git-submodule,$(if $(shell cd .. ; git rev-parse --git-dir 2>/dev/null),git-submodule)) + GIT_COMMIT_ID=$(shell cd .. ; git submodule status | grep "$(notdir $(realpath .))" | awk '{ print $$1 }') + else + GIT_COMMIT_ID=undetermined-git-id endif endif endif