| 30 |
ashish |
1 |
---------------------------------------------------------------------------
|
|
|
2 |
|
|
|
3 |
Distribution of "ocaml_make"
|
|
|
4 |
Copyright (C) 1999 - 2006 Markus Mottl - free to copy and modify!
|
|
|
5 |
USE AT YOUR OWN RISK!
|
|
|
6 |
|
|
|
7 |
---------------------------------------------------------------------------
|
|
|
8 |
|
|
|
9 |
PREREQUISITES
|
|
|
10 |
|
|
|
11 |
*** YOU WILL NEED GNU-MAKE VERSION >3.80 ***
|
|
|
12 |
|
|
|
13 |
---------------------------------------------------------------------------
|
|
|
14 |
|
|
|
15 |
Contents of this distribution
|
|
|
16 |
|
|
|
17 |
Changes - guess what? ;-)
|
|
|
18 |
|
|
|
19 |
OCamlMakefile - Makefile for easy handling of compilation of not so easy
|
|
|
20 |
OCaml-projects. It generates dependencies of OCaml-files
|
|
|
21 |
automatically, is able to handle "ocamllex"-,
|
|
|
22 |
"ocamlyacc"-, IDL- and C-files, knows how to run
|
|
|
23 |
preprocessors and generates native- or byte-code, as
|
|
|
24 |
executable or as library - with thread-support if you
|
|
|
25 |
want! Profiling and debugging support can be added on
|
|
|
26 |
the fly! There is also support for installing libraries.
|
|
|
27 |
Ah, yes, and you can also create toplevels from any
|
|
|
28 |
sources: this allows you immediate interactive testing.
|
|
|
29 |
Automatic generation of documentation is easy due to
|
|
|
30 |
integration of support for OCamldoc.
|
|
|
31 |
|
|
|
32 |
README - this file
|
|
|
33 |
|
|
|
34 |
calc/ - Directory containing a quite fully-featured example
|
|
|
35 |
of what "OCamlMakefile" can do for you. This example
|
|
|
36 |
makes use of "ocamllex", "ocamlyacc", IDL + C and
|
|
|
37 |
threads.
|
|
|
38 |
|
|
|
39 |
camlp4/ - This simple example demonstrates how to automatically
|
|
|
40 |
preprocess files with the camlp4-preprocessor.
|
|
|
41 |
|
|
|
42 |
gtk/ - Demonstration of how to use OCamlMakefile with GTK
|
|
|
43 |
and threads. Courtesy of Tim Freeman <tim@fungible.com>.
|
|
|
44 |
|
|
|
45 |
idl/ - Contains a very small example of how to use
|
|
|
46 |
"camlidl" together with "OCamlMakefile". Also intended
|
|
|
47 |
to show, how easy it is to interface OCaml and C.
|
|
|
48 |
|
|
|
49 |
threads/ - Two examples of how to use threads (originally
|
|
|
50 |
posted by Xavier Leroy some time ago). Shows the use of
|
|
|
51 |
"OCamlMakefile" in an environment of multiple compilation
|
|
|
52 |
targets.
|
|
|
53 |
|
|
|
54 |
---------------------------------------------------------------------------
|
|
|
55 |
|
|
|
56 |
Why should you use it?
|
|
|
57 |
|
|
|
58 |
For several reasons:
|
|
|
59 |
|
|
|
60 |
* It is well-tested (I use it in all of my projects).
|
|
|
61 |
|
|
|
62 |
* In contrast to most other approaches it generates dependencies
|
|
|
63 |
correctly by ensuring that all automatically generated OCaml-files
|
|
|
64 |
exist before dependency calculation. This is the only way to
|
|
|
65 |
guarantee that "ocamldep" works correctly.
|
|
|
66 |
|
|
|
67 |
* It is extremely convenient (at least I think so ;-).
|
|
|
68 |
Even quite complex compilation processes (see example "calc.ml")
|
|
|
69 |
need very little information to work correctly - actually just about
|
|
|
70 |
the minimum (file names of sources).
|
|
|
71 |
|
|
|
72 |
---------------------------------------------------------------------------
|
|
|
73 |
|
|
|
74 |
When you shouldn't use it...
|
|
|
75 |
|
|
|
76 |
In projects where every compilation unit needs different flags - but
|
|
|
77 |
in such complicated cases you will be on your own anyway. Luckily,
|
|
|
78 |
this doesn't happen too frequently...
|
|
|
79 |
|
|
|
80 |
---------------------------------------------------------------------------
|
|
|
81 |
|
|
|
82 |
How to use "OCamlMakefile" in your own project
|
|
|
83 |
(Take a look at the examples for a quick introduction!)
|
|
|
84 |
|
|
|
85 |
Create your project-specific "Makefile" in the appropriate directory.
|
|
|
86 |
|
|
|
87 |
Now there are two ways of making use of "OCamlMakefile":
|
|
|
88 |
|
|
|
89 |
1) Have a look at the default settings in "OCamlMakefile" and set
|
|
|
90 |
them to the values that are vaild on your system - whether the
|
|
|
91 |
path to the standard libraries is ok, what executables shall be
|
|
|
92 |
used, etc...
|
|
|
93 |
|
|
|
94 |
2) Copy it into the directory of the project to be compiled.
|
|
|
95 |
Add "-include OCamlMakefile" as a last line of your "Makefile".
|
|
|
96 |
|
|
|
97 |
3) Put it somewhere else on the system. In this case you will have to
|
|
|
98 |
set a variable "OCAMLMAKEFILE" in your project-specific "Makefile".
|
|
|
99 |
This is the way in which the examples are written: so you need
|
|
|
100 |
only one version of "OCamlMakefile" to manage all your projects!
|
|
|
101 |
See the examples for details.
|
|
|
102 |
|
|
|
103 |
You should usually specify two further variables for your project:
|
|
|
104 |
|
|
|
105 |
* SOURCES (default: foo.ml)
|
|
|
106 |
* RESULT (default: foo)
|
|
|
107 |
|
|
|
108 |
Put all the sources necessary for a target into variable "SOURCES".
|
|
|
109 |
Then set "RESULT" to the name of the target. If you want to generate
|
|
|
110 |
libraries, you should *not* specify the suffix (".cma", ".cmxa", ".a")
|
|
|
111 |
- it will be added automatically if you specify that you want to build
|
|
|
112 |
a library.
|
|
|
113 |
|
|
|
114 |
** Don't forget to add the ".mli"-files, too! **
|
|
|
115 |
** Don't forget that order of the source files matters! **
|
|
|
116 |
|
|
|
117 |
The order is important, because it matters during linking anyway
|
|
|
118 |
due to potential side effects caused at program startup. This is
|
|
|
119 |
why OCamlMakefile does not attempt to partially order dependencies by
|
|
|
120 |
itself, which might confuse users even more. It just compiles and links
|
|
|
121 |
OCaml-sources in the order specified by the user, even if it could
|
|
|
122 |
determine automatically that the order cannot be correct.
|
|
|
123 |
|
|
|
124 |
The minimum of your "Makefile" looks like this (assuming that
|
|
|
125 |
"OCamlMakefile" is in the search path of "make"):
|
|
|
126 |
|
|
|
127 |
-include OCamlMakefile
|
|
|
128 |
|
|
|
129 |
This will assume that you want to compile a file "foo.ml" to a binary
|
|
|
130 |
"foo".
|
|
|
131 |
|
|
|
132 |
Otherwise, your Makefile will probably contain something like this:
|
|
|
133 |
|
|
|
134 |
SOURCES = foo.ml
|
|
|
135 |
RESULT = foo
|
|
|
136 |
-include OCamlMakefile
|
|
|
137 |
|
|
|
138 |
Be careful with the names you put into these variables: if they are wrong,
|
|
|
139 |
a "make clean" might erase the wrong files - but I know you will not do
|
|
|
140 |
that ;-)
|
|
|
141 |
|
|
|
142 |
A simple "make" will generate a byte-code executable. If you want to
|
|
|
143 |
change this, you may add an "all"-rule that generates something else.
|
|
|
144 |
|
|
|
145 |
E.g.:
|
|
|
146 |
|
|
|
147 |
SOURCES = foo.ml
|
|
|
148 |
RESULT = foo
|
|
|
149 |
all: native-code-library
|
|
|
150 |
-include OCamlMakefile
|
|
|
151 |
|
|
|
152 |
This will build a native-code library "foo.cmxa" (+ "foo.a") from file
|
|
|
153 |
"foo.ml".
|
|
|
154 |
|
|
|
155 |
You may even build several targets at once. To produce byte- and native-code
|
|
|
156 |
executables with one "make", add the following rule:
|
|
|
157 |
|
|
|
158 |
all: byte-code native-code
|
|
|
159 |
|
|
|
160 |
You will probably want to use a different suffix for each of these targets
|
|
|
161 |
so that the result will not be overwritten (see optional variables below
|
|
|
162 |
for details).
|
|
|
163 |
|
|
|
164 |
You may also tell "make" at the command-line what kind of target to
|
|
|
165 |
produce (e.g. "make nc"). Here all the possibilities with shortcuts
|
|
|
166 |
between parenthesis:
|
|
|
167 |
|
|
|
168 |
* byte-code (bc)
|
|
|
169 |
* byte-code-nolink (bcnl) - no linking stage
|
|
|
170 |
* byte-code-library (bcl)
|
|
|
171 |
* native-code (nc)
|
|
|
172 |
* native-code-nolink (ncnl) - no linking stage
|
|
|
173 |
* native-code-library (ncl)
|
|
|
174 |
* debug-code (dc)
|
|
|
175 |
* debug-code-nolink (dcnl) - no linking stage
|
|
|
176 |
* debug-code-library (dcl)
|
|
|
177 |
* profiling-byte-code (pbc)
|
|
|
178 |
* profiling-byte-code-library (pbcl)
|
|
|
179 |
* profiling-native-code (pnc)
|
|
|
180 |
* profiling-native-code-library (pncl)
|
|
|
181 |
* byte-code-dll (bcd)
|
|
|
182 |
* native-code-dll (ncd)
|
|
|
183 |
* pack-byte-code (pabc)
|
|
|
184 |
* pack-native-code (panc)
|
|
|
185 |
* toplevel interpreter (top)
|
|
|
186 |
* subprojs
|
|
|
187 |
|
|
|
188 |
Here a short note concerning building and linking byte code libraries
|
|
|
189 |
with C-files:
|
|
|
190 |
|
|
|
191 |
OCaml links C-object files only when they are used in an executable.
|
|
|
192 |
After compilation they should be placed in some directory that is in
|
|
|
193 |
your include path if you link your library against an executable.
|
|
|
194 |
|
|
|
195 |
It is sometimes more convenient to link all C-object files into a
|
|
|
196 |
single C-library. Then you have to override the automatic link flags
|
|
|
197 |
of your library using "-noautolink" and add another linkflag that
|
|
|
198 |
links in your C-library explicitly.
|
|
|
199 |
|
|
|
200 |
What concerns maintainance:
|
|
|
201 |
|
|
|
202 |
"make clean" removes all (all!) automatically generated files - so
|
|
|
203 |
again: make sure your variables are ok!
|
|
|
204 |
|
|
|
205 |
"make cleanup" is similar to "make clean" but leaves executables.
|
|
|
206 |
|
|
|
207 |
Another way to destroy some important files is by having "OCamlMakefile"
|
|
|
208 |
automatically generate files with the same name. Read the documentation
|
|
|
209 |
about the tools in the OCaml-distribution to see what kind of files are
|
|
|
210 |
generated. "OCamlMakefile" additionally generates ('%' is basename of
|
|
|
211 |
source file):
|
|
|
212 |
|
|
|
213 |
%_idl.c - "camlidl" generates a file "%.c" from "%.idl", but this is
|
|
|
214 |
not such a good idea, because when generating native-code,
|
|
|
215 |
both the file "%.c" and "%.ml" would generate files "%.o"
|
|
|
216 |
which would overwrite each other. Thus, "OCamlMakefile"
|
|
|
217 |
renames "%.c" to "%_idl.c" to work around this problem.
|
|
|
218 |
|
|
|
219 |
The dependencies are stored in three different subdirectories (dot dirs):
|
|
|
220 |
|
|
|
221 |
._d - contains dependencies for .ml-files
|
|
|
222 |
._bcdi - contains byte code dependencies for .mli-files
|
|
|
223 |
._ncdi - contains native code dependencies for .mli-files
|
|
|
224 |
|
|
|
225 |
The endings of the dependency files are: "%.d" for those generated from
|
|
|
226 |
"%.ml"-files, "%.di" for ones derived from "%.mli"-files.
|
|
|
227 |
|
|
|
228 |
---------------------------------------------------------------------------
|
|
|
229 |
|
|
|
230 |
Debugging
|
|
|
231 |
|
|
|
232 |
This is easy: if you discover a bug, just do a "make clean; make dc"
|
|
|
233 |
to recompile your project with debugging information. Then you can
|
|
|
234 |
immediately apply "ocamldebug" to the executable.
|
|
|
235 |
|
|
|
236 |
---------------------------------------------------------------------------
|
|
|
237 |
|
|
|
238 |
Profiling
|
|
|
239 |
|
|
|
240 |
For generating code that can be profiled with "ocamlprof" (byte code)
|
|
|
241 |
or "gprof" (native code), compile your project with one of the profiling
|
|
|
242 |
targets (see targets above). E.g.:
|
|
|
243 |
|
|
|
244 |
* "make pbc" will build byte code that can be profiled with
|
|
|
245 |
"ocamlprof".
|
|
|
246 |
|
|
|
247 |
* "make pnc" will build native code that can be profiled with
|
|
|
248 |
"gprof".
|
|
|
249 |
|
|
|
250 |
Please note that it is not currently possible to profile byte code with
|
|
|
251 |
threads. OCamlMakefile will force an error if you try to do this.
|
|
|
252 |
|
|
|
253 |
A short hint for DEC Alpha-users (under Digital Unix): you may also
|
|
|
254 |
compile your sources to native code without any further profiling
|
|
|
255 |
options/targets. Then call "pixie my_exec", "my_exec" being your
|
|
|
256 |
executable. This will produce (among other files) an executable
|
|
|
257 |
"my_exec.pixie". Call it and it will produce profiling information which
|
|
|
258 |
can be analysed using "prof -pixie my_exec". The resulting information
|
|
|
259 |
is extremely detailed and allows analysis up to the clock cycle level...
|
|
|
260 |
|
|
|
261 |
---------------------------------------------------------------------------
|
|
|
262 |
|
|
|
263 |
Using Preprocessors
|
|
|
264 |
|
|
|
265 |
Because one could employ any kind of program that reads from standard
|
|
|
266 |
input and prints to standard output as preprocessor, there cannot be any
|
|
|
267 |
default way to handle all of them correctly without further knowledge.
|
|
|
268 |
|
|
|
269 |
Therefore you have to cooperate a bit with OCamlMakefile to let
|
|
|
270 |
preprocessing happen automatically. Basically, this only requires
|
|
|
271 |
that you put a comment into the first line of files that should be
|
|
|
272 |
preprocessed, e.g.:
|
|
|
273 |
|
|
|
274 |
(*pp cat *)
|
|
|
275 |
... rest of program ...
|
|
|
276 |
|
|
|
277 |
OCamlMakefile looks at the first line of your files, and if it finds
|
|
|
278 |
a comment that starts with "(*pp", then it will assume that the
|
|
|
279 |
rest of the comment tells it how to correctly call the appropriate
|
|
|
280 |
preprocessor. In this case the program "cat" will be called, which will,
|
|
|
281 |
of course, just output the source text again without changing it.
|
|
|
282 |
|
|
|
283 |
If you are, for example, an advocate of the new "revised syntax",
|
|
|
284 |
which is supported by the camlp4 preprocessor, you could simply write:
|
|
|
285 |
|
|
|
286 |
(*pp camlp4r *)
|
|
|
287 |
... rest of program in revised syntax ...
|
|
|
288 |
|
|
|
289 |
Simple, isn't it?
|
|
|
290 |
|
|
|
291 |
If you want to write your own syntax extensions, just take a look at the
|
|
|
292 |
example in the directory "camlp4": it implements the "repeat ... until"
|
|
|
293 |
extension as described in the camlp4-tutorial.
|
|
|
294 |
|
|
|
295 |
---------------------------------------------------------------------------
|
|
|
296 |
|
|
|
297 |
Library (Un-)Installation Support
|
|
|
298 |
|
|
|
299 |
OCamlMakefile contains two targets using "ocamlfind" for this purpose:
|
|
|
300 |
|
|
|
301 |
* libinstall
|
|
|
302 |
* libuninstall
|
|
|
303 |
|
|
|
304 |
These two targets require the existence of the variable
|
|
|
305 |
"LIBINSTALL_FILES", which should be set to all the files that you
|
|
|
306 |
want to install in the library directory (usually %.mli, %.cmi, %.cma,
|
|
|
307 |
%.cmxa, %.a and possibly further C-libraries). The target "libinstall"
|
|
|
308 |
has the dependency "all" to force compilation of the library so make
|
|
|
309 |
sure you define target "all" in your Makefile appropriately.
|
|
|
310 |
|
|
|
311 |
The targets inform the user about the configured install path and ask
|
|
|
312 |
for confirmation to (un)install there. If you want to use them, it
|
|
|
313 |
is often a good idea to just alias them in your Makefile to "install"
|
|
|
314 |
and "uninstall" respectively.
|
|
|
315 |
|
|
|
316 |
Two other targets allow installation of files into a particular
|
|
|
317 |
directory (without using ocamlfind):
|
|
|
318 |
|
|
|
319 |
* rawinstall
|
|
|
320 |
* rawuninstall
|
|
|
321 |
|
|
|
322 |
---------------------------------------------------------------------------
|
|
|
323 |
|
|
|
324 |
Building toplevels
|
|
|
325 |
|
|
|
326 |
There is just one target for this:
|
|
|
327 |
|
|
|
328 |
* top
|
|
|
329 |
|
|
|
330 |
The generated file can be used immediately for interactive sessions -
|
|
|
331 |
even with scanners, parsers, C-files, etc.!
|
|
|
332 |
|
|
|
333 |
---------------------------------------------------------------------------
|
|
|
334 |
|
|
|
335 |
Generating documentation
|
|
|
336 |
|
|
|
337 |
The following targets are supported:
|
|
|
338 |
|
|
|
339 |
* htdoc - generates HTML-documentation
|
|
|
340 |
* ladoc - generates Latex-documentation
|
|
|
341 |
* psdoc - generates PostScript-documentation
|
|
|
342 |
* pdfdoc - generates PDF-documentation
|
|
|
343 |
* doc - generates all supported forms of documentation
|
|
|
344 |
* clean-doc - generates all supported forms of documentation
|
|
|
345 |
|
|
|
346 |
All of them generate a sub-directory "doc". More precisely, for HTML it
|
|
|
347 |
is "doc/$(RESULT)/html" and for Latex, PostScript and PDF the directory
|
|
|
348 |
"doc/$(RESULT)/latex". See the OCamldoc-manual for details and the
|
|
|
349 |
optional variables below for settings you can control.
|
|
|
350 |
|
|
|
351 |
---------------------------------------------------------------------------
|
|
|
352 |
|
|
|
353 |
Handling subprojects
|
|
|
354 |
|
|
|
355 |
You can have several targets in the same directory and manage them
|
|
|
356 |
from within an single Makefile.
|
|
|
357 |
|
|
|
358 |
Give each subproject a name, e.g. "p1", "p2", etc. Then you export
|
|
|
359 |
settings specific to each project by using variables of the form
|
|
|
360 |
"PROJ_p1", "PROJ_p2", etc. E.g.:
|
|
|
361 |
|
|
|
362 |
define PROJ_p1
|
|
|
363 |
SOURCES="foo.ml main.ml"
|
|
|
364 |
RESULT="p1"
|
|
|
365 |
OCAMLFLAGS="-unsafe"
|
|
|
366 |
endef
|
|
|
367 |
export PROJ_p1
|
|
|
368 |
|
|
|
369 |
define PROJ_p2
|
|
|
370 |
...
|
|
|
371 |
endef
|
|
|
372 |
export PROJ_p2
|
|
|
373 |
|
|
|
374 |
You may also export common settings used by all projects directly, e.g.
|
|
|
375 |
"export THREADS = y".
|
|
|
376 |
|
|
|
377 |
Now it is a good idea to define, which projects should be affected by
|
|
|
378 |
commands by default. E.g.:
|
|
|
379 |
|
|
|
380 |
ifndef SUBPROJS
|
|
|
381 |
export SUBPROJS = p1 p2
|
|
|
382 |
endif
|
|
|
383 |
|
|
|
384 |
This will automatically generate a given target for all those
|
|
|
385 |
subprojects if this variable has not been defined in the shell
|
|
|
386 |
environment or in the command line of the make-invocation by the user.
|
|
|
387 |
E.g., "make dc" will generate debug code for all subprojects.
|
|
|
388 |
|
|
|
389 |
Then you need to define a default action for your subprojects if "make"
|
|
|
390 |
has been called without arguments:
|
|
|
391 |
|
|
|
392 |
all: bc
|
|
|
393 |
|
|
|
394 |
This will build byte code by default for all subprojects.
|
|
|
395 |
|
|
|
396 |
Finally, you'll have to define a catch-all target that uses the target
|
|
|
397 |
provided by the user for all subprojects. Just add (assuming that
|
|
|
398 |
OCAMLMAKEFILE has been defined appropriately):
|
|
|
399 |
|
|
|
400 |
%:
|
|
|
401 |
@make -f $(OCAMLMAKEFILE) subprojs SUBTARGET=$@
|
|
|
402 |
|
|
|
403 |
See the "threads"-directory in the distribution for a short example!
|
|
|
404 |
|
|
|
405 |
---------------------------------------------------------------------------
|
|
|
406 |
|
|
|
407 |
Optional variables that may be passed to "OCamlMakefile"
|
|
|
408 |
|
|
|
409 |
* LIB_PACK_NAME - packs all modules of a library into a module whose
|
|
|
410 |
name is given in variable "LIB_PACK_NAME".
|
|
|
411 |
|
|
|
412 |
* RES_CLIB_SUF - when building a library that contains C-stubs, this
|
|
|
413 |
variable controls the suffix appended to the name
|
|
|
414 |
of the C-library (default: "_stubs").
|
|
|
415 |
|
|
|
416 |
* THREADS - say "THREADS = yes" if you need thread support compiled in,
|
|
|
417 |
otherwise leave it away.
|
|
|
418 |
|
|
|
419 |
* VMTHREADS - say "VMTHREADS = yes" if you want to force VM-level
|
|
|
420 |
scheduling of threads (byte-code only).
|
|
|
421 |
|
|
|
422 |
* ANNOTATE - say "ANNOTATE = yes" to generate type annotation files
|
|
|
423 |
(.annot) to support displaying of type information
|
|
|
424 |
in editors.
|
|
|
425 |
|
|
|
426 |
* USE_CAMLP4 - say "USE_CAMLP4 = yes" in your "Makefile" if you
|
|
|
427 |
want to include the camlp4 directory during the
|
|
|
428 |
build process, otherwise leave it away.
|
|
|
429 |
|
|
|
430 |
* INCDIRS - directories that should be searched for ".cmi"- and
|
|
|
431 |
".cmo"-files. You need not write "-I ..." - just the
|
|
|
432 |
plain names.
|
|
|
433 |
* LIBDIRS - directories that should be searched for libraries
|
|
|
434 |
Also just put the plain paths into this variable
|
|
|
435 |
* EXTLIBDIRS - Same as "LIBDIRS", but paths in this variable are
|
|
|
436 |
also added to the binary via the "-R"-flag so that
|
|
|
437 |
dynamic libraries in non-standard places can be found.
|
|
|
438 |
* RESULTDEPS - Targets on which results (executables or libraries)
|
|
|
439 |
should additionally depend.
|
|
|
440 |
|
|
|
441 |
* PACKS - adds packages under control of "findlib".
|
|
|
442 |
|
|
|
443 |
* PREDS - specifies "findlib"-predicates.
|
|
|
444 |
|
|
|
445 |
* LIBS - OCaml-libraries that should be linked (just plain names).
|
|
|
446 |
E.g. if you want to link the Str-library, just write
|
|
|
447 |
"str" (without quotes).
|
|
|
448 |
The new OCaml-compiler handles libraries in such
|
|
|
449 |
a way that they "remember" whether they have to
|
|
|
450 |
be linked against a C-library and it gets linked
|
|
|
451 |
in automatically.
|
|
|
452 |
If there is a slash in the library name (such as
|
|
|
453 |
"./str" or "lib/foo") then make is told that the
|
|
|
454 |
generated files depend on the library. This
|
|
|
455 |
helps to ensure that changes to your libraries are
|
|
|
456 |
taken into account, which is important if you are
|
|
|
457 |
regenerating your libraries frequently.
|
|
|
458 |
* CLIBS - C-libraries that should be linked (just plain names).
|
|
|
459 |
|
|
|
460 |
* PRE_TARGETS - set this to a list of target files that you want
|
|
|
461 |
to have buildt before dependency calculation actually
|
|
|
462 |
takes place. E.g. use this to automatically compile
|
|
|
463 |
modules needed by camlp4, which have to be available
|
|
|
464 |
before other modules can be parsed at all.
|
|
|
465 |
|
|
|
466 |
** WARNING **: the files mentioned in this variable
|
|
|
467 |
will be removed when "make clean" is executed!
|
|
|
468 |
|
|
|
469 |
* LIBINSTALL_FILES - the files of a library that should be installed
|
|
|
470 |
using "findlib". Default:
|
|
|
471 |
|
|
|
472 |
$(RESULT).mli $(RESULT).cmi $(RESULT).cma
|
|
|
473 |
$(RESULT).cmxa $(RESULT).a lib$(RESULT).a
|
|
|
474 |
|
|
|
475 |
* OCAML_LIB_INSTALL - target directory for "rawinstall/rawuninstall".
|
|
|
476 |
(default: $(OCAMLLIBPATH)/contrib)
|
|
|
477 |
|
|
|
478 |
* DOC_FILES - names of files from which documentation is generated.
|
|
|
479 |
(default: all .mli-files in your $(SOURCES)).
|
|
|
480 |
|
|
|
481 |
* DOC_DIR - name of directory where documentation should be stored.
|
|
|
482 |
|
|
|
483 |
* OCAMLFLAGS - flags passed to the compilers
|
|
|
484 |
* OCAMLBCFLAGS - flags passed to the byte code compiler only
|
|
|
485 |
* OCAMLNCFLAGS - flags passed to the native code compiler only
|
|
|
486 |
|
|
|
487 |
* OCAMLLDFLAGS - flags passed to the OCaml-linker
|
|
|
488 |
* OCAMLBLDFLAGS - flags passed to the OCaml-linker when linking byte code
|
|
|
489 |
* OCAMLNLDFLAGS - flags passed to the OCaml-linker when linking
|
|
|
490 |
native code
|
|
|
491 |
|
|
|
492 |
* OCAMLMKLIB_FLAGS - flags passed to the OCaml library tool
|
|
|
493 |
|
|
|
494 |
* OCAMLCPFLAGS - profiling flags passed to "ocamlcp" (default: "a")
|
|
|
495 |
|
|
|
496 |
* PPFLAGS - additional flags passed to the preprocessor (default: none)
|
|
|
497 |
|
|
|
498 |
* LFLAGS - flags passed to "ocamllex"
|
|
|
499 |
* YFLAGS - flags passed to "ocamlyacc"
|
|
|
500 |
* IDLFLAGS - flags passed to "camlidl"
|
|
|
501 |
|
|
|
502 |
* OCAMLDOCFLAGS - flags passed to "ocamldoc"
|
|
|
503 |
|
|
|
504 |
* OCAMLFIND_INSTFLAGS - flags passed to "ocamlfind" during installation
|
|
|
505 |
(default: none)
|
|
|
506 |
|
|
|
507 |
* DVIPSFLAGS - flags passed to dvips
|
|
|
508 |
(when generating documentation in PostScript).
|
|
|
509 |
|
|
|
510 |
* STATIC - set this variable if you want to force creation
|
|
|
511 |
of static libraries
|
|
|
512 |
|
|
|
513 |
* CC - the C-compiler to be used
|
|
|
514 |
* CXX - the C++-compiler to be used
|
|
|
515 |
|
|
|
516 |
* CFLAGS - additional flags passed to the C-compiler.
|
|
|
517 |
The flag "-DNATIVE_CODE" will be passed automatically
|
|
|
518 |
if you choose to build native code. This allows you
|
|
|
519 |
to compile your C-files conditionally. But please
|
|
|
520 |
note: You should do a "make clean" or remove the
|
|
|
521 |
object files manually or touch the %.c-files:
|
|
|
522 |
otherwise, they may not be correctly recompiled
|
|
|
523 |
between different builds.
|
|
|
524 |
|
|
|
525 |
* CXXFLAGS - additional flags passed to the C++-compiler.
|
|
|
526 |
|
|
|
527 |
* CPPFLAGS - additional flags passed to the C-preprocessor.
|
|
|
528 |
|
|
|
529 |
* CFRAMEWORKS - Objective-C framework to pass to linker on MacOS X.
|
|
|
530 |
|
|
|
531 |
* LDFLAGS - additional flags passed to the C-linker
|
|
|
532 |
|
|
|
533 |
* RPATH_FLAG - flag passed through to the C-linker to set a path for
|
|
|
534 |
dynamic libraries. May need to be set by user on
|
|
|
535 |
exotic platforms. (default: "-R").
|
|
|
536 |
|
|
|
537 |
* ELF_RPATH_FLAG - this flag is used to set the rpath on ELF-platforms.
|
|
|
538 |
(default: "-R")
|
|
|
539 |
|
|
|
540 |
* ELF_RPATH - if this flag is "yes", then the RPATH_FLAG will be
|
|
|
541 |
passed by "-Wl" to the linker as normal on
|
|
|
542 |
ELF-platforms.
|
|
|
543 |
|
|
|
544 |
* OCAMLLIBPATH - path to the OCaml-standard-libraries
|
|
|
545 |
(first default: `$(OCAMLC) -where`)
|
|
|
546 |
(second default: "/usr/local/lib/ocaml")
|
|
|
547 |
|
|
|
548 |
* OCAML_DEFAULT_DIRS - additional path in which the user can supply
|
|
|
549 |
default directories to his own collection of
|
|
|
550 |
libraries. The idea is to pass this as an environment
|
|
|
551 |
variable so that the Makefiles do not have to contain
|
|
|
552 |
this path all the time.
|
|
|
553 |
|
|
|
554 |
* OCAMLFIND - ocamlfind from findlib (default: "ocamlfind")
|
|
|
555 |
* OCAMLC - byte-code compiler (default: "ocamlc")
|
|
|
556 |
* OCAMLOPT - native-code compiler (default: "ocamlopt")
|
|
|
557 |
* OCAMLMKTOP - top-level compiler (default: "ocamlmktop")
|
|
|
558 |
* OCAMLCP - profiling byte-code compiler (default: "ocamlcp")
|
|
|
559 |
* OCAMLDEP - dependency generator (default: "ocamldep")
|
|
|
560 |
* OCAMLLEX - scanner generator (default: "ocamllex")
|
|
|
561 |
* OCAMLYACC - parser generator (default: "ocamlyacc")
|
|
|
562 |
* OCAMLMKLIB - tool to create libraries (default: "ocamlmklib")
|
|
|
563 |
* CAMLIDL - IDL-code generator (default: "camlidl")
|
|
|
564 |
* CAMLIDLDLL - IDL-utility (default: "camlidldll")
|
|
|
565 |
* CAMLP4 - camlp4 preprocessor (default: "camlp4")
|
|
|
566 |
* OCAMLDOC - OCamldoc-command (default: "ocamldoc")
|
|
|
567 |
|
|
|
568 |
* LATEX - Latex-processor (default: "latex")
|
|
|
569 |
* DVIPS - dvips-command (default: "dvips")
|
|
|
570 |
* PS2PDF - PostScript-to-PDF converter (default: "ps2pdf")
|
|
|
571 |
|
|
|
572 |
* CAMELEON_REPORT - report tool of Cameleon (default: "report")
|
|
|
573 |
* CAMELEON_REPORT_FLAGS - flags for the report tool of Cameleon
|
|
|
574 |
|
|
|
575 |
* CAMELEON_ZOGGY - zoggy tool of Cameleon
|
|
|
576 |
(default: "camlp4o pa_zog.cma pr_o.cmo")
|
|
|
577 |
* CAMELEON_ZOGGY_FLAGS - flags for the zoggy tool of Cameleon
|
|
|
578 |
|
|
|
579 |
* OCAML_GLADECC - Glade compiler for OCaml (default: "lablgladecc2")
|
|
|
580 |
* OCAML_GLADECC_FLAGS - flags for the Glade compiler
|
|
|
581 |
|
|
|
582 |
* OXRIDL - OXRIDL-generator (default: "oxridl")
|
|
|
583 |
|
|
|
584 |
* NOIDLHEADER - set to "yes" to prohibit "OCamlMakefile" from using
|
|
|
585 |
the default camlidl-flag "-header".
|
|
|
586 |
|
|
|
587 |
* NO_CUSTOM - Prevent linking in custom mode.
|
|
|
588 |
|
|
|
589 |
* QUIET - unsetting this variable (e.g. "make QUIET=")
|
|
|
590 |
will print all executed commands, including
|
|
|
591 |
intermediate ones. This allows more comfortable
|
|
|
592 |
debugging when things go wrong during a build.
|
|
|
593 |
|
|
|
594 |
* REALLY_QUIET - when set this flag turns off output from some commands.
|
|
|
595 |
|
|
|
596 |
* OCAMLMAKEFILE - location of (=path to) this "OCamlMakefile".
|
|
|
597 |
Because it calles itself recursively, it has to
|
|
|
598 |
know where it is. (default: "OCamlMakefile" =
|
|
|
599 |
local directory)
|
|
|
600 |
|
|
|
601 |
* BCSUFFIX - Suffix for all byte-code files. E.g.:
|
|
|
602 |
|
|
|
603 |
RESULT = foo
|
|
|
604 |
BCSUFFIX = _bc
|
|
|
605 |
|
|
|
606 |
This will produce byte-code executables/libraries
|
|
|
607 |
with basename "foo_bc".
|
|
|
608 |
|
|
|
609 |
* NCSUFFIX - Similar to "BCSUFFIX", but for native-code files.
|
|
|
610 |
* TOPSUFFIX - Suffix added to toplevel interpreters (default: ".top")
|
|
|
611 |
|
|
|
612 |
* SUBPROJS - variable containing the names of subprojects to be
|
|
|
613 |
compiled.
|
|
|
614 |
|
|
|
615 |
* SUBTARGET - target to be built for all projects in variable
|
|
|
616 |
SUBPROJS.
|
|
|
617 |
|
|
|
618 |
---------------------------------------------------------------------------
|
|
|
619 |
|
|
|
620 |
Optional variables for Windows users
|
|
|
621 |
|
|
|
622 |
* MINGW - variable to detect the MINGW-environment
|
|
|
623 |
* MSVC - variable to detect the MSVC-compiler
|
|
|
624 |
|
|
|
625 |
---------------------------------------------------------------------------
|
|
|
626 |
|
|
|
627 |
Up-to-date information (newest release of distribution) can always be
|
|
|
628 |
found at:
|
|
|
629 |
|
|
|
630 |
http://www.ocaml.info/home/ocaml_sources.html
|
|
|
631 |
|
|
|
632 |
---------------------------------------------------------------------------
|
|
|
633 |
|
|
|
634 |
Enjoy!
|
|
|
635 |
|
|
|
636 |
New York, 2007-04-22
|
|
|
637 |
Markus Mottl
|
|
|
638 |
|
|
|
639 |
e-mail: markus.mottl@gmail.com
|
|
|
640 |
WWW: http://www.ocaml.info
|