Prev | Next | Up | Title | Contents

2. vimake

Most UNIX programs come with a "makefile" that is run with the UNIX command make to compile and link the program. The makefile describes everything needed to build the program, including compiler options, linker libraries, and location of manual (man) pages. make has many advantages, including compiling only what has changed since the last compile.

The preferred method for the VMS operating system is to have compile and link statements directly in a ".COM" file that contains all the application parts. These are extracted and compiled in one step. The use of an independent command procedure to build the program under VMS has many advantages. It allows the application COM file to be separate. It works on all VMS machines, since DCL is standard. And it is fast, since no subprocesses need to be created.

To build applications under UNIX, it is highly desirable to use make with a makefile. To build under VMS, it is desirable to use DCL with a command procedure. The makefile and the command procedure are incompatible. Worse yet there is quite a bit of variation required for makefiles on different UNIX machines. The commands used often vary, and sometimes there are differences in the format and capabilities of make itself.

It would be very cumbersome to require the VICAR application programmer to maintain two sets of build files for every application (for VMS and UNIX). Furthermore, the differences in UNIX makefiles would make it almost impossible to come up with a single makefile for all UNIX systems. A program called imake has been written to solve these problems.

imake is used extensively in the X-windows system to build it on many platforms. TAE uses it as well. imake generates makefiles. It uses the C preprocessor for macros and conditional statements to customize the generated makefile for a particular platform. The input "imakefile" is a reduced makefile that contains only the program-specific parts, not the system-specific parts.

A template file provides the system-specific parts of the makefile for each machine type. The imake program does some minor cleanup on the imakefile, runs it and the template through the C preprocessor, and does some cleanup on the output. The result is a makefile that is customized for the system you are on.

This helps to create UNIX makefiles, but what about VMS? If you are familiar with imake, you know that the imakefiles are similar to makefiles. There is a set of rules and definitions that are set up at the top of the makefile, but the structure of the imakefile is retained in the makefile. It would be impossible to generate a VMS command procedure from a typical imakefile.

The VICAR program vimake takes the concept of imake and goes one step further. Since the compile and link statements for all VICAR programs are quite similar, they do not need to be specified at all in the imakefile. In fact, vimake extracts all of the control out of the imakefile, leaving only C preprocessor commands.

The VICAR imakefile contains only a description of what is to be built, not how to build it.

A VICAR imakefile has only C preprocessor statements, mostly #define's and a few #if's. These #define statements set up the filenames used in the program, and select various options on how to build the program. The vimake program uses this information and a system-specific template to create a build file for any system. Under VMS, it creates a DCL command file that will build the program. Under UNIX, it creates a makefile instead. The makefile and DCL command file are never delivered with the program; only the imakefile is.

There are many advantages to this scheme:



Prev | Next | Up | Title | Contents