diff --git a/.gitignore b/.gitignore index 4014582e..d958df61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.git-commit-id #ignore thumbnails created by windows Thumbs.db #Ignore files built by Visual Studio @@ -41,3 +42,4 @@ ipch/ Visual Studio Projects/* + diff --git a/makefile b/makefile index 076993b0..79431873 100644 --- a/makefile +++ b/makefile @@ -296,6 +296,9 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) ifneq (binexists,$(shell if $(TEST) -e BIN; then echo binexists; fi)) MKDIRBIN = mkdir -p BIN endif + ifneq (,$(shell cat .git-commit-id)) + GIT_COMMIT_ID=$(shell cat .git-commit-id) + endif else #Win32 Environments (via MinGW32) GCC = gcc @@ -338,7 +341,11 @@ else ifneq ($(USE_NETWORK),) NETWORK_OPT += -DUSE_SHARED 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) + endif endif +CFLAGS_GIT = -DSIM_GIT_COMMIT_ID="$(GIT_COMMIT_ID)" ifneq ($(DEBUG),) CFLAGS_G = -g -ggdb -g3 CFLAGS_O = -O0 @@ -406,6 +413,10 @@ ifneq (clean,$(MAKECMDGOALS)) ifneq (,$(NETWORK_FEATURES)) $(info *** $(NETWORK_FEATURES).) endif + ifneq (,$(GIT_COMMIT_ID)) + $(info ***) + $(info *** git commit id is $(GIT_COMMIT_ID).) + endif $(info ***) endif ifneq ($(DONT_USE_ROMS),) @@ -419,7 +430,7 @@ endif CC_STD = -std=c99 CC_OUTSPEC = -o $@ -CC = $(GCC) $(CC_STD) -U__STRICT_ANSI__ $(CFLAGS_G) $(CFLAGS_O) -I . $(OS_CCDEFS) $(ROMS_OPT) +CC = $(GCC) $(CC_STD) -U__STRICT_ANSI__ $(CFLAGS_G) $(CFLAGS_O) $(CFLAGS_GIT) -I . $(OS_CCDEFS) $(ROMS_OPT) LDFLAGS = $(OS_LDFLAGS) $(NETWORK_LDFLAGS) $(LDFLAGS_O) # diff --git a/scp.c b/scp.c index f9043510..57315a24 100644 --- a/scp.c +++ b/scp.c @@ -2298,6 +2298,9 @@ if (vdelt) if (flag) fprintf (st, " [%s, %s, %s]", sim_si64, sim_sa64, sim_snet); fprintf (st, "\n"); +#if defined(SIM_GIT_COMMIT_ID) +fprintf (st, "git commit id: %8.8s\n", SIM_GIT_COMMIT_ID); +#endif return SCPE_OK; }