next up previous contents
Next: A template SU program Up: How to Write an Previous: How to Write an   Contents

Setting up the Makefile

The CWP/SU package uses a sophisticated Makefile structure, that you may also use when you develop new code. You should begin any new code writing project by creating a local directory in your working area. You should then copy the Makefile from $CWPROOT/src/su/main into that directory and make the following changes

Change:

D = $L/libcwp.a $L/libpar.a $L/libsu.a

LFLAGS= $(PRELFLAGS) -L$L -lsu -lpar -lcwp -lm $(POSTLFLAGS)

to:

D = $L/libcwp.a $L/libpar.a $L/libsu.a

B = .

OPTC = -g

LFLAGS= $(PRELFLAGS) -L$L -lsu -lpar -lcwp -lm $(POSTLFLAGS)

Change:


PROGS =                 \
         $B/bhedtopar    \
         $B/dt1tosu      \
         $B/segyclean    \
         $B/segyhdrs     \
         $B/segyread     \
        ...
         ...

to:

PROGS =                 \
         $B/yourprogram
where the source code of your program is called ``yourprogram.c'' and resides in this directory.

You should then be able to simply type ``make'' and ``yourprogram'' will be compiled.

As a test you can try copying one of the existing SU programs, from $CWPROOT/src/su/main into your local working directory, modifying the Makefile accordingly and typing: make.

Indeed, because all new SU programs may be viewed as beginning as clones of existing SU programs of a similar structure, this is perhaps the best way to begin any new coding venture.


next up previous contents
Next: A template SU program Up: How to Write an Previous: How to Write an   Contents
John Stockwell 2007-04-10