Consider a program Prog, which makes use of two custom Modula-3 libraries, LibA and LibB. Let's say that these packages are all located in your personal ~/m3 directory, so you have ~/proj/Prog/src, ~/proj/LibA/src, and ~/m3/LibB/src directories, each with its own collection of modules and an m3makefile.
The library m3makefiles would look something like this:
Module("PublicModule1") % this module gets exported to clients module("PrivateModule1") % this module doesn't get exported Library("LibA") % make the library exportable.
And similarly, PublicModule2, and PrivateModule2 for LibB.
The m3makefile for the main program Prog might look like this:
import("libm3") import("LibA") % import LibA and LibB import("LibB") implementation("Main") program("Myprog")
First you need to compile each directory:
$ cd LibA $ cm3 $ cm3 -ship
$ cd LibB $ cm3 $ cm3 -ship
Finally, you need to compile your main program
$ cd Prog $ cm3
If there are no errors in the compilation, you should be able to find an executable in your TARGET diretory.
You can use the "override" command in your m3makefile in order to use a library that has not been shipped to the public repository. This comes handy when you'd like to test an existing library before shipping it to the public repository.