Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ imake(1) — bsd — Apollo Domain/OS SR10.4.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

make(1)

IMAKE(1)                             BSD                              IMAKE(1)



NAME
     imake - C preprocessor interface to the make utility

SYNOPSIS
     imake [ -Ddefine ] [ -Idirectory ] [ -T ] [ -f imakefile ] [ -s [
     makefile ]] [ -v ] [ make options or arguments ]

DESCRIPTION
     Imake 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, 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.

     -f imakefile
          File.  Specifies an alternate imakefile for imake to use.

     -s [ filename ]
          Show.  Imake 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.  Imake will display the command line it uses to invoke the
          C preprocessor before actually doing so.

ENVIRONMENT VARIABLES
     Imake 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
     Imake first determins 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.  We shall call this <imakefile>.  It also
     determines the name of the template from the command line -T flag 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 by untouched by the preprocessor.  This is usefull for
     preserving the use of make style ``#'' comments.  If any lines needed 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>.

     Then the program starts up the C preprocessor with the command line

          /lib/cpp -I. -I/usr/lib/local/imake.includes -Uunix

     perhaps prepending the argument list with the IMAKEINCLUDE environment
     variable, 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 bare 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 won't be coalesced
     into a single line the way cpp normally does.  In addition, trailing
     white space on any line is thrown away to keep make from getting upset;
     and most blank lines are thrown away.  For example, the macro

     #define program_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.nnnnnn     temporary input file for cpp
     /usr/tmp/tmp-make.nnnnnn      temporary input file for make
     /lib/cpp                      default C preprocessor
     /usr/lib/local/imake.includes default directory for include files.

SEE ALSO
     make(1)
     S. I. Feldman Make - A Program for Maintaining Computer Programs

AUTHOR
     Todd Brunhoff; Tektronix, inc. and Project Athena, MIT.

BUGS
     The C-preprocessor, Cpp, on a Sun compresses all tabs in a macro
     expansion to a single space.  It also replaces an escaped newline 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 ':'
     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, /**/.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026