Makefile_ocaml.tpl must be copied as
Makefile in the project directory.
Makefilemust exist in the directory where your source code files are.
Makefilethat are specific to your application:
SOURCES =the list of Caml sources (including ocamlyacc and ocamllex source files).
EXEC = a.outreplace a.out by the name of the executable program you want to create.
touch .dependunder Unix). This file will contain the list of compilation dependencies automatically generated by the Makefile when executing the command
makeagain each time you modify of one of the source files of the program.
In addition, the
Makefile file offers the following entry points:
make cleanremoves the executable program and all the object files (compiled Caml files).
make dependcomputes the dependencies between the modules of the program, hence tries to find a correct compilation order to recompile the application.
makerebuilds the executable program, recompiling what has to be recompiled.
make, hence recomputes dependencies and then rebuilds the application.
make clean; make allis 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:
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
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
compile is generally bound to the keystrokes combination
CTRL-C CTRL-C, while
is bound to
This means that the entire compilation + error finding process just needs to 4 key-strokes.
Contact the author Pierre.Weis@inria.fr