diff --git a/Visual Studio Projects/Pre-Build-Event.cmd b/Visual Studio Projects/Pre-Build-Event.cmd index 9c3d14aa..9a0b3267 100644 --- a/Visual Studio Projects/Pre-Build-Event.cmd +++ b/Visual Studio Projects/Pre-Build-Event.cmd @@ -340,13 +340,15 @@ rem several projects can start execution at almost the same time. rem SET ACTUAL_GIT_COMMIT_ID= SET ACTUAL_GIT_COMMIT_TIME= +SET ACTUAL_GIT_COMMIT_EXTRAS= SET GIT_COMMIT_ID= SET GIT_COMMIT_TIME= -for /F "usebackq tokens=1" %%i in (`git log -1 "--pretty=%%H"`) do SET ACTUAL_GIT_COMMIT_ID=%%i +for /F "usebackq tokens=1" %%i in (`git update-index --refresh --`) do SET ACTUAL_GIT_COMMIT_EXTRAS=+uncommitted-changes +for /F "usebackq tokens=1" %%i in (`git log -1 "--pretty=%%H"`) do SET ACTUAL_GIT_COMMIT_ID=%%i%ACTUAL_GIT_COMMIT_EXTRAS% for /F "usebackq tokens=1" %%i in (`git log -1 "--pretty=%%aI"`) do SET ACTUAL_GIT_COMMIT_TIME=%%i if exist ..\.git-commit-id for /F "usebackq tokens=2" %%i in (`findstr /C:SIM_GIT_COMMIT_ID ..\.git-commit-id`) do SET GIT_COMMIT_ID=%%i if exist ..\.git-commit-id for /F "usebackq tokens=2" %%i in (`findstr /C:SIM_GIT_COMMIT_TIME ..\.git-commit-id`) do SET GIT_COMMIT_TIME=%%i -if "%ACTUAL_GIT_COMMIT_ID%" neq "%GIT_COMMIT_ID%" "%_GIT_GIT%" log -1 --pretty="SIM_GIT_COMMIT_ID %%H%%nSIM_GIT_COMMIT_TIME %%aI" >..\.git-commit-id +if "%ACTUAL_GIT_COMMIT_ID%" neq "%GIT_COMMIT_ID%" "%_GIT_GIT%" log -1 --pretty="SIM_GIT_COMMIT_ID %%H%%ACTUAL_GIT_COMMIT_EXTRAS%%%%nSIM_GIT_COMMIT_TIME %%aI" >..\.git-commit-id SET GIT_COMMIT_ID=%ACTUAL_GIT_COMMIT_ID% SET GIT_COMMIT_TIME=%ACTUAL_GIT_COMMIT_TIME% SET ACTUAL_GIT_COMMIT_ID= diff --git a/makefile b/makefile index 2b610fd9..9a7b71d4 100644 --- a/makefile +++ b/makefile @@ -153,6 +153,19 @@ endif ifneq ($(NOVIDEO),) VIDEO_USEFUL = endif +ifneq ($(findstring Windows,${OS}),) + ifeq ($(findstring .exe,${SHELL}),.exe) + # MinGW + WIN32 := 1 + # Tests don't run under MinGW + TESTS := 0 + else # Msys or cygwin + ifeq (MINGW,$(findstring MINGW,$(shell uname))) + $(info *** This makefile can not be used with the Msys bash shell) + $(error Use build_mingw.bat ${MAKECMDGOALS} from a Windows command prompt) + endif + endif +endif find_exe = $(abspath $(strip $(firstword $(foreach dir,$(strip $(subst :, ,${PATH})),$(wildcard $(dir)/$(1)))))) find_lib = $(abspath $(strip $(firstword $(foreach dir,$(strip ${LIBPATH}),$(wildcard $(dir)/lib$(1).${LIBEXT}))))) find_include = $(abspath $(strip $(firstword $(foreach dir,$(strip ${INCPATH}),$(wildcard $(dir)/$(1).h))))) @@ -162,17 +175,6 @@ ifneq (0,$(TESTS)) else TESTING_FEATURES = - Per simulator tests will be skipped endif -ifneq ($(findstring Windows,${OS}),) - ifeq ($(findstring .exe,${SHELL}),.exe) - # MinGW - WIN32 := 1 - else # Msys or cygwin - ifeq (MINGW,$(findstring MINGW,$(shell uname))) - $(info *** This makefile can not be used with the Msys bash shell) - $(error Use build_mingw.bat ${MAKECMDGOALS} from a Windows command prompt) - endif - endif -endif ifeq (${WIN32},) #*nix Environments (&& cygwin) ifeq (${GCC},) ifeq (,$(shell which gcc 2>/dev/null)) @@ -256,8 +258,11 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) NEED_COMMIT_ID = need-commit-id endif ifeq (need-commit-id,$(NEED_COMMIT_ID)) + ifneq (,$(shell git update-index --refresh --)) + GIT_EXTRA_FILES=+uncommitted-changes + endif isodate=$(shell git log -1 --pretty="%ai"|sed -e 's/ /T/'|sed -e 's/ //') - $(shell git log -1 --pretty="SIM_GIT_COMMIT_ID %H%nSIM_GIT_COMMIT_TIME $(isodate)" >.git-commit-id) + $(shell git log -1 --pretty="SIM_GIT_COMMIT_ID %H$(GIT_EXTRA_FILES)%nSIM_GIT_COMMIT_TIME $(isodate)" >.git-commit-id) endif endif LTO_EXCLUDE_VERSIONS = @@ -992,7 +997,10 @@ else endif ifeq (commit-id-exists,$(shell if exist .git-commit-id echo commit-id-exists)) CURRENT_GIT_COMMIT_ID=$(shell for /F "tokens=2" %%i in ("$(shell findstr /C:"SIM_GIT_COMMIT_ID" .git-commit-id)") do echo %%i) - ACTUAL_GIT_COMMIT_ID=$(strip $(shell git log -1 --pretty=%H)) + ifneq (, $(shell git update-index --refresh --)) + ACTUAL_GIT_COMMIT_EXTRAS=+uncommitted-changes + endif + ACTUAL_GIT_COMMIT_ID=$(strip $(shell git log -1 --pretty=%H))$(ACTUAL_GIT_COMMIT_EXTRAS) ifneq ($(CURRENT_GIT_COMMIT_ID),$(ACTUAL_GIT_COMMIT_ID)) NEED_COMMIT_ID = need-commit-id # make sure that the invalidly formatted .git-commit-id file wasn't generated @@ -1005,10 +1013,13 @@ else NEED_COMMIT_ID = need-commit-id endif ifeq (need-commit-id,$(NEED_COMMIT_ID)) - commit_id=$(shell git log -1 --pretty=%H) + ifneq (, $(shell git update-index --refresh --)) + ACTUAL_GIT_COMMIT_EXTRAS=+uncommitted-changes + endif + ACTUAL_GIT_COMMIT_ID=$(strip $(shell git log -1 --pretty=%H))$(ACTUAL_GIT_COMMIT_EXTRAS) isodate=$(shell git log -1 --pretty=%ai) commit_time=$(word 1,$(isodate))T$(word 2,$(isodate))$(word 3,$(isodate)) - $(shell echo SIM_GIT_COMMIT_ID $(commit_id)>.git-commit-id) + $(shell echo SIM_GIT_COMMIT_ID $(ACTUAL_GIT_COMMIT_ID)>.git-commit-id) $(shell echo SIM_GIT_COMMIT_TIME $(commit_time)>>.git-commit-id) endif endif diff --git a/scp.c b/scp.c index 9a37e8ce..87516019 100644 --- a/scp.c +++ b/scp.c @@ -6221,8 +6221,12 @@ if (flag) { #if defined(SIM_GIT_COMMIT_ID) #define S_xstr(a) S_str(a) #define S_str(a) #a -fprintf (st, "%sgit commit id: %8.8s", flag ? "\n " : " ", S_xstr(SIM_GIT_COMMIT_ID)); -setenv ("SIM_GIT_COMMIT_ID", S_xstr(SIM_GIT_COMMIT_ID), 1); +if (1) { + const char *extras = strchr (S_xstr(SIM_GIT_COMMIT_ID), '+'); + + fprintf (st, "%sgit commit id: %8.8s%s", flag ? "\n " : " ", S_xstr(SIM_GIT_COMMIT_ID), extras ? extras : ""); + setenv ("SIM_GIT_COMMIT_ID", S_xstr(SIM_GIT_COMMIT_ID), 1); + } #if defined(SIM_GIT_COMMIT_TIME) setenv ("SIM_GIT_COMMIT_TIME", S_xstr(SIM_GIT_COMMIT_TIME), 1); if (flag)