From b54504906f6d98517145eba0e20142e26f961723 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 15 Apr 2013 09:31:54 -0700 Subject: [PATCH] Added support to display git commit id when building from a zip archive and also to display the compiler version in SHOW VERSION on more platforms --- makefile | 12 ++++++++++-- scp.c | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 1bfd1eb5..f399e295 100644 --- a/makefile +++ b/makefile @@ -373,8 +373,12 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) ifneq (binexists,$(shell if $(TEST) -e BIN; then echo binexists; fi)) MKDIRBIN = mkdir -p BIN endif - ifneq (,$(shell if $(TEST) -e .git-commit-id; then echo commit-id-exists; fi)) + ifeq (commit-id-exists,$(shell if $(TEST) -e .git-commit-id; then echo commit-id-exists; fi)) GIT_COMMIT_ID=$(shell cat .git-commit-id) + 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 }') + endif endif else #Win32 Environments (via MinGW32) @@ -424,6 +428,10 @@ else endif ifneq (,$(shell if exist .git-commit-id type .git-commit-id)) GIT_COMMIT_ID=$(shell if exist .git-commit-id type .git-commit-id) + else + ifeq (,$(shell findstr /C:"define SIM_GIT_COMMIT_ID" sim_rev.h | findstr Format)) + GIT_COMMIT_ID=$(shell for /F "tokens=3" %%i in ("$(shell findstr /C:"define SIM_GIT_COMMIT_ID" sim_rev.h)") do echo %%i) + endif endif endif ifneq (,$(GIT_COMMIT_ID)) @@ -519,7 +527,7 @@ else endif endif CC_OUTSPEC = -o $@ -CC = $(GCC) $(CC_STD) -U__STRICT_ANSI__ $(CFLAGS_G) $(CFLAGS_O) $(CFLAGS_GIT) -I . $(OS_CCDEFS) $(ROMS_OPT) +CC = $(GCC) $(CC_STD) -U__STRICT_ANSI__ $(CFLAGS_G) $(CFLAGS_O) $(CFLAGS_GIT) -DSIM_COMPILER="$(COMPILER_NAME)" -I . $(OS_CCDEFS) $(ROMS_OPT) LDFLAGS = $(OS_LDFLAGS) $(NETWORK_LDFLAGS) $(LDFLAGS_O) # diff --git a/scp.c b/scp.c index 3ba5d18d..853fad67 100644 --- a/scp.c +++ b/scp.c @@ -2788,6 +2788,8 @@ if (flag) { fprintf (st, "\n\t\tCompiler: Microsoft Visual C++ %d.%02d.%05d.%02d", _MSC_FULL_VER/10000000, (_MSC_FULL_VER/100000)%100, _MSC_FULL_VER%100000, _MSC_BUILD); #elif defined (__DECC_VER) fprintf (st, "\n\t\tCompiler: DEC C %c%d.%d-%03d", ("T SV")[((__DECC_VER/10000)%10)-6], __DECC_VER/10000000, (__DECC_VER/100000)%100, __DECC_VER%10000); +#elif defined (SIM_COMPILER) + fprintf (st, "\n\t\tCompiler: %s", SIM_COMPILER); #endif #if defined (__DATE__) && defined (__TIME__) fprintf (st, "\n\t\tSimulator Compiled: %s at %s", __DATE__, __TIME__);