Building Large Projects

Lab Exercise
Prerequisites Overview Exercise Solution Cleanup

Prerequisites

You should be familiar with Makefiles, and complete the Large Projects module before starting this lab.


Overview

CVODE is a package of routines which are used to solve normal and stiff systems of Ordinary Differential Equations (ODE). The package is written in ANSI C. A library of routines is built in the first step, after which a specific application can be created linking this library. The goal of this exercise is to rewrite the Makefiles to be portable (MS nmake or GNU make). Intel C/C++ was chosen to replace GNU C/C++ in MS Windows.


Exercise

Initial Setup

Copy the archive file Proj02.tar which contains all sources into a separate directory.

 
      copy H:\VWLabs\Large\Proj02.tar .
      

Unpack the archive using the command:

      tar -xvf Proj02.tar
      
and change the root project directory:
      cd Proj02\CVODE
      

The project top directory contains a few directories:

  CVODE --------+-------- examples 
                |                |    
                +-------- lib    +----- band_ex     
                |                         |
                +-------- include         +----- cvbx.c
                |                         |
                +-------- source          +----- Makefile
                |
                +-------- Makefile


Compiling

The Makefile from directory CVODE can be used to compile the project with "gcc" in the CygWin (or UNIX) environment.

       make
A library "libcvode.a" is created in directory "lib" after compiling all C files from directory "source".

Your next task is to add one additional routine to the project "timer_unix.c" and to create a new Makefile which will use the Intel C/C++ compiler 4.5 and will work with MS "nmake" as well with GNU "make".

A solution makefile Int32.mak is provided. This makefile creates a new library "libcvode32.lib" which also contains a timer routine "time00()":

       nmake


Solution

The directory "CVODE/examples/band_ex" contains another Makefile to create an application cvbx.exe with GNU make:

       make
An equivalent MS nmake makefile - Int32.mak  will create a similar application - cvbx32.exe - which in addition to the main computations will compute elapsed CPU time:
       nmake
To see the difference in the output for both applications, run both of them (cvbx.exe and cvbx32.exe) and compare the output.


Cleanup

After you are done, you can remove the top directory Proj02 along with all subdirectories and files:

        rmdir /S /Q Proj02