1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
<html><head>
<title>TOM makefiles</title>
</head>
<body BGCOLOR="#ffffff" TEXT="#000000">
<h1>TOM makefiles</h1>
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.
<p>The following files constitute the TOM makefiles.
<dl>
<dt><b>GNUmakefile.app</b>
<dd>Build a program into which dynamic loading is possible.
<dt><b>GNUmakefile.bin</b>
<dd>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).
<dt><b>GNUmakefile.lib</b>
<dd>Build a library unit.
<dt><b>GNUmakefile.load</b>
<dd>Build a unit which is to be dynamically loaded.
<dt><b>GNUmakefile.top</b>
<dd>Build only subprojects.
<dt><b>GNUmakefile.common</b>
<dd>The heart of the TOM makefiles. The others are just front-ends to
this file.
</dl>
<p>This is what a minimal, example GNUmakefile looks like:
<pre>
UNIT= hello
TOM_SRC= Hello
tom_prefix= /usr/local/tom
include $(tom_prefix)/GNUmakefile.bin
</pre>
To start with the last line, we see the GNUmakefile.bin being
included. This means the GNUmakefile is for a program. The
<code>UNIT</code> is called <em>hello</em>; this will also be the
name of the resulting program. This simple program contains only
one TOM source file, <em>Hello.t</em>. Note that the extension is
not specified.
<h2>Important macros</h2>
The following macro's are mandatory except whence using the
GNUmakefile.top.
<dl>
<dt><b><code>UNIT</code></b>
<dd>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.
<p><dt><b><code>TOM_SRC</code></b>
<dd>The names of the TOM source files in this unit, without extension.
(All TOM source files have `t' as their extension.)
<p><dt><b><code>USES_UNITS</code></b>
<dd>The names of the units depended upon by the <code>UNIT</code>. These
units will appear in the <code>uses</code> clause of the unit
file. If unspecified, USES_UNITS defaults to <code>tom</code>.
<p><dt><b><code>LINK_UNITS</code></b>
<dd>The names of the units to be linked with the <code>UNIT</code> to
produce the final result. For <b>bin</b> and <b>app</b> targets,
this must include the <code>tom</code> unit, and every unit
specified in the <code>USES_UNITS</code>. For <b>load</b> targets,
this should include everything not already in the app into which
loading is performed.
<p>If unspecified, the <code>LINK_UNITS</code> are set equal to the
<code>USES_UNITS</code> for <b>bin</b> and <b>app</b> targets, and
set to <code>NONE</code> for <b>load</b> targets.
<code>NONE</code> (case is important) means that the result will
be linked against no other units.
</dl>
<h2>More macros</h2>
<dl>
<dt><b><code>UNIT_PATH</code></b>
<dd>Specify directories (white-space separated) in which to search for TOM
units. These are added to the default directory
<code>$(tom_prefix)</code>. When looking for a unit <em>u</em>,
for each directory <em>dir</em> in the path, the directory
<em>dir</em>/<em>u</em> is checked for containing the unit
<em>u</em>. The first match will be used.
<p>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 <code>..</code>, and <code>USES_UNITS</code> would
include <code>mylib</code>. 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 <code>UNIT_PATH</code>. This is
especially handy when using a lot of units, each residing in a
subdirectory of a specific top-level directory.
<p><dt><b><code>SUBPROJECTS</code></b>
<dd>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.
<p><dt><b><code>C_SRC</code></b>
<dd>The names of any auxiliary C source files, without the extension. For
example, the <code>C</code> unit has a file called
<code>glue.c</code> which contains code that interfaces the TOM
<code>Math</code> class with the C math library. Consequently,
the GNUmakefile of the <code>C</code> unit specifies:
<pre>
C_SRC= glue
</pre>
Actually, the extension does not matter, since for every word
<em>mysrc</em> only the replacement <em>mysrc</em>.o is used in
the makefiles. The makefiles however only contain the rule to
create <code>$(GENDIR)/%.o</code> for every C source file
<code>%.c</code>.
<p><dt><b><code>GP_SRC</code></b>
<dd>Names of any sources to gp, which Generates Parsers for TOM. As
usual, these names exclude any extension (which must be `tp').
<p><dt><b><code>EXTRA_OBJ</code></b>
<dd>Any extra object files to be linked with the unit.
</dl>
<h2>Secondary macros</h2>
<dl>
<dt><b><code>TOMC</code></b>
<dd>Name of the TOM compiler. This defaults to <code>tomc</code>,
i.e. the compiler must reside in the user's path.
<dt><b><code>TOMR</code></b>
<dd>Name of the TOM resolver. This defaults to <code>tomr</code>,
<dt><b><code>GI</code></b>
<dd>Name of the interface generator. Default value is <code>gi</code>,
</dl>
<h2>Targets</h2>
<dl>
<dt>all
<dd>
<dt>clean
<dd>
</dl>
<hr>
Visit TOM on the WWW at <a
href="http://www.gerbil.org/tom/">http://www.gerbil.org/tom/</a>.
<address>Pieter Schoenmakers <a
href="mailto:tiggr@gerbil.org"><tiggr@gerbil.org></a></address>
<pre>$Id: makefiles.html,v 1.5 1998/02/14 22:42:54 tiggr Exp $</pre>
</body>
</html>
|