[Next] [Previous] [Up] [Top]
7 Non-Cecil Front Ends
7.2 Using the Modula-3 Front End
The directory ${VORTEX_HOME}/M3 contains M3 sources to be compiled using Melvin, precompiled interfaces to the two standard M3 libraries (which may not be usable by you if you have built your own Melvin front-end, due to typeID generation vagaries) in the stdlib subdirectory, and an example program in the example subdirectory. To compile the example program:
- cd to that subdirectory and then type "m3build".
- If everything is working, the SPARC subdirectory will be created, and a bunch of *.mc and *.ic Vortex RTL files will be produced, with hello.mc as the root file.
- cd to the SPARC subdirectory, start vortex, and do "lang M3; c_make hello.mc".
- When complete, there should be a "hello" executable left around. Guess what it does....
In general, to compile an M3 application, first add m3_option("-Melvin") to its src/m3makefile, and then follow the above recipe, substituting the appropriate program name in the appropriate steps. If the application has its own libraries, then these will need either to be compiled by Melvin (using the -Melvin option to compile the library and then adding the appropriate search paths to find the lib's lib*.mc file when compiling the application; note that this has not yet been tried (successfully)), or interfaces to the library will need to be compiled (described below) and the library's precompiled executable will need to be added to the Makefile's link line. Ideally, there'd be a nice way from within Vortex to specify additional language- or program-specific libraries and files to include along with the Vortex-generated ones, but I don't think you can now.
To build a Vortex library interface file to use in conjunction with linking against a pre-compiled library (e.g. libm3):
- Go to the library's src/m3makefile, and add m3_option("-vortex_library") in addition to m3_option("-Melvin").
- Then m3build the library. This produces a bunch of tiny .ic and .mc files w/ extern declarations, plus a big(ger) lib*.objects.mc file containing the library's object declarations. The resulting lib*.mc file is the root file for the library.
- To include the library interface, you can just add a link in ~/vortex/M3/stdlib/<libname> to the SPARC directory of the library. This leads to a bunch of nearly empty .c files being compiled for each of the .ic and .mc interface files. Alternatively, you can combine all the .ic and .mc files together (removing the include decls from the .objects.mc file!) into a single file to compile once, and install this single file as M3/stdlib/<libname>/<libname>.mc (which is what I did for libm3 and libm3core).
- The makefiles look in the standard places (including the ~/Melvin/lib/m3/SPARC directory) for the separately-compiled library, so make sure its directory is in the path.
How to Use the Vortex Compiler and Environments - 25 MARCH 1997
[Next] [Previous] [Up] [Top]
Generated with Harlequin WebMaker