Skip to content
Snippets Groups Projects
Commit a82de588 authored by Ralf Jung's avatar Ralf Jung
Browse files

update build system

This makes "make vio2vo J=X" first call "make quick", and the target is incremental so it will do less useless work.
This also fixes a bug in "make uninstall".
parent bcecccd9
No related branches found
No related tags found
1 merge request!5update build system and Iris
...@@ -8,7 +8,7 @@ COQ_VERSION=$(shell coqc --version | egrep -o 'version 8.[0-9]' | egrep -o '8.[0 ...@@ -8,7 +8,7 @@ COQ_VERSION=$(shell coqc --version | egrep -o 'version 8.[0-9]' | egrep -o '8.[0
COQ_MAKEFILE_FLAGS ?= COQ_MAKEFILE_FLAGS ?=
ifeq ($(COQ_VERSION), 8.6) ifeq ($(COQ_VERSION), 8.6)
COQ_MAKEFILE_FLAGS += -arg -w -arg -notation-overridden,-redundant-canonical-projection COQ_MAKEFILE_FLAGS += -arg -w -arg -notation-overridden,-redundant-canonical-projection,-several-object-files
endif endif
# Forward most targets to Coq makefile (with some trick to make this phony) # Forward most targets to Coq makefile (with some trick to make this phony)
...@@ -23,16 +23,10 @@ clean: Makefile.coq ...@@ -23,16 +23,10 @@ clean: Makefile.coq
find \( -name "*.v.d" -o -name "*.vo" -o -name "*.aux" -o -name "*.cache" -o -name "*.glob" -o -name "*.vio" \) -print -delete find \( -name "*.v.d" -o -name "*.vo" -o -name "*.aux" -o -name "*.cache" -o -name "*.glob" -o -name "*.vio" \) -print -delete
rm -f Makefile.coq rm -f Makefile.coq
# Create Coq Makefile # Create Coq Makefile. POSIX awk can't do in-place editing, but coq_makefile wants the real filename, so we do some file gymnastics.
Makefile.coq: _CoqProject Makefile Makefile.coq: _CoqProject Makefile awk.Makefile
@# we want to pass the correct name to coq_makefile or it will be confused.
coq_makefile $(COQ_MAKEFILE_FLAGS) -f _CoqProject -o Makefile.coq coq_makefile $(COQ_MAKEFILE_FLAGS) -f _CoqProject -o Makefile.coq
mv Makefile.coq Makefile.coq.tmp mv Makefile.coq Makefile.coq.tmp && awk -f awk.Makefile Makefile.coq.tmp > Makefile.coq && rm Makefile.coq.tmp
@# The sed script is for Coq 8.5 only, it fixes 'make verify'.
@# The awk script fixes 'make uninstall'.
sed 's/$$(COQCHK) $$(COQCHKFLAGS) $$(COQLIBS)/$$(COQCHK) $$(COQCHKFLAGS) $$(subst -Q,-R,$$(COQLIBS))/' < Makefile.coq.tmp \
| awk '/^uninstall:/{print "uninstall:";print "\tif [ -d \"$$(DSTROOT)\"$$(COQLIBINSTALL)/iris/ ]; then find \"$$(DSTROOT)\"$$(COQLIBINSTALL)/iris/ -name \"*.vo\" -print -delete; fi";getline;next}1' > Makefile.coq
rm Makefile.coq.tmp
# Install build-dependencies # Install build-dependencies
build-dep: build-dep:
...@@ -42,9 +36,10 @@ build-dep: ...@@ -42,9 +36,10 @@ build-dep:
opam install coq-gps --deps-only $(YFLAG) opam install coq-gps --deps-only $(YFLAG)
opam pin remove coq-gps opam pin remove coq-gps
# some fiels that do *not* need to be forwarded to Makefile.coq # Some files that do *not* need to be forwarded to Makefile.coq
Makefile: ; Makefile: ;
_CoqProject: ; _CoqProject: ;
awk.Makefile: ;
# Phony targets (i.e. targets that should be run no matter the timestamps of the involved files) # Phony targets (i.e. targets that should be run no matter the timestamps of the involved files)
phony: ; phony: ;
......
# awk program that patches the Makefile generated by Coq.
# Patch the uninstall target to work properly, and to also uninstall stale files.
# Also see <https://coq.inria.fr/bugs/show_bug.cgi?id=4907>.
/^uninstall:/ {
print "uninstall:";
print "\tif [ -d \"$$(DSTROOT)\"$$(COQLIBINSTALL)/ra/ ]; then find \"$$(DSTROOT)\"$$(COQLIBINSTALL)/ra/ -name \"*.vo\" -print -delete; fi";
getline;
next
}
# Patch vio2vo to (a) run "make quick" with the same number of jobs, ensuring
# that the .vio files are up-to-date, and (b) only schedule vio2vo for those
# files where the .vo is *older* than the .vio.
/^vio2vo:/ {
print "vio2vo:";
print "\t@make -j $(J) quick"
print "\t@VIOFILES=$$(for file in $(VOFILES:%.vo=%.vio); do vofile=\"$$(echo \"$$file\" | sed \"s/\\.vio/.vo/\")\"; if [ \"$$vofile\" -ot \"$$file\" -o ! -e \"$$vofile\" ]; then echo -n \"$$file \"; fi; done); \\"
print "\t echo \"VIO2VO: $$VIOFILES\"; \\"
print "\t if [ -n \"$$VIOFILES\" ]; then $(COQC) $(COQDEBUG) $(COQFLAGS) -schedule-vio2vo $(J) $$VIOFILES; fi"
getline;
next
}
# This forwards all unchanged lines
1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment