imake(1) — (Development System)
NAME
imake − C preprocessor interface to the make utility
SYNOPSIS
imake [ −Ddefine ] [ −Idirectory ] [ −T ] [ −f imakefile ]
[ −s [ makefile ]] [ −v ] [ make options or arguments ]
DESCRIPTION
The imake utility takes a template and an imakefile and runs the C preprocessor on it, producing a temporary makefile in /usr/tmp. It then runs make on this pre-processed makefile. See IMPLEMENTATION DETAIL below.
By default, imake looks first for the file named Imakefile and if that fails, it looks for the file named imakefile, both in the current working directory.
OPTIONS
−Ddefine
Define. This argument is passed on to the preprocessor, cpp. This can also be accomplished with the environment variable IMAKEINCLUDE.
−Idirectory
Include directory. This argument is passed on to the preprocessor, cpp. This can also be accomplished with the environment variable IMAKEINCLUDE.
−T template
Template file. Specifies the template file to be initially included by cpp instead of the default file Imake.template.
−fimakefile
File. Specifies an alternate imakefile for imake to use.
−s [ filename ]
Show. The imake utility will preprocess the imakefile and direct it to the standard output. The make program will not be invoked. If the filename argument is present, the output will be directed instead to the named file. Typically, this is −s Makefile.
−v Verbose. The imake utility will display the command line it uses to invoke the C preprocessor before actually doing so.
ENVIRONMENT VARIABLES
The imake utility consults its environment for three variables:
IMAKEINCLUDE
If defined, this should be a valid include argument for the C preprocessor, e.g., −I/usr/include/local. Actually, any valid cpp argument will work here.
IMAKECPP
If defined, this should be a valid path to a preprocessor program, e.g., /usr/local/cpp. By default, imake will use /lib/cpp.
IMAKEMAKE
If defined, this should be a valid path to a make program, e.g., /usr/local/make. By default, imake will use whatever make program is found using execvp(3).
IMPLEMENTATION DETAIL
The imake utility first determines the name of the imakefile from the command line, −f flag, or from the content of the current directory, depending on whether Imakefile or imakefile exist. Call this <imakefile>. It also determines the name of the template from the −T flag on the command line or the default, Imake.template. Call this <template>.
The program then examines the imakefile looking for any lines that begin with a “#” character. If it finds one, it checks to see if it is a valid C preprocessor directive from the set #include, #define, #undef, #ifdef, #else, #endif, or #if. If it is, imake leaves it unchanged. If not, it pads the beginning of the line with a null C comment “/**/” so that the line will be untouched by the preprocessor. This is useful for preserving the use of make-style “#” comments. If any lines need to be changed, a temporary file named /tmp/tmp-imake.* will receive the “padded” imakefile. Call this file, whether it needed to be changed or not, <input-imakefile>.
Next, the program starts the C preprocessor with the command line:
/lib/cpp -I. -I/usr/lib/local/imake.includes -Uunix
possibly prepending the argument list with the IMAKEINCLUDE environment variable or the −I and the −D command line arguments, or changing the preprocessor program to the IMAKECPP environment variable. Standard input is from the imake program, and standard output is directed to a temporary file in /usr/tmp/tmp-make.* unless there was an argument to the −s flag, in which case output is directed there. Call this file <makefile>. The first three lines provided as input to the preprocessor will be:
#define IMAKE_TEMPLATE <template>
#define INCLUDE_IMAKEFILE <input-imakefile>
#include IMAKE_TEMPLATE
Note that this implies that the template must have, at a minimum, the line:
#include INCLUDE_IMAKEFILE
Next, imake reads the entire output of the preprocessor into memory, stripping off any double “@” signs encountered in the input. This is very useful for writing cpp multi-line macros that will not be coalesced into a single line the way cpp normally does. In addition, trailing white space on any line is thrown away in accordance with make conventions, and most blank lines are thrown away. For example, the macro:
#defineprogram_target(program, objlist) @@\
program:objlist@@\
$(CC) −o $@ objlist $(LDFLAGS)
when called with program_target(foo, foo1.o foo2.o) will expand to:
foo:foo1.o foo2.o
$(CC) −o $@ foo1.o foo2.o $(LDFLAGS)
Finally, if the −s option has not been specified, imake calls the program: make MAKE=<program> MAKEFILE=<imakefile> −f <makefile> makeargs where makeargs is replaced with any arguments found on the command line.
FILES
/usr/tmp/tmp-imake.nnnnnntemporary input file for cpp
/usr/tmp/tmp-make.nnnnnntemporary input file for make
/lib/cppdefault C preprocessor
/usr/lib/local/imake.includesdefault directory for include files
SEE ALSO
make(1) in the INTERACTIVE SDS Guide and Programmer’s Reference Manual.
S. I. Feldman, Make − A Program for Maintaining Computer Programs.
AUTHOR
Todd Brunhoff; Tektronix, Inc. and Project Athena, MIT.
BUGS
On a Sun, the C preprocessor cpp compresses all tabs in a macro expansion to a single space. It also replaces an escaped new-line character with a space instead of deleting it. There is a “kludge” in the code to try to get around this, but it depends on the fact that all targets have a colon (:) somewhere in the line and all actions for a target do not have a :.
You can use make-style “#” comments in the Imakefile, but not in the template or any other included files. If you want them, you must preceed them with a C null comment, /**/.
\*U — Version 1.0