The following files constitute the TOM makefiles.
This is what a minimal, example GNUmakefile looks like:
UNIT= hello TOM_SRC= Hello tom_prefix= /usr/local/tom include $(tom_prefix)/GNUmakefile.binTo 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.
UNIT
TOM_SRC
USES_UNITS
UNIT
. These
units will appear in the uses
clause of the unit
file. If unspecified, USES_UNITS defaults to tom
.
LINK_UNITS
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.
UNIT_PATH
$(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
C_SRC
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= glueActually, 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
EXTRA_OBJ
TOMC
tomc
,
i.e. the compiler must reside in the user's path.
TOMR
tomr
,
GI
gi
,
TM
tm
.
$(TOMMAKEFILES_DIR)/genlinkfile
. This is a shell script that
tries to locate all unit files in the $(LINK_UNITS)
along the
$(UNIT_PATH)
and the corresponding .la
(libtool
archive) files. When a unit is found but the archive isn't, the name of a
library directory is constructed in such a way that the TOM standard units
are also properly found in their installed place.
genlinkfile
emits, for each unit found, lines that add to
the following macros:
UNIT_OBJS
UNIT_DEPS
In addition, each unit can be accompanied by a GNUmakefile.unit; if this is the case, that makefile is included by the GNUmakefile.link. These GNUmakefile.unit files can add command line arguments to the linking phase of the unit being built:
UF_PRE_LIBS
UF_POST_LIBS
UF_PRE_LIBS
will precede all units'
UF_POST_LIBS
. This is, for example, used by a
library that provides an abstraction of X11 and that uses
AC_PATH_XTRA from autoconf AC_PATH_EXTRA sets
X_PRE_LIBS
, X_LIBS
, and
X_EXTRA_LIBS
, and the library's GNUmakefile.unit.in
will look like this:
UF_PRE_LIBS+= @X_PRE_LIBS@ UF_POST_LIBS+= @X_LIBS@ @X_EXTRA_LIBS@ -lX11
$Id: makefiles.html,v 1.7 1999/11/11 21:16:28 tiggr Exp $