aboutsummaryrefslogtreecommitdiff
path: root/Makefile.submodule
blob: 78f3012109785c77d6b1fb14d6fcac71fa0f1564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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