# Makefile Support

GEM supports CDT C and C++ Makefile projects with a minimum effort required on the part of the programmer. With some minor modifications to your MPI project's Makefiles, you'll be able to use GEM with your Makefile Projects as well as your Managed Build Projects.

## Makefile Modification Steps

The following are the necessary steps to modify your CDT MPI Makefile Project so that it can be formally verified by GEM. If you are creating a project from scratch, make sure to start with a new Makefile Project and not a Managed-Build Project!

- Change the compiler to `ispcc` for C or `ispCC` for C++. These are wrappers for `mpicc` and `mpicxx` that allow GEM to intercept MPI calls at runtime with an interposition layer (the PMPI mechanism).

      	        # Which compiler to use
      	        # CC = mpicc  <-- comment this out

      	        # For MPI C applications
      	        CC = ispcc    <-- add this for C compilation (ispcc is a wrapper for mpicc)

      	        # For MPI C++ applications
      	        CXX = ispCC   <-- add this for C++ compilation (ispCC is a wrapper for mpicxx)

- GEM requires the fully qualified path to all source code files in order to know how to locate errors and problems in your code. ISP itself uses the `__FILE__` and `__LINE__` macros in generating a runtime log. The modification below facilitates this by giving this information to ispcc/ispCC (gcc/g++) at compile time in order to get that back in the same form.

      	        SOURCEPATH = $(shell pwd)   # defining this will give the compiler the fully qualified path to each file encountered
      	        $(CC) $(CFLAGS) -c $(SOURCEPATH)/$*.c   # add this to your build rules

- Change the extension of the generated executables to ".gem"

              $(BINDIR)/mtest.gem$(VERNUM): $(MESHTESTOBJS) $(ISPOBJS)

## Setting Your Projects up to Build

- Create make targets for your Makefile Project
- Now simply double click the make target you need.
  You may have to do a little debugging to get everything just right

## Running GEM on the Generated Executables

- Locate the executable(s) with ".gem" extension in the Project Explorer
- Set the number of processes for the next run of GEM.
- Right click on the previously located executable with ".gem" extension in the Project Explorer
- This should bring up the GEM views (if they aren't already open) with post verification results.
  - Analyzer View Help page
  - Browser View Help page
  - Console View Help page

#### That's it!

Back to Top | Back to Table of Contents

School of Computing * 50 S. Central Campus Dr. Rm. 3190 * Salt Lake City, UT 84112 * isp-dev@cs.utah.edu
License