1
0
mirror of https://github.com/simh/simh.git synced 2026-01-25 11:46:37 +00:00

makefile, Visual Studio Projects: remove dependency on git hooks

the repository commit id will now be verified on each build directly.
This commit is contained in:
Mark Pizzolato
2018-07-17 12:10:15 -07:00
parent 65e931c1ff
commit 699d28fb83
6 changed files with 34 additions and 115 deletions

View File

@@ -128,7 +128,7 @@ ifneq ($(findstring Windows,$(OS)),)
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)
$(error Use build_mingw.bat $(MAKECMDGOALS) from a Windows command prompt)
endif
endif
endif
@@ -197,31 +197,22 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
endif
endif
ifeq (git-repo,$(shell if $(TEST) -d ./.git; then echo git-repo; fi))
NEED_HOOKS = $(shell if $(TEST) ! -e ./.git/hooks/post-checkout; then echo need-hooks; fi)
ifeq (,$(NEED_HOOKS))
NEED_HOOKS = $(shell if ! `diff ./.git/hooks/post-checkout ./Visual\ Studio\ Projects/git-hooks/post-checkout >/dev/null`; then echo need-hooks; fi)
GIT_PATH=$(strip $(shell which git))
ifeq (,$(GIT_PATH))
$(error building using a git repository, but git is not available)
endif
ifeq (need-hooks,$(NEED_HOOKS))
$(info *** Installing git hooks in local repository ***)
GIT_HOOKS += $(shell cp './Visual Studio Projects/git-hooks/post-commit' ./.git/hooks/)
GIT_HOOKS += $(shell cp './Visual Studio Projects/git-hooks/post-checkout' ./.git/hooks/)
GIT_HOOKS += $(shell cp './Visual Studio Projects/git-hooks/post-merge' ./.git/hooks/)
GIT_HOOKS += $(shell ./.git/hooks/post-checkout)
ifneq (,$(strip $(GIT_HOOKS)))
$(info *** Warning - Error installing git hooks *** $(GIT_HOOKS))
else
ifneq (commit-id-exists,$(shell if $(TEST) -e .git-commit-id; then echo commit-id-exists; fi))
$(shell rm .git-commit-id)
endif
ifeq (commit-id-exists,$(shell if $(TEST) -e .git-commit-id; then echo commit-id-exists; fi))
CURRENT_GIT_COMMIT_ID=$(strip $(shell grep 'SIM_GIT_COMMIT_ID' .git-commit-id | awk '{ print $$2 }'))
ACTUAL_GIT_COMMIT_ID=$(strip $(shell git log -1 --pretty="%H"))
ifneq ($(CURRENT_GIT_COMMIT_ID),$(ACTUAL_GIT_COMMIT_ID))
NEED_COMMIT_ID = need-commit-id
endif
else
NEED_COMMIT_ID = need-commit-id
endif
ifneq (commit-id-exists,$(shell if $(TEST) -e .git-commit-id; then echo commit-id-exists; fi))
ifeq (,$(strip $(GIT_HOOKS)))
GIT_HOOKS = $(shell ./.git/hooks/post-checkout)
ifneq (,$(strip $(GIT_HOOKS)))
$(info *** Warning - Error executing git hooks *** $(GIT_HOOKS))
endif
endif
ifeq (need-commit-id,$(NEED_COMMIT_ID))
$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)
endif
endif
LTO_EXCLUDE_VERSIONS =