summaryrefslogtreecommitdiff
path: root/tests/coq/Makefile
blob: af4753ee6bf460bcc3dab3b9325278c1ea22bc75 (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
36
37
38
39
40
41
42
43
44
45
ALL_DIRS ?= $(filter-out %.template, $(filter-out Makefile%, $(wildcard *)))

VERIFY_DIRS = $(addprefix verif-,$(ALL_DIRS))

CLEAN_DIRS = $(addprefix clean-,$(ALL_DIRS))

COPY_MAKEFILES = $(addprefix copy-makefile-,$(ALL_DIRS))

GEN_COQ_PROJECT = $(addprefix gen-coq-project-,$(ALL_DIRS))

.PHONY: all
all: prepare-projects verify

.PHONY: prepare-projects
prepare-projects: $(COPY_MAKEFILES) $(GEN_COQ_PROJECT)

.PHONY: verify
verify: $(VERIFY_DIRS)

.PHONY: verif-%
verif-%:
	cd $* && make all

.PHONY: copy-makefile-%
copy-makefile-%:
	rm -f $*/Makefile
	echo "# This file was automatically generated - modify ../Makefile.template instead" >> $*/Makefile
	cat Makefile.template >> $*/Makefile

.PHONY: gen-coq-project-%
gen-coq-project-%:
	rm -f $*/_CoqProject
	echo "# This file was automatically generated - see ../Makefile" >> $*/_CoqProject
	cat _CoqProject.template >> $*/_CoqProject
	echo $(wildcard $*/*.v) >> $*/_CoqProject # List the .v files
	sed -i -z "s/"$*"\//\n/g" $*/_CoqProject # Insert breaks
	sed -i -z "s/ \n/\n/g" $*/_CoqProject # Remove whitespaces at the end of lines
	cat $*/_CoqProject

.PHONY: clean
clean: $(CLEAN_DIRS)

.PHONY: clean-%
clean-%:
	cd $* && make clean