12.3 Creating a Makefile for Coq modules
When a proof development becomes large and is split into several files,
it becomes crucial to use a tool like make to compile Coq
modules.
The writing of a generic and complete Makefile may be a tedious work
and that's why Coq provides a tool to automate its creation,
coq_makefile. Given the files to compile, the command coq_makefile prints a
Makefile on the standard output. So one has just to run the
command:
% coq_makefile file1.v ... filen.v > Makefile
The resulted Makefile has a target depend which computes the
dependencies and puts them in a separate file .depend, which is
included by the Makefile.
Therefore, you should create such a file before the first invocation
of make. You can for instance use the command
% touch .depend
Then, to initialize or update the modules dependencies, type in:
% make depend
There is a target all to compile all the files file1
... filen, and a generic target to produce a .vo file from
the corresponding .v file (so you can do make file.vo
to compile the file file.v).
coq_makefile can also handle the case of ML files and
subdirectories. For more options type
% coq_makefile --help
Warning: To compile a project containing Objective Caml files you must keep
the sources of Coq somewhere and have an environment variable named
COQTOP that points to that directory.