TOM makefiles

The TOM makefiles is a collection of makefiles that enable easy building and rebuilding of TOM program, library, and dynamically loadable units. When using the TOM makefiles, you do not need to be concerned with the details of compilation or using a praticular system.

The following files constitute the TOM makefiles.

GNUmakefile.app
Build a program into which dynamic loading is possible.
GNUmakefile.bin
Build a program into which dynamic loading is not necessarily possible. It depends on the operating system being used whether GNUmakefile.app and GNUmakefile.bin actualy create different executables (on NeXTSTEP, for instance, they do not differ).
GNUmakefile.lib
Build a library unit.
GNUmakefile.load
Build a unit which is to be dynamically loaded.
GNUmakefile.top
Build only subprojects.
GNUmakefile.common
The heart of the TOM makefiles. The others are just front-ends to this file.

This is what a minimal, example GNUmakefile looks like:

UNIT=	 hello
TOM_SRC= Hello

tom_prefix=	/usr/local/tom
include	$(tom_prefix)/GNUmakefile.bin
To start with the last line, we see the GNUmakefile.bin being included. This means the GNUmakefile is for a program. The UNIT is called hello; this will also be the name of the resulting program. This simple program contains only one TOM source file, Hello.t. Note that the extension is not specified.

Important macros

The following macro's are mandatory except whence using the GNUmakefile.top.
UNIT
The name of the unit being built. It depends on the actual makefile being used whether the unit will be built as a library, application, etc.

TOM_SRC
The names of the TOM source files in this unit, without extension. (All TOM source files have `t' as their extension.)

USES_UNITS
The names of the units depended upon by the UNIT. These units will appear in the uses clause of the unit file. If unspecified, USES_UNITS defaults to tom.

LINK_UNITS
The names of the units to be linked with the UNIT to produce the final result. For bin and app targets, this must include the tom unit, and every unit specified in the USES_UNITS. For load targets, this should include everything not already in the app into which loading is performed.

If unspecified, the LINK_UNITS are set equal to the USES_UNITS for bin and app targets, and set to NONE for load targets. NONE (case is important) means that the result will be linked against no other units.

More macros

UNIT_PATH
Specify directories (white-space separated) in which to search for TOM units. These are added to the default directory $(tom_prefix). When looking for a unit u, for each directory dir in the path, the directory dir/u is checked for containing the unit u. The first match will be used.

For example, if your project /home/me/src/myapp uses the units tom, too, and the one calld mylib in /home/me/src/mylib, the UNIT_PATH would be .., and USES_UNITS would include mylib. Note that the makefiles use the fact that a unit can reside in a subdirectory of the same name, in a directory somewhere along the UNIT_PATH. This is especially handy when using a lot of units, each residing in a subdirectory of a specific top-level directory.

SUBPROJECTS
The names of directories to be visited by make after the project in this directory is built, cleaned, etc. This macro usually is the only one used in a directory employing the GNUmakefile.top.

C_SRC
The names of any auxiliary C source files, without the extension. For example, the C unit has a file called glue.c which contains code that interfaces the TOM Math class with the C math library. Consequently, the GNUmakefile of the C unit specifies:
C_SRC=	glue
Actually, the extension does not matter, since for every word mysrc only the replacement mysrc.o is used in the makefiles. The makefiles however only contain the rule to create $(GENDIR)/%.o for every C source file %.c.

GP_SRC
Names of any sources to gp, which Generates Parsers for TOM. As usual, these names exclude any extension (which must be `tp').

EXTRA_OBJ
Any extra object files to be linked with the unit.

Secondary macros

TOMC
Name of the TOM compiler. This defaults to tomc, i.e. the compiler must reside in the user's path.
TOMR
Name of the TOM resolver. This defaults to tomr,
GI
Name of the interface generator. Default value is gi,

Targets

all
clean

Visit TOM on the WWW at http://www.gerbil.org/tom/.
Pieter Schoenmakers <tiggr@gerbil.org>
$Id: makefiles.html,v 1.5 1998/02/14 22:42:54 tiggr Exp $