1IMAKE(1)                    General Commands Manual                   IMAKE(1)
2
3
4

NAME

6       imake - C preprocessor interface to the make utility
7

SYNOPSIS

9       imake  [ -Ddefine ] [ -Idir ] [ -Udefine ] [ -Ttemplate ] [ -f filename
10       ] [ -C filename ] [ -s filename ] [ -e ] [ -v ]
11

DESCRIPTION

13       Imake is used to generate Makefiles from a template, a set of cpp macro
14       functions,  and  a  per-directory input file called an Imakefile.  This
15       allows machine dependencies (such as compiler options,  alternate  com‐
16       mand  names,  and  special  make  rules)  to  be kept separate from the
17       descriptions of the various items to be built.
18

OPTIONS

20       The following command line options may be passed to imake:
21
22       -Ddefine
23               This option is passed directly to cpp.  It is typically used to
24               set  directory-specific  variables.   For example, the X Window
25               System uses this flag to set TOPDIR to the name of  the  direc‐
26               tory  containing the top of the core distribution and CURDIR to
27               the name of the current directory, relative to the top.
28
29       -Idirectory
30               This option is passed directly to cpp.  It is typically used to
31               indicate the directory in which the imake template and configu‐
32               ration files may be found.
33
34       -Udefine
35               This option is passed directly to cpp.  It is typically used to
36               unset variables when debugging imake configuration files.
37
38       -Ttemplate
39               This  option  specifies  the  name  of the master template file
40               (which is usually located in the directory specified  with  -I)
41               used by cpp.  The default is Imake.tmpl.
42
43       -f filename
44               This option specifies the name of the per-directory input file.
45               The default is Imakefile.
46
47       -C filename
48               This option specifies the name of the  .c  file  that  is  con‐
49               structed in the current directory.  The default is Imakefile.c.
50
51       -s filename
52               This  option specifies the name of the make description file to
53               be generated but make should not be invoked.  If  the  filename
54               is a dash (-), the output is written to stdout.  The default is
55               to generate, but not execute, a Makefile.
56
57       -e      This option indicates the imake should  execute  the  generated
58               Makefile.  The default is to leave this to the user.
59
60       -v      This  option  indicates that imake should print the cpp command
61               line that it is using to generate the Makefile.
62

HOW IT WORKS

64       Imake invokes cpp with any -I or -D flags passed on  the  command  line
65       and passes the name of a file containing the following 3 lines:
66
67                 #define IMAKE_TEMPLATE "Imake.tmpl"
68                 #define INCLUDE_IMAKEFILE <Imakefile>
69                 #include IMAKE_TEMPLATE
70
71       where  Imake.tmpl and Imakefile may be overridden by the -T and -f com‐
72       mand options, respectively.
73
74       The IMAKE_TEMPLATE typically reads in a file containing  machine-depen‐
75       dent  parameters (specified as cpp symbols), a site-specific parameters
76       file, a file defining variables, a file containing cpp macro  functions
77       for  generating  make  rules,  and  finally the Imakefile (specified by
78       INCLUDE_IMAKEFILE) in the current directory.  The  Imakefile  uses  the
79       macro  functions  to indicate what targets should be built; imake takes
80       care of generating the appropriate rules.
81
82       Imake configuration files contain two types of variables,  imake  vari‐
83       ables  and  make variables.  The imake variables are interpreted by cpp
84       when imake is run.  By convention they are mixed case.  The make  vari‐
85       ables  are  written into the Makefile for later interpretation by make.
86       By convention make variables are upper case.
87
88       The rules file (usually named Imake.rules in the  configuration  direc‐
89       tory)  contains  a  variety  of cpp macro functions that are configured
90       according to the current platform.  Imake replaces any  occurrences  of
91       the  string  ``@@''  with  a newline to allow macros that generate more
92       than one line of make rules.  For example, the macro
93
94        #define  program_target(program, objlist)        @@\
95        program: objlist                                 @@\
96                 $(CC)  -o  $@  objlist  $(LDFLAGS)
97
98       when called with program_target(foo, foo1.o  foo2.o) will expand to
99
100        foo:     foo1.o  foo2.o
101                 $(CC)  -o  $@  foo1.o  foo2.o  $(LDFLAGS)
102
103
104       Imake also replaces any occurrences of  the  word  ``XCOMM''  with  the
105       character  ``#''  to  permit  placing  comments in the Makefile without
106       causing ``invalid directive'' errors from the preprocessor.
107
108       Some complex imake macros require generated  make  variables  local  to
109       each  invocation  of  the  macro,  often because their value depends on
110       parameters passed to the macro.  Such variables can be created by using
111       an  imake  variable of the form XVARdefn, where n is a single digit.  A
112       unique make variable will be substituted.   Later  occurrences  of  the
113       variable  XVARusen will be replaced by the variable created by the cor‐
114       responding XVARdefn.
115
116       On systems whose cpp reduces multiple  tabs  and  spaces  to  a  single
117       space,  imake  attempts  to  put  back any necessary tabs (make is very
118       picky about the difference between tabs and spaces).  For this  reason,
119       colons (:) in command lines must be preceded by a backslash (\).
120

