Building Programs

To build programs, simply type cm3 at the command line, which is actually a short-hand for "cm3 -build". If you have an "m3makefile" (a Modula-3 makefile) then it is used to build your program. Otherwise, cm3 makes a best effort to figure out what you are trying to do, and will attempt to build a program out of Modula-3 files in your directory. For simple programs, you should not need to write an m3makefile, though we always recommend that you do write one, because every small program turns into a big program if it is useful.

Modula-3 makefiles (called "m3makefiles") typically use a set of predefined quake functions that make it easy to construct Modula-3 programs. Together with the cm3 compiler, these predefined functions replace "make".

When started, cm3 looks for a file named m3makefile. This file describes what goes into a particular piece of the system, but not how to construct it. The operational aspects of the system are confined to the cm3.cfg file which resides in the same directory as the cm3 compiler. The users are expected to arrange systems in packages. When you invoke cm3 from the root directory of a package, it will look for an m3makefile in the src sub-directory, or the current directory, or a sibling src directory and try to execute it.

The rest of this section assumes that you are familiar with the building process. If you are a novice, you may consider reviewing the Introductory Reference and Tutorial.

The procedures available in all m3makefiles fit into the following categories:

The more specialized procedures are:

Not everything is controlled by the m3makefiles, though; the

define and change mode and behaviour of the compiler.