/* cook.weps cookbook for WEPS directory structure access by cook */ tsterode_manifest = ; /* all files in [tsterode_subdirs] */ tsterode_src_files = ; /* all Fortran src ".for" and ".f95" files */ test_crop_manifest = ; /* all files in [test_crop_subdirs] */ test_crop_src_files = ; /* all Fortran src ".for" and ".f95" files */ 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] ]; src_files += [match_mask %0%[F1] [manifest] ]; /* include free format f95 src files */ /* extract all files from [tsterode_src_dirs] (one level deep) */ tmp = [tsterode_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] */ tsterode_manifest += [glob [tmp_dir]"/*"]; } tsterode_src_files = [match_mask %0%[F] [tsterode_manifest] ]; tsterode_src_files += [match_mask %0%[F1] [tsterode_manifest] ]; /* extract all files from [test_crop_src_dirs] (one level deep) */ tmp = [test_crop_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] */ test_crop_manifest += [glob [tmp_dir]"/*"]; } test_crop_src_files = [match_mask %0%[F] [test_crop_manifest] ]; test_crop_src_files += [match_mask %0%[F1] [test_crop_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 tstpmat [PRIMARY_TARGET]] src_files = [stringset [src_files] util/math/test/tstpmat.for erosion/sbsfdi.for]; #endif #if [matches tstasd [PRIMARY_TARGET]] src_files = [stringset [src_files] main/blkdat.for erosion/sbsfdi.for mproc/crush.for]; #endif #if [matches tstsoil [PRIMARY_TARGET]] src_files = [stringset [src_files] main/blkdat.for main/cmdline.for]; #endif #if [matches season [PRIMARY_TARGET]] src_files = [stringset [src_files] main/inprun.for main/cliginit.for]; src_files = [stringset [src_files] - manage/doproc.for]; src_files = [stringset [src_files] - manage/manage.for]; #endif #if [matches tsthydro [PRIMARY_TARGET]] src_files = [stringset [src_files] hydro/test/tsthydro.for]; #endif #if [matches tstinternode [PRIMARY_TARGET]] src_files = [stringset [src_files] hydro/internode_wt_bc.for hydro/test/tstinternode.for]; #endif #if [matches test_crop_debug [PRIMARY_TARGET]] /* Nothing should need to be done here */ #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 .o 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] ]]; /* determine the src files for all modules */ #if [matches weps [PRIMARY_TARGET]] module_src_files = [shell grep -i -l '"^[ ]*MODULE"' [src_files] ]; #else module_src_files = ; #endif /* function print "module_src_files: " [module_src_files]; */ /* Extract all "module" names from the module_src_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 */ /* Currently this is causing CHEPIL problems */ #if [matches weps [PRIMARY_TARGET]] module_names = [shell grep -i '"^[ ]*MODULE"' [module_src_files] | sed -e '"s,[ ]*\!.*,,"' -e '"s,^.*:[ ]*,,"' -e '"s,[Mm][Oo][Dd][Uu][Ll][Ee][ ]*,,"' ]; module_files = [fromto %0% %0%.mod [module_names]]; #else module_names = ; module_files = ; #endif /* function print "module_names: " [module_names]; function print "module_files: " [module_files]; */ /* dep_files = [addsuffix [D] [src_files] [inc_files] [module_files]]; */ dep_files = [addsuffix [D] [src_files] [inc_files]]; /* function print "dep_files: " [dep_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]; /* function print "[PRIMARY_TARGET]_obj: " [PRIMARY_TARGET]_obj; function print "[[PRIMARY_TARGET]_obj]: " [[PRIMARY_TARGET]_obj]; */ /* [PRIMARY_TARGET]_obj = [module_files] [obj_files]; [PRIMARY_TARGET][E]_obj = [module_files] [obj_files]; [TARGET_BIN]/[PRIMARY_TARGET][E]_obj = [module_files] [obj_files]; */