Skip to content

Project build scripts

Karl Palmskog edited this page Jan 4, 2020 · 3 revisions

The current preferred way of building a Coq project is to use coq_makefile to generate a project-specific makefile from a _CoqProject file, and then invoke the all task in this makefile.

The recommended way of automating this is to have a top-level makefile called Makefile in the project root directory, which invokes coq_makefile to produce a file called Makefile.coq. Makefile can then expose and delegate to pre-defined tasks inside Makefile.coq, such as install.

Here is an example top-level makefile:

all: Makefile.coq
        @+$(MAKE) -f Makefile.coq all

clean: Makefile.coq
        @+$(MAKE) -f Makefile.coq cleanall
        @rm -f Makefile.coq Makefile.coq.conf

Makefile.coq: _CoqProject
        $(COQBIN)coq_makefile -f _CoqProject -o Makefile.coq

force _CoqProject Makefile: ;

%: Makefile.coq force
        @+$(MAKE) -f Makefile.coq $@

.PHONY: all clean force