mleternal − incrementally rebuild OCaml programs as source code evolves
mleternal [TREE]... [TARGET]...
Run mleternal with no arguments to compile all sources from current directory (recursively including subdirectories) and to create executables for each top-level module. Watch compiler messages evolving as the sources are changed.
Command line interface of mleternal has strict options and shortcuts. Shortcut forms are the following:
= create foo.native for each module Foo that is not used by any other module; stay showing current messages both in case of success and failure
$ mleternal foo.ml -some --switches and arguments
= execute the given script with the given arguments; in case of errors just fail and exit.
$ mleternal ../Extra Abc/bar.cmx foo.cmo blah.native
= for each path pointing to an existing directory: include it as a source tree (self-visible only); for any other given path: create it as a target with possibly narrow source tree; stay showing current messages
The examples provided in the Examples/ directory are hopefully self-explanatory. Each use case has a file called 'go' that shows how mleternal can be run.
mleternal maintains lists of source trees and targets, discovers dependencies, calls external tools and processes error messages. The state is kept by a single server process. Also, all the real work is done by the server. First call to mleternal starts the server; subsequent calls reuse it, so they all share the same state. The file VOCABULARY contains more detailed description of mleternal.
mleternal is meant to work out-of-the-box with no configuration.
Disable CLI shortcuts for this mleternal call
Start client in foreground
Start server in foreground; fail if already serving
Start server in background; fail if already serving
If no server is running, start new server in background
Pass all non-option arguments to what --execute points to
-j N, --jobs=N
Run at most N actions simultaneously. If not given, the number of available CPUs is taken.
Ask the running server to exit (causing all clients to quit)
Delete all results and rebuild
Overwrite ./Makefile (or the file PATH) with rules building all current targets in current dir
Include the given directory as source tree with self-visibility only
If PATH is outside all given trees, create a self-visible-only source tree rooted at the parent of PATH
Include the given directory as source tree visible to all trees
Guess targets in the given source tree
Detach the source tree and forget its settings
Build the given file
Report on the current state of the server to the file PATH (or mleternal_state.txt)
Execute the given file when succesfully built
Exit when all targets are built or relevant errors shown; all messages go to stderr in a simple format
Stay showing current messages (exit with ctrl-C); messages are shown on stdout using terminal capabilities
Print to stdout assuming it is a console
Show a list of all defined rules
Print manual in nroff format and exit
Display a help message and exit
Show version information and exit
debugging mleternal itself:
Show external commands that bring messages
Be explicit and debug-friendly
Write to debug log file
Run time-consuming invariant checks
Use alternative stdlib from hardcoded location
Run Tests.doit instead of mleternal
0 - successful execution, no errors
1 - ordinary build errors, all requests fulfilled
2 - failed to satisfy user's requests, fatal errors occured
MLETERNAL_OPTIONS - additional options included when mleternal starts. The same syntax as command line options. Doesn't influence interpretation of shortcut forms given as real command line options. Some options cannot be passed this way (--help, -t, -s, -c, --debug-log, -g and others).
Dawid Toton <firstname.lastname@example.org>
Copyright © 2010 Dawid Toton <email@example.com>
A more flexible tool: http://omake.metaprl.org