ifneq (,$(wildcard .git)) # if we're in a git repo # if the submodule changed, update it SUBMODULE_DIFF=$(shell git diff etc/coq-scripts 2>&1 | grep 'Subproject commit') SUBMODULE_DIRTY=$(shell git diff etc/coq-scripts 2>&1 | grep dirty) ifneq (,$(SUBMODULE_DIRTY)) submodule-update:: @ echo "\033[0;31mThe submodule is dirty; some scripts may fail.\033[0m" @ echo "\033[0;31mRun (cd etc/coq-scripts && git clean -xfd && git reset --hard)\033[0m" else ifneq (,$(SUBMODULE_DIFF)) submodule-update:: git submodule sync && \ git submodule update --init && \ touch "$@" endif endif ifeq (,$(wildcard submodule-update)) submodule-update:: git submodule sync && \ git submodule update --init && \ touch "$@" else submodule-update:: endif etc/coq-scripts/Makefile.coq.common etc/coq-scripts/compatibility/Makefile.coq.compat_84_85 etc/coq-scripts/compatibility/Makefile.coq.compat_84_85-early: submodule-update @ touch "$@" endif FAST_TARGETS += clean-doc etc/coq-scripts etc/coq-scripts/Makefile.coq.common etc/coq-scripts/compatibility/Makefile.coq.compat_84_85 etc/coq-scripts/compatibility/Makefile.coq.compat_84_85-early submodule-update SUPER_FAST_TARGETS += submodule-update Makefile.coq: etc/coq-scripts/Makefile.coq.common etc/coq-scripts/compatibility/Makefile.coq.compat_84_85 etc/coq-scripts/compatibility/Makefile.coq.compat_84_85-early