better handling of Ctrl+C during `make update` (#1588)

This commit is contained in:
Ștefan Talpalaru 2020-09-16 17:46:05 +02:00 committed by GitHub
parent df685f0c12
commit ce85f58d29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -78,10 +78,15 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
ifeq ($(NIM_PARAMS),)
# "variables.mk" was not included, so we update the submodules.
#
# The `git reset ...` will try to fix a `make update` that was interrupted
# with Ctrl+C after deleting the working copy and before getting a chance to
# restore it in $(BUILD_SYSTEM_DIR).
GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
.DEFAULT:
+@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \
$(GIT_SUBMODULE_UPDATE) && \
git submodule foreach --quiet 'git reset --quiet --hard' && \
echo
# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself:
# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles