Makefile_caml.tpl must be copied as
Makefile
in the project directory.
Makefile
must exist in the directory where
your source code files are.Makefile
that are specific to
your application:
SOURCES =
the list of Caml sources (including
camlyacc and camllex source files).
EXEC = a.out
replace a.out by the name of the
executable program you want to create.
.depend
file (executing touch
.depend
under Unix).
This file will contain the list of compilation dependencies automatically
generated by the Makefile when executing the command make
depend
.make
. Type make
again each time you
modify one of the source files of the program.In addition, the Makefile
file offers the following entry points:
make clean
removes the executable program and all
the object files (compiled Caml files).make depend
computes the dependencies between the
modules of the program, hence tries to find a correct compilation order to
recompile the application.make
rebuilds the executable program, recompiling
what has to be recompiled.make all
combine make depend
and
make
, hence recomputes dependencies and then rebuilds the
application.make clean; make all
is the normal sequence to
recompile the program from scratch.If you use Caml libraries (such as graphics, unix, or nums), you
must set the line LIBS=
with the list of libraries you
use. The names of these libraries for Make are listed in the Makefile:
each ``name'' is in fact a Make macro that adds the relevant options to
the Caml compiler. For instance, to use both ``graphics'' and ``unix''
you should write:
LIBS=WITHGRAPHICS WITHUNIX
Advanced Caml programmers generally agree that the simplest way of
developing Caml programs is to use make
from within the
emacs
editor: call make
with the emacs
command Meta-X compile
. If an error occurs, the editor
points to the precise file and line where the Caml compiler found the
error, if you type in Meta-X next-error
. The command Meta-X
compile
is generally bound to the keystrokes combination
CTRL-C CTRL-C
, while Meta-X next-error
is bound to CTRL-X `
.
This means that the entire compilation + error finding process just
needs to 4 key-strokes.
Contact the author Pierre.Weis@inria.fr