next up previous contents
Next: Value polymorphism Up: Moscow ML Owner's Manual Previous: The batch compiler

Recompilation management

 

Recompilation management helps the programmer recompile only what is necessary after a change to a unit signature or unit body.

Type-safe linking prevents the programmer from creating unsafe or meaningless programs. The load function and the batch linker ensure probabilistically type-safe linking, so it is virtually impossible to cause the system to create a type-unsafe program.

Using `make' to manage recompilation

 

Consider the example program in Section 4.6 consisting of the three units Evaluate, Expr, and Reduce. Assume their source files *.sig and *.sml reside in a particular directory. Copy a Makefile stub (see below) to that directory, and change to that directory.

  1. Edit the Makefile so that the names of the bytecode files Evaluate.uo, Expr.uo, and Reduce.uo appear on the line beginning with `all:' (see the example makefiles below).
  2. Compute the dependencies among the files by executing:

    program724

  3. Recompile all those files which have not yet been compiled, or which have been modified but not yet recompiled, or which depend on modified files, by executing:

    program726

Step (3) must be repeated whenever you have modified a component of the program system. Step (2) need only be repeated if the inter-dependencies of some components change, or if you add or remove an explicit signature file. Step (1) need only be repeated when you add or delete an entire unit of the program system.

Old versions of the compiled *.ui and *.uo files can be removed by executing:

program729

The inter-dependencies are computed by a small ML program mosmldep, which correctly handles nested comments and strings in the source files.

An example Makefile for Unix

 

To use the Makefile below, first edit it so that all the required units (.uo files) appear on the line beginning with `all:', then proceed as explained in Section 6.1. You do not need to edit any other part of the Makefile. In particular, the dependencies following DO NOT DELETE THIS LINE are generated automatically when executing make depend (as above). A copy of the Makefile can be found in mosml/tools/Makefile.stub.

You will need only the Unix utility make.

program740

An example Makefile for MS DOS

 

To use the Makefile below, first edit it so that all the required units (.uo files) appear on the line beginning with `all:', then proceed as explained in Section 6.1. You do not need to edit any other part of the Makefile. In particular, the dependencies following DO NOT DELETE THIS LINE are generated automatically when executing make depend (as above). A copy of this makefile can be found in mosml\tools\makefile.stb.

You will need a DOS version of make, such as that from Borland C++ version 2.0 or 3.0.

program750

Unit names and DOS file names

Recompilation management for DOS is essentially as for Unix, except for the usual complications that follow from the restrictions on the length of file names, and from their case-insensitivity.

Under MS DOS, filenames are all the same case and can be at most 8 characters long (plus a 3 character extension). Since file names are used as unit names, this may cause problems. We attempt to circumvent these problems as follows:


next up previous contents
Next: Value polymorphism Up: Moscow ML Owner's Manual Previous: The batch compiler

Moscow ML 1.42