/* cook.weps cookbook for WEPS directory structure access by cook */ manifest = ; /* all files in [subdirs] */ src_files = ; /* all Fortran src ".for" and ".f95" files */ inc_files = ; /* all include ("*.inc", "*.fi", & ".wat") files */ obj_files = ; /* all object ".o" or ".obj" files */ dep_files = ; /* all dependency ".d" or ".dep" files */ I1 = .inc; I2 = .fi; I3 = .wat; /* Using the util/templates/bd_date.for file, insert the build date and put modified copy in the util/build/bd_date.for file */ rm -f util/build/bd_date.for; sed -e s,Unknown,\"`date`\", util/templates/bd_date.for > util/build/bd_date.for; /* Before determining all the src files, update as necessary the build date and release/version files */ /* RELEASE is now defined to be zero if originally undefined - thus code here eventually needs changed - LEW */ #ifndef RELEASE /* If no release is specified, copy over the template file */ cp util/templates/rel_ver.for util/build/rel_ver.for; #else rm -f util/build/rel_ver.for; sed -e s,Unknown,\"[RELEASE]\", util/templates/rel_ver.for > util/build/rel_ver.for; #endif /* extract all files from [src_dirs] (one level deep) */ tmp = [src_dirs]; /* tmp variable for use in loop */ loop { tmp_dir = [head [tmp]]; if [not [tmp_dir]] then loopstop; /* remove first (word) from list each time through loop */ tmp = [tail [tmp]]; /* create manifest (list of all files) in [srcdirs] */ manifest += [glob [tmp_dir]"/*"]; } /* extract all files from [inc_dirs] (one level deep) */ tmp = [inc_dirs]; /* tmp variable for use in loop */ loop { tmp_dir = [head [tmp]]; if [not [tmp_dir]] then loopstop; /* remove first (word) from list each time through loop */ tmp = [tail [tmp]]; /* create manifest (list of all files) in [incdirs] */ manifest += [glob [tmp_dir]"/*"]; } src_files = [match_mask %0%[F] [manifest] ]; /* include free format f95 src files */ src_files += [match_mask %0%[F1] [manifest] ]; /* remove the MAIN subroutine for weps target (weps.for) when PRIMARY_TARGET is something else (eg. tsterode target MAIN routine is erosion/test/tsterode.for) We may want to move the WEPS main routine into a different dir. */ #if [not [matches weps [PRIMARY_TARGET]]] src_files = [stringset [src_files] - main/weps.for]; #endif #if [matches tstasd [PRIMARY_TARGET]] src_files = [stringset [src_files] main/blkdat.for]; #endif inc_files = [match_mask %0%[I1] [manifest]]; inc_files += [match_mask %0%[I2] [manifest]]; inc_files += [match_mask %0%[I3] [manifest]]; /* extract only the .for files and create the .obj files by the same name */ obj_files = [fromto %0%[F] %0%[O] [ match_mask %0%[F] [src_files] ]]; /* extract only the .f95 files and create the .obj files by the same name */ obj_files += [fromto %0%[F1] %0%[O] [ match_mask %0%[F1] [src_files] ]]; /* find all source files that define F90/95 "modules" */ #if [matches weps [PRIMARY_TARGET]] mod_src_files = [shell grep -i -l '"^[ ]*MODULE"' [ match_mask %0%[F1] [src_files] ] ]; #else mod_src_files = ; #endif /* Extract all "module" names from the mod_files */ /* We use sed to 1)strip out all trailing "! comment" info, 2) strip off leading Fortran source filename, and 3) strip out the preceeding "MODULE" keyword */ #if [matches weps [PRIMARY_TARGET]] mod_names = [shell grep -i '"^[ ]*MODULE"' [mod_src_files] | sed -e '"s,[ ]*\!.*,,"' -e '"s,^.*:[ ]*,,"' -e '"s,[Mm][Oo][Dd][Uu][Ll][Ee][ ]*,,"' - ]; #else mod_names = ; #endif mod_files = [fromto %0%[F1] %0%[O] [ match_mask %0%[F1] [mod_src_files] ]]; dep_files = [addsuffix [D] [src_files] [inc_files]]; /* #if [ [not [matches %1clean [command-line-goals]]] && [not [matches %1clobber [command-line-goals]]]] */ #if [matches %1clean [command-line-goals]] /* do not load dependency file checks */ #elif [matches %1clobber [command-line-goals]] /* do not load dependency file checks */ #else #include-cooked-nowarn [dep_files] #endif /* create variable for WEPS obj file list */ [PRIMARY_TARGET]_obj = [obj_files]; [PRIMARY_TARGET][E]_obj = [obj_files]; [TARGET_BIN]/[PRIMARY_TARGET][E]_obj = [obj_files]; /* [PRIMARY_TARGET]_obj = [mod_files] [obj_files]; [PRIMARY_TARGET][E]_obj = [mod_files] [obj_files]; [TARGET_BIN]/[PRIMARY_TARGET][E]_obj = [mod_files] [obj_files]; */