]> andersk Git - moira.git/blame - util/imake/imake.1
sync'ing files for RCS->CVS migration
[moira.git] / util / imake / imake.1
CommitLineData
d1b2a10e 1.TH IMAKE 1 "Jan 6, 1987"
2.UC 4
3.SH NAME
4imake \- C preprocessor interface to the make utility
5.SH SYNOPSIS
6.B imake
7[
8.B \-Ddefine
9] [
10.B \-Idirectory
11] [
12.B \-T
13] [
14.B \-f
15.I imakefile
16] [
17.B \-s
18[
19.I makefile
20]] [
21.B \-v
22] [ make options or arguments ]
23.SH DESCRIPTION
24.I Imake
25takes a template and an Imakefile and runs the C preprocessor on it producing a
26temporary makefile in /usr/tmp. It then runs
27.I make
28on this pre-processed makefile.
29See IMPLEMENTATION DETAIL below.
30.PP
31By default,
32.I Imake
33looks first for the file named
34.I Imakefile
35and if that fails, looks for the file named
36.I imakefile,
37both in the current working directory.
38.SH OPTIONS
39.TP 5
40.B \-Ddefine
41Define.
42This argument is passed on to the preprocessor, cpp.
43This can also be accomplished with the environment variable,
44IMAKEINCLUDE.
45.TP 5
46.B \-Idirectory
47Include directory.
48This argument is passed on to the preprocessor, cpp.
49This can also be accomplished with the environment variable,
50IMAKEINCLUDE.
51.TP 5
52.B \-T template
53Template file.
54Specifies the template file to be initially included by cpp,
55instead of the default file
56.I Imake.template.
57.TP 5
58.B \-f imakefile
59File.
60Specifies an alternate imakefile for
61.I imake to use.
62.TP 5
63.B \-s [ filename ]
64Show.
65.I Imake
66will preprocess the imakefile,
67and direct it to the standard output.
68The
69.I make
70program will not be invoked.
71If the filename argument is present
72the output will be directed instead to the named file.
73Typically, this is
74.I \-s Makefile.
75.TP 5
76.B \-v
77Verbose.
78.I Imake
79will display the command line it uses to invoke the C preprocessor before
80actually doing so.
81.SH "ENVIRONMENT VARIABLES"
82Imake consults its environment for three variables:
83.TP 5
84.B IMAKEINCLUDE
85If defined, this should be a valid include argument for the
86C preprocessor. E.g. ``-I/usr/include/local''.
87Actually, any valid
88.I cpp
89argument will work here.
90.TP 5
91.B IMAKECPP
92If defined, this should be a valid path to a preprocessor program.
93E.g. ``/usr/local/cpp''.
94By default,
95.I imake
96will use /lib/cpp.
97.TP 5
98.B IMAKEMAKE
99If defined, this should be a valid path to a make program.
100E.g. ``/usr/local/make''.
101By default,
102.I imake
103will use whatever
104.I make
105program is found using
106.I execvp(3).
107.SH IMPLEMENTATION DETAIL
108.I Imake
109first determins the name of the imakefile from the command line \-f
110flag or from the content of the current directory, depending
111on whether Imakefile or imakefile exist.
112We shall call this \fI<imakefile>\fP.
113It also determines the name of the template
114from the command line \-T flag or the default, Imake.template.
115Call this \fI<template>\fP.
116.PP
117The program then examines the imakefile looking for any lines
118that begin with a '#' character. If it finds one,
119it checks to see if it is a valid C preprocessor directive
120from the set
121.I #include,
122.I #define,
123.I #undef,
124.I #ifdef,
125.I #else,
126.I #endif
127or
128.I #if.
129If it is,
130.I imake
131leaves it unchanged.
132If not,
133it pads the beginning of the line with a null C comment ``/**/''
134so that the line will by untouched by the preprocessor.
135This is usefull for preserving the use of
136.I make
137style ``#'' comments.
138If any lines needed to be changed,
139a temporary file named /tmp/tmp-imake.* will receive the "padded"
140imakefile.
141Call this file, whether it needed to be changed or not,
142\fI<input-imakefile>\fP.
143.PP
144Then the program
145starts up the C preprocessor with the command line
146.RS 5
147.sp 1
148/lib/cpp -I. -I/usr/lib/local/imake.includes -Uunix
149.sp 1
150.RE
151perhaps prepending the argument list with the IMAKEINCLUDE
152environment variable,
153the \fI\-I\fP, and the \fI\-D\fP command line arguments;
154or changing the preprocessor program to the IMAKECPP environment variable.
155Standard input is from the
156.I imake
157program and standard output is directed to a temporary file in
158/usr/tmp/tmp-make.*;
159unless there was an argument to the \-s flag, in which case
160output is directed there.
161Call this file \fI<makefile>\fP.
162The first three lines provided as input to the preprocessor
163will be
164.RS 5
165.sp 1
166#define IMAKE_TEMPLATE "\fI<template>\fP"
167.br
168#define INCLUDE_IMAKEFILE "\fI<input-imakefile>\fP"
169.br
170#include IMAKE_TEMPLATE
171.sp 1
172.RE
173.PP
174Note that this implies that the template must have, at a bare minimum,
175the line
176.RS 5
177.sp 1
178#include INCLUDE_IMAKEFILE
179.sp 1
180.RE
181.PP
182Next,
183.I imake
184reads the entire output of the preprocessor into memory,
185stripping off any double '@' signs encountered in the input.
186This is very useful for writing cpp multi-line macros that
187won't be coalesced into a single line the way
188.I cpp
189normally does.
190In addition, trailing white space on any line is thrown away to keep
191.I make
192from getting upset;
193and most blank lines are thrown
194away.
195For example, the macro
196.ta .8i 1.6i 5i
197.nf
198
199#define program_target(program, objlist) @@\e
200program: objlist @@\e
201 $(CC) -o $@ objlist $(LDFLAGS)
202
203.fi
204when called with
205.I "program_target(foo, foo1.o foo2.o)"
206will expand to
207.nf
208
209foo: foo1.o foo2.o
210 $(CC) -o $@ foo1.o foo2.o $(LDFLAGS)
211
212.fi
213.DT
214.PP
215Finally,
216if the
217.B -s
218option has not been specified,
219.I imake
220calls the program
221.RS 5
222.sp 1
223 make MAKE=\fI<program>\fP MAKEFILE=\fI<imakefile>\fP -f \fI<makefile>\fP makeargs
224.sp 1
225.RE
226where ``makeargs'' is replaced with any arguments found on the command line.
227.SH FILES
228.ta 3i
229/usr/tmp/tmp-imake.\fInnnnnn\fP temporary input file for cpp
230.br
231/usr/tmp/tmp-make.\fInnnnnn\fP temporary input file for make
232.br
233/lib/cpp default C preprocessor
234.br
235/usr/lib/local/imake.includes default directory for include files.
236.DT
237.SH "SEE ALSO"
238make(1)
239.br
240S. I. Feldman
241.I
242Make \- A Program for Maintaining Computer Programs
243.SH "AUTHOR"
244Todd Brunhoff; Tektronix, inc. and Project Athena, MIT.
245.SH "BUGS"
246The C-preprocessor, Cpp,
247on a Sun compresses all tabs in a macro expansion to a single
248space. It also replaces an escaped newline with a space instead of
249deleting it. There is a kludge in the code to try to get around this
250but it depends on the fact that all targets have a ':' somewhere in
251the line and all actions for a target do not have a ':'.
252.PP
253You can use \fImake\fP-style '#' comments in the Imakefile, but
254not in the template or any other included files. If you want
255them, you must preceed them with a C null comment, /**/.
This page took 0.133804 seconds and 5 git commands to generate.