USE WITH THE X WINDOW SYSTEM

122       The X Window System uses imake extensively, for both full builds within
123       the source tree and external software.  As mentioned above, two special
124       variables,  TOPDIR  and CURDIR, are set to make referencing files using
125       relative path names easier.  For example, the following command is gen‐
126       erated  automatically  to  build  the  Makefile in the directory lib/X/
127       (relative to the top of the sources):
128
129                 %  ../.././config/imake  -I../.././config  \
130                       -DTOPDIR=../../.   -DCURDIR=./lib/X
131
132       When building X programs outside the source tree, a special symbol Use‐
133       Installed is defined and TOPDIR and CURDIR are omitted.  If the config‐
134       uration files have been properly installed, the script xmkmf(1) may  be
135       used.
136

INPUT FILES

138       Here  is a summary of the files read by imake as used by X.  The inden‐
139       tation shows what files include what other files.
140
141           Imake.tmpl                generic variables
142               site.def              site-specific, BeforeVendorCF defined
143               *.cf                  machine-specific
144                   *Lib.rules        shared library rules
145               site.def              site-specific, AfterVendorCF defined
146               Imake.rules           rules
147               Project.tmpl          X-specific variables
148                   *Lib.tmpl         shared library variables
149               Imakefile
150                   Library.tmpl      library rules
151                   Server.tmpl       server rules
152                   Threads.tmpl      multi-threaded rules
153
154       Note that site.def gets included twice, once before the *.cf  file  and
155       once  after.   Although  most  site  customizations should be specified
156       after the *.cf file, some, such as the choice of compiler, need  to  be
157       specified before, because other variable settings may depend on them.
158
159       The  first  time  site.def  is included, the variable BeforeVendorCF is
160       defined, and the second time, the variable  AfterVendorCF  is  defined.
161       All  code  in site.def should be inside an #ifdef for one of these sym‐
162       bols.
163

FILES

165       Imakefile.c                   temporary input file for cpp
166       /tmp/Imf.XXXXXX               temporary Makefile for -s
167       /tmp/IIf.XXXXXX               temporary Imakefile if  specified  Imake‐
168       file uses # comments
169       /usr/bin/cpp                  default C preprocessor
170

SEE ALSO

172       make(1), xmkmf(1)
173       S. I. Feldman, Make  A Program for Maintaining Computer Programs
174

ENVIRONMENT VARIABLES

176       The  following  environment  variables may be set, however their use is
177       not recommended as they introduce dependencies  that  are  not  readily
178       apparent when imake is run:
179
180       IMAKEINCLUDE
181            If  defined,  this  specifies a ``-I'' include argument to pass to
182            the C preprocessor.  E.g., ``-I/usr/X11/config''.
183
184       IMAKECPP
185            If defined, this should be a valid path to a preprocessor program.
186            E.g.,  ``/usr/local/cpp''.   By  default,  imake will use cc -E or
187            /usr/bin/cpp, depending on the OS specific configuration.
188
189       IMAKEMAKE
190            If defined, this should be a valid path to a make program, such as
191            ``/usr/local/make''.   By  default,  imake  will use whatever make
192            program is found using execvp(3).  This variable is only  used  if
193            the ``-e'' option is specified.
194

AUTHOR

196       Todd Brunhoff, Tektronix and MIT Project Athena; Jim Fulton, MIT X Con‐
197       sortium
198
199
200
201X Version 11                      imake 1.0.2                         IMAKE(1)
Impressum