Go to the first, previous, next, last section, table of contents.

Basic Makefile Commands

Here are some of the commands that may be used in an m3makefile. You will probably find the import command on top of most m3makefiles.

import( package-name )

Most packages are built on top of other packages in the system. The import command specifies a package to be imported in the build process. It is quite common for most programs to import the libm3 package or the standard Modula-3 library via the instruction: import ("libm3")


Here are some commands that allow you to declare different kinds of units in your package to be included in the build:

interface( "I" )
generic_interface( "I" )

Declares that the file I.i3 (or I.ig for generics) contains an interface. All interface files that you want to include in your build must appear in interface commands. Don't forget to leave the .i3/.ig extension off.

implementation( "M" )
generic_implementation( "M" )

Declares that the file M.m3 (or M.mg for generics) contains a module. All module files that you want to include in your build must appear in an implementation command. Leave the .m3/.mg extension off.

module( "X" )
generic_module( "X" )

Declares X.i3 and X.m3 with one command (X.ig and X.mg for generics).

The module command is really a short-hand for doing both an interface and an implementation. This is probably the command used most often, as many Modula-3 modules consist of just one interface and one implementation.

All the above calls declare their arguments to be built as private, i.e., they are visible only within the current package. To declare an interface or module as public, so that other people can access it, you can use the capitalized version of the same command, for example: Interface() and Implementation().


Most packages either build an executable or a library to be used by other executables. Here are the basic commands that allow you to build either a program or a library.

program( "executable-name" )

An m3makefile generally has one program command. This specifies what to name the program executable, which happens to be the result of the build.

library( "library-name" )

If the m3makefile is describing a collection of interfaces and modules that are designed to be a library instead of an executable program, use this command instead of program().


Go to the first, previous, next, last section, table of contents.