SEP has a fairly sophisticated set of make rules to make compiling programs
To use SEP's make rules you need to put at the top of your
and at the bottom your Makefile:
All of SEP's compiling rules are based on using a standard suffix convention
so let's start by listing the acceptable suffixes:
As your program becomes more complex (more files, libraries, compiling
options, etc.) their similar increase in your Makefile complexity
- .c : C code
- .C : C++ code
- .java : java code
- .f : strict fortran77 code
- .r : ratfor code
- .rs : ratfor with SAW conventions
- .rst : ratfor with SAW conventions and temporary arrays
- .rt : ratfor code with temporary arrays
- .f90 : strict fortran90 code
- .r90 : ratfor90 code (similar to ratfor)
- .rs90 : ratfor90 code + saw conventions
- .fcm : CM-Fortran
- In the simplest case, when you write a program that is contained
in a single C, Fortran77, Fortran90, or C++ file (for example program.c)
you just have to type
gmake program.x to compile the program and to link it with
SEP and system libraries.
- If you want to link additional object files to create the executable
add the rule:
where subs.suffix (the list above) is another source file in which
you wish the executable to be linked with.
- If this level of sophistication is not sufficient there exists
a number of predefined variables that you can add to your Makefile
that perform special functions. Below is a list of the variables,
what they do, and where they must be placed in the Makefile.
All of the variables need to be assigned in the following manner:
VAR = mydefinition
- DEBUG [before SEP.top], set it equal to anything and the program
will compile in debug mode. If you plan to use a debugger on your code
YOU MUST set this flag.
- OLEVEL [before SEP.top] sets the optimization to manual control.
It defaults to a fairly intelligent value, so you should normally not set
- NO_FIX [before SEP.top], keeps .f90 files (created
from .r90 and .rs90 files). You need this if you're using
- Adding libraries : when you write more complex programs you
will often create your own library. To link with this library using
the standard make rules you need to define the following variables:
- UF90LIBDIR, UF77LIBDIR, UCLIBDIR [after]: by using this option you can
add a path to the list of directories. The linker looks for libraries of
the form -lmylib.a.
- UF90LIBS, UF77LIBS, UCLIBS [after]: you can add additional libraries
to link with. You can use either the standard form -lmylib.a, which
will search the system, SEP, and any library path you defined for the libray
libmylib.a or you can
explicitly link in a library using
- Adding compiling flags : sometimes you might want to have additional
compiling flags. Three common reasons are: to add an additional directory
to look for include files (of the form -I/my/include/dir); to specify the
form of a fortran90 code (fixed or free); or to define some
preprocessors flags (of the form -DMYPREFLAG).
- UF90FLAGS, UF77FLAGS, UCLFLAGS [after] :to add compile flags
for a given type of a compiler.
- Additional flags for parallel computing: when writing code for the
SGI Power Challenge you often want an extra
- PAR_ANA to keep files that give information about automatic
- PROCESSORS to set the number of processors that a code is
compiled for. The defaults is to compile the code for 4 processors.
Stanford Exploration Project