/* This is the "Howto.cook" file used to "cook" ERODE */ /* It builds executable versions of ERODE on Unix platforms */ /* It requires Paul Miller's "cook" package be installed */ /* This configuration assumes a Sun Solaris environment */ /* with Sun's FORTRAN 77 compiler installed */ /* To make a Unix "build" of ERODE, go to the root of the ERODE project directory and enter at the commandline: user_prompt> cook or user_prompt> cook ERODE To make a build of ERODE for debugging purposes use: user_prompt> cook DEBUG=1 To make a build of ERODE for faster execution use: user_prompt> cook OPT=1 Other "cook" options are: 1. compile ERODE project (executable and libraries) user_prompt> cook all 2. compile ERODE libraries only user_prompt> cook libs 3. remove intermediate files (primarily object, library, and executable files) user_prompt> cook clean 4. remove ALL files not considered part of src distribution user_prompt> cook clobber 5. print ALL src files (will go to the user's default Unix printer) user_prompt> cook print Except for changing some compiler options for specific purposes this file should not need to be modified, regardless of how many changes are made to the src and/or include files, including removal or addition of new src and/or include files. This is true as long as these files reside in the specified directories listed in the variable "subdirs" below and the include files reside in those directories or in the "inc" directory path at the root of the ERODE src project directory. There are some restrictions on the subdirectory names, etc. that are specified below. */ /* Compiler and other required variables */ /* default suffixes (and prefixes) for file names */ F = .for; /* FORTRAN src files */ O = .o; /* "object" files */ A = .a; /* library "archive" files */ D = .d; /* include "dependency" files */ E = ; /* executable files */ LIB_PREFIX = lib; /* default library prefix */ BIN = bin; /* default "bin" directory */ LD = f77; /* use f77 compiler for linking */ AR = ar; /* library archiver */ FC_INCL = c_incl; /* program to determine include dependencies */ FC = f77; /* FORTRAN 77 compiler (this is cross-compile capable) */ FC_IFLAGS = "-I../../inc"; /* ERODE default include (relative) path */ /* these default options are specified for fast execution */ /* and robust compile time error detection */ FC_FLAGS = ; /* default compiler flags */ FC_OFLAGS = ; /* default compiler optimization flags */ FC_DFLAGS = ; /* default compiler debug flags */ FC_FLAGS = [FC_FLAGS] -u; /* report undeclared variables */ FC_FLAGS = [FC_FLAGS] -U; /* recognize upper and lower case in source files */ FC_FLAGS = [FC_FLAGS] -C; /* check array references for out of range subscripts */ FC_FLAGS = [FC_FLAGS] -silent; /* supress compiler messages */ /* enable this for faster execution speed - other options available also */ FC_OFLAGS = [FC_OFLAGS] -fast; /* specify the default optimization (means -O4) */ /* enable some or all of these to assist in debugging - others also available */ FC_DFLAGS = [FC_DFLAGS] -g; /* compile for debugging (some optimization is disabled) */ FC_DFLAGS = [FC_DFLAGS] "-ftrap=common"; /* set all traps for help in debugging */ /* FC_DFLAGS = [FC_DFLAGS] "-ftrap=%all"; */ /* set all traps for help in debugging */ /* DEBUG = ; OPT = ; */ if [defined DEBUG] then FC_FLAGS = [FC_FLAGS] [FC_DFLAGS]; else if [defined OPT] then FC_FLAGS = [FC_FLAGS] [FC_OFLAGS]; /* parallel_hosts = cole zingg cole; /* couldn't get to work for some reason */ */ /* Note: No suffixes in dir names are currently allowed, ie: (dir1.src and dir2/dir1.abc not allowed) Note: Directory names currently must be unique, ie: (both dir1 and dir2/dir1 not allowed) */ /* list ERODE submodel directories */ /* subdirs = asd crop decomp hydro main manage mproc soil erosion util/date util/math; */ subdirs = testmain ../../erosion ../../util/math; subdirs_src = ; /* will contain all FORTRAN "src" files */ subdirs_lib = ; /* will contain "path/names" of library modules */ /* make list of library sources (obj files) */ /* "subdir_obj" variables for each library */ tmp = [subdirs]; /* tmp variable for use in loop */ loop { tmp_dir = [head [tmp]]; /* set to first directory in "subdirs" list */ if [not [tmp_dir]] then loopstop; tmp = [tail [tmp]]; /* set ptr to end of "subdirs" list */ /* create master src filelist for all subdirs */ subdirs_src = [subdirs_src] [glob [tmp_dir]"/*"[F]]; /* echo "Subdirs_src: " [subdirs_src]; */ /* create path/names for all subdir library modules */ tmp_lib = [tmp_dir]"/"[LIB_PREFIX][basename [notdir [tmp_dir]]][A]; subdirs_lib = [subdirs_lib] [tmp_lib]; /* echo "Subdirs_lib: " [subdirs_lib]; */ /* get obj filelist for each subdir */ [tmp_lib]_obj = [fromto %0%.for %0%[O] [glob [tmp_dir]"/*"[F]]]; /* echo "lib_obj: " [tmp_lib]_obj " = " [[tmp_lib]_obj]; */ } /* FC "compile" recipe */ %0%[O]: %0%[F] { [FC] -I%0. [FC_IFLAGS] [FC_FLAGS] -c %0%[F] -o [target]; } /* FC "library build" recipe */ %0[LIB_PREFIX]%[A]: [[target]_obj] set unlink { [AR] -q -c [target] [[target]_obj]; } /* FC "link" recipe */ [BIN]/%: [[target]_obj] set mkdir { /* echo "target_obj is: " [[target]_obj]; */ [LD] [FC_IFLAGS] [[target]_obj] -o [target]; } /* FC "include" recipe */ %0%[D]:%0%[F] { [FC_INCL] -nc -ns "--l=optimistic" [FC_IFLAGS] %0%[F] -prefix "'""%0%"[O]" %0%"[D]": %0%"[F]"'" -suffix "'set nodefault;'" -o [target]; } f77_dep_files = [fromto %0%[F] %0%[D] [subdirs_src]]; #include-cooked [f77_dep_files] /* create variable for list of all subdirs "obj" modules */ subdirs_obj = [fromto %0%[F] %0%[O] [subdirs_src]]; /* create variable for ERODE obj file list */ [BIN]/tsterod_obj = [subdirs_obj]; ERODE: [BIN]/tsterod[E]; /* only one executable for now */ libs: [subdirs_lib]; /* build libraries */ all: [BIN]/tsterod[E] [subdirs_lib]; /* build "everything", ERODE and libs */ print: /* print ALL of the ERODE src code (should probably add include files) */ { a2ps [subdirs_src]; } clean: /* get all those intermediate files */ { rm -f [BIN]/tsterod[E] [subdirs_obj] [subdirs_lib] set clearstat; } clobber: clean /* get those "dependency" files as well */ { rm -f [f77_dep_files] set clearstat; }