Go to the previous, next section.

Using Imake with ILU

ILU uses the imake system from the X Window System distribution. imake provides a parameterized way of constructing `Makefile's automatically from `Imakefile's. The `Imakefile's contain macros which are expanded to regular `Makefile' rules when the program imake is run.

Creating `Makefile's from `Imakefile's

The program ilumkmf is supplied with the ILU system. When run, it will use the `Imakefile' in your current working directory as input, and produce the corresponding `Makefile', again in the current working directory:

% cd myilu
% ls
Imakefile foo.isl fooProg.cc
% ilumkmf
% ls
Imakefile Makefile foo.isl fooProg.cc
%

ANSI C Usage

A typical `Imakefile' for an ANSI C ILU application would look like:

NormalObjectRule()  /* this rule defines the .c -> .o step */

InterfaceTarget(foo.isl)
ILUCTarget(foo.h foo-surrogate.c foo-common.c foo-true.c, foo.isl)

DepObjectTarget(programComponent1.o, foo.h somethingElse.h)
ObjectTarget(programComponent2.o)

CProgramTarget(program, programComponent1.o programComponent2.o foo-surrogate.o foo-common.o,,)

ANSI C ILU imake Macros

The variable LOCAL_INCLUDES is a list of include file locations to be included when compiling.

The variable ANSI_C_COMMAND defines the particular command invoked for compiling ANSI C on your system. If you wish to use a different ANSI C compiler, override the default command by redefining this value in your `Imakefile'. Note that it may also be necessary to build a version of the ILU ANSI C library, `ILUHOME/lib/libilu-c.a', to use with this compiler.

NormalObjectRule() defines a number of suffix rules, in particular the one to go from `.c' files to `.o' files in your environment.

InterfaceTarget(ISL-file) defines a number of rules about the `.isl' file ISL-file. You should have one of these in your `Imakefile' for every interface you use.

ILUCTarget(generated-files, ISL-file) defines which ANSI C files are generated from the `isl' file and may therefore by re-generated at will, and when the `.isl' file changes. Generally, for an interface called foo, the generated files will be `foo-surrogate.c', `foo-true.c', `foo-common.c', and `foo.h'.

ObjectTarget(object-file) simply states that the specified object-file should be built.

DepObjectTarget(object-file, dependencies) says that the specified object-file should be built, and that it depends on the files specified in dependencies, which is a list of file names separated by spaces. Whenever something in the dependencies list changes, the object-file will be re-built.

CProgramTarget(program-name, objects, dep-libraries, non-dep-libraries) defines a program called program-name that is dependent on the object files defined in objects, and the libraries specified in dep-libraries, so that it will be re-built if anything changes in those two groups. It will also be linked with libraries specified in non-dep-libraries, but will not be re-built if they change. Note that the ILU ANSI C libraries are not automatically included by this command, but may be specified as part of the program by specifying them as part of either dep-libraries or non-dep-libraries.

ILUCProgramTarget(program-name, objects, dep-libraries, non-dep-libraries) defines a program called program-name that is dependent on the object files defined in objects, and the libraries specified in dep-libraries, and the normal ILU ANSI C libraries, so that it will be re-built if anything changes in those three groups, all of which will be linked into the program program-name. It will also be linked with libraries specified in non-dep-libraries, but will not be re-built if they change. This differs from CProgramTarget in that the ILU libraries are automatically included.

C++ Usage

A typical `Imakefile' for a C++ application and ILU would look like:

LOCALINCLUDES = -I$(ILUHOME)/include
ILULIBS = $(ILUHOME)/lib/libilu-c++.a $(ILUHOME)/lib/libilu.a

NormalObjectRule()  /* this rule defines the .cc -> .o step */

InterfaceTarget(foo.isl)
ILUCPlusPlusTarget(foo.H foo.cc foo-server-stubs.cc, foo.isl)

DepObjectTarget(programComponent1.o, foo.H somethingElse.H)
ObjectTarget(programComponent2.o)

CPlusPlusProgramTarget(program, programComponent1.o programComponent2.o foo.o, $(ILULIBS),)

C++ ILU imake Macros

The variable LOCAL_INCLUDES is a list of include file locations to be included when compiling. -I$(ILUHOME)/include should always be on this list for compiling ILU applications.

The variable CPLUSPLUS_COMMAND defines the particular command invoked for compiling C++ on your system. If you wish to use a different C++, override the default command by redefining this value. Note that it will also be necessary to build a version of ILU C++ library, `ILUHOME/lib/libilu-c++.a', to use with this compiler.

NormalObjectRule() defines a number of suffix rules, in particular the one to go from `.cc' files to `.o' files in your environment.

InterfaceTarget(ISL-file) defines a number of rules about the `.isl' file ISL-file. You should have one of these in your `Imakefile' for every interface you use.

ILUCPlusPlusTarget(generated-files, ISL-file) defines which C++ files are generated from the `isl' file and may therefore by re-generated at will, and when the `.isl' file changes. Generally, for an interface called foo, the generated files will be `foo.cc', `foo.H', and `foo-server-stubs.cc'.

ObjectTarget(object-file) simply states that the specified object-file should be built.

DepObjectTarget(object-file, dependencies) says that the specified object-file should be built, and that it depends on the files specified in dependencies, which is a list of file names separated by spaces. Whenever something in the dependencies list changes, the object-file will be re-built.

CPlusPlusProgramTarget(program-name, objects, dep-libraries, non-dep-libraries) defines a program called program-name that is dependent on the object files defined in objects, and the libraries specified in dep-libraries, so that it will be re-built if anything changes in those two groups. It will also be linked with libraries specified in non-dep-libraries, but will not be re-built if they change. Note that the ILU ANSI C libraries are not automatically included by this command, but may be specified as part of the program by specifying them as part of either dep-libraries or non-dep-libraries.

ILUCPlusPlusProgramTarget(program-name, objects, dep-libraries, non-dep-libraries) defines a program called program-name that is dependent on the object files defined in objects, and the libraries specified in dep-libraries, and the normal ILU ANSI C libraries, so that it will be re-built if anything changes in those three groups, all of which will be linked into the program program-name. It will also be linked with libraries specified in non-dep-libraries, but will not be re-built if they change. This differs from CProgramTarget in that the ILU libraries are automatically included.

Go to the previous, next section.