Compilation with Unix Tools

1. Introduction

The goal of this document is to describe the file organization used for the build tree with Unix tools. Since the source files are the same used to compile the Windows versions of CIS and MRC, please read the Visual C++ document first.

2. Makefiles

The makefile first selects the operating system and load an OS specific configuration file. If needed, the variable CC is used to determine which compiler to use. The OS selection is performed in os-select.make and the OS specific files are amongst linux.make, sunos.make, irix-CC or irix-gcc (so far).

Then, the package configuration file is loaded (either cis.make or mrc.make). This file contains the list of modules to compile (e.g. for CIS, cisCommon, cisVecs, etc.). For each module, a configuration file is loaded (e.g. cisCommon.make). This file contains the list of source/header files, the list of dependencies (e.g. cisVecs requires cisCommon) as well as optional compiler/linker flags for the module.

During the initialization of make, a shell script (written inside the makefile) creates all the rules required to compile the libraries and tests. These rules allow to create four binary versions of the libraries and tests programs in a structured tree. The tree looks like this:
--+---- source (contains all code)
  |
  +---- visual-c++ (contains visual-c++ stuff)
  |
  +--+- unix
     |
     +--+- build (contains the compiled files)
     |  |
     |  +---- include (copies of all headers)
     |  |
     |  +--+- linux (or any other binary format ...)
     |     |
     |     +--+- dynamic (... for .so files)
     |     |  |
     |     |  +--+- debug (in debug mode)
     |     |  |  |
     |     |  |  +---- bin (executable)
     |     |  |  |
     |     |  |  +---- lib (library)
     |     |  |
     |     |  +--+- release (in release mode)
     |     |     |
     |     |     +---- bin (executable)
     |     |     |
     |     |     +---- lib (library)
     |     |
     |     +--+- static (... for .a files)
     |        |
     |        +--+- debug (in debug mode)
     |        |  |
     |        |  +---- bin (executable)
     |        |  |
     |        |  +---- lib (library)
     |        |
     |        +--+- release (in release mode)
     |           |
     |           +---- bin (executable)
     |           |
     |           +---- lib (library)
     | 
     +---- makefiles (contains the makefiles)
     |
     +---- tmp (temporary files, *.o, etc.)

As usual, each directory contains a sub directory CVS and PLEASE DO NOT delete, change or modify it..

3. How to compile

In the directory cis-2/unix/makefiles, try gmake help. A list of possible targets will appear. The complete compilation requires gmake clean; gmake dist-bin.

To compile MRC, you must first compile CIS. The CIS compilation also copies some files used by the makefiles which are common for both CIS and MRC. Once these files have been copied, you can compile MRC. Also, MRC needs to know where is the CIS binary distribution. You might have to edit the variable CIS_DIST in the file mrc-2/unix/makefiles/makefile.

4. How to create a new project

To create a new module, you must first have the code in place in the source tree, i.e. in <PackageRoot>\source\<ModuleName>\include and <PackageRoot>\source\<ModuleName>\src (e.g. cis\source\cisVecs\include). The code itself should respect the programming guidelines.

Then, you will have to add the module name in the main configuration files (cis.make or mrc.make) and create a configuration file for the new module. There is no complete documentation of the configuration file syntax, thus the most practical way to create a configuration file is to start from and existing one.
Last modified: Fri Jun 21 17:37:38 Pacific Daylight Time 2002