| 1911 |
else |
else |
| 1912 |
echo "Ignoring $sf" |
echo "Ignoring $sf" |
| 1913 |
fi |
fi |
| 1914 |
|
else # file is initially listed as an AD file but we exclude it |
| 1915 |
|
notToBeTransformed=`egrep ^$basename'[ ]*' ${MODS}/dontTransform` |
| 1916 |
|
if test -n "$notToBeTransformed" ; then |
| 1917 |
|
echo " \\" >> nonADF77srclist.tmp |
| 1918 |
|
printf " $sf" >> nonADF77srclist.tmp |
| 1919 |
|
fi |
| 1920 |
fi |
fi |
| 1921 |
;; |
;; |
| 1922 |
F90) |
F90) |
| 2224 |
printf "AD_FILES = " >> $MAKEFILE |
printf "AD_FILES = " >> $MAKEFILE |
| 2225 |
AD_FILES=`cat adSrcFiles.tmp` |
AD_FILES=`cat adSrcFiles.tmp` |
| 2226 |
for i in $AD_FILES ; do |
for i in $AD_FILES ; do |
| 2227 |
|
basename=${i%%.f} |
| 2228 |
|
toBeIgnored=`egrep ^$basename'[ ]*' ${MODS}/dontCompile ${MODS}/dontTransform` |
| 2229 |
|
if test -z "$toBeIgnored" ; then |
| 2230 |
echo " \\" >> $MAKEFILE |
echo " \\" >> $MAKEFILE |
| 2231 |
printf " $i" >> $MAKEFILE |
printf " $i" >> $MAKEFILE |
| 2232 |
|
else |
| 2233 |
|
echo "Ignoring $i" |
| 2234 |
|
fi |
| 2235 |
done |
done |
| 2236 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
| 2237 |
rm -f adSrcFiles.tmp |
rm -f adSrcFiles.tmp |
| 2284 |
|
|
| 2285 |
CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.f$FS90, \$(CB2M_F90_SRC_NAMES)) |
CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.f$FS90, \$(CB2M_F90_SRC_NAMES)) |
| 2286 |
|
|
| 2287 |
.PRECIOUS: \$(CB2M_F90_PP_SRC_FILES) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.ff90) |
.PRECIOUS: \$(CB2M_F90_PP_SRC_FILES) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) |
| 2288 |
|
|
| 2289 |
.PHONY: adDepend |
.PHONY: adDepend |
| 2290 |
adDepend: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(addsuffix _mod.FF90, \$(CB2M_F90_SRC_NAMES)) \$(F77_SRC_FILES:.F=_cb2m.FF90) |
adDepend: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(addsuffix _mod.FF90, \$(CB2M_F90_SRC_NAMES)) \$(F77_SRC_FILES:.F=_cb2m.FF90) |
| 2307 |
f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES) |
f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES) |
| 2308 |
cat \$^ > \$@ |
cat \$^ > \$@ |
| 2309 |
|
|
| 2310 |
f95_test.f90: all_mods.xb.x2w.w2f.pp.f \$(NON_AD_F77_SRC_FILES:.F=_cb2m.ff90) ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f |
f95_test.f90: all_mods.xb.x2w.w2f.pp.f$FS90 \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 |
| 2311 |
cat \$^ > \$@ |
cat \$^ > \$@ |
| 2312 |
|
|
| 2313 |
f95_test.out: f95_test_mods.f90 f95_test.f90 |
f95_test.out: f95_test_mods.f90 f95_test.f90 |
| 2321 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES) \$(LIBS) |
| 2322 |
|
|
| 2323 |
# makefile debug rule |
# makefile debug rule |
| 2324 |
openad: ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f |
openad: ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 |
| 2325 |
.PHONY: openad |
.PHONY: openad |
| 2326 |
|
|
| 2327 |
# create the module files |
# create the module files |
| 2347 |
@printf 'running ... ' |
@printf 'running ... ' |
| 2348 |
@./\$(EXE_AD) > \$@ |
@./\$(EXE_AD) > \$@ |
| 2349 |
|
|
| 2350 |
CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.ff90) |
CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90) |
| 2351 |
ad_input_code.$FS: ${MODS}/maxMinDefs.f \$(CB2M_AD_FILES) |
ad_input_code.f$FS90: ${MODS}/maxMinDefs.f \$(CB2M_AD_FILES) |
| 2352 |
cat \$^ > \$@ |
cat \$^ > \$@ |
| 2353 |
|
|
| 2354 |
# strip all comments and blanks to reduce |
# strip all comments and blanks to reduce |
| 2355 |
# the file size in order to reduce perl's memory requirements |
# the file size in order to reduce perl's memory requirements |
| 2356 |
ad_input_code_sf.f : ad_input_code.f |
ad_input_code_sf.f$FS90 : ad_input_code.f$FS90 |
| 2357 |
cat \$^ | sed -f ${MODS}/strip.sed | sed -f ${MODS}/stop2print.sed > \$@ |
cat \$^ | sed -f ${MODS}/strip.sed | sed -f ${MODS}/stop2print.sed > \$@ |
| 2358 |
|
|
| 2359 |
# mfef90 preprocessing |
# mfef90 preprocessing |
| 2360 |
# expand statement functions |
# expand statement functions |
| 2361 |
# expose mfef90 specific substring handling |
# expose mfef90 specific substring handling |
| 2362 |
# add the w2f__types module |
# add the w2f__types module |
| 2363 |
ad_input_code_sf.w2f.f: ad_input_code_sf.f mfef90 whirl2f whirl2f_be w2f__types.f90 |
ad_input_code_sf.w2f.f$FS90: ad_input_code_sf.f$FS90 mfef90 whirl2f whirl2f_be w2f__types.f90 |
| 2364 |
./mfef90 -F -N132 \$< |
./mfef90 -z -F -N132 \$< |
| 2365 |
./whirl2f \$< |
mv \$<.B \$(basename \$<).B |
| 2366 |
cat w2f__types.f90 \$@ > \$@.1 |
./whirl2f \$(basename \$<).B |
| 2367 |
mv \$@.1 \$@ |
cat w2f__types.f90 \$(basename \$<).w2f.f > \$@ |
| 2368 |
|
|
| 2369 |
# canonicalizer |
# canonicalizer |
| 2370 |
ad_input_code_sf.w2f.canon.f: ad_input_code_sf.w2f.f canon.v1.py |
ad_input_code_sf.w2f.canon.f$FS90: ad_input_code_sf.w2f.f$FS90 canon.v1.py |
| 2371 |
python canon.v1.py \$< > \$@ |
python canon.v1.py \$< > \$@ |
| 2372 |
|
|
| 2373 |
# F -> WHIRL |
# F -> WHIRL |
| 2376 |
# as we are in fixed mode and cut of exactly there. |
# as we are in fixed mode and cut of exactly there. |
| 2377 |
# Otherwise mfef90 patches in spaces to fill up to 72 (or 132) |
# Otherwise mfef90 patches in spaces to fill up to 72 (or 132) |
| 2378 |
# characters respectively. |
# characters respectively. |
| 2379 |
ad_input_code_sf.w2f.canon.B: ad_input_code_sf.w2f.canon.f mfef90 |
ad_input_code_sf.w2f.canon.B: ad_input_code_sf.w2f.canon.f$FS90 mfef90 |
| 2380 |
./mfef90 -F \$< |
./mfef90 -z -F \$< |
| 2381 |
|
mv \$<.B \$@ |
| 2382 |
|
|
| 2383 |
# WHIRL -> XAIF |
# WHIRL -> XAIF |
| 2384 |
ad_input_code_sf.w2f.canon.xaif : ad_input_code_sf.w2f.canon.B whirl2xaif |
ad_input_code_sf.w2f.canon.xaif : ad_input_code_sf.w2f.canon.B whirl2xaif |
| 2393 |
./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.canon.B \$< |
./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.canon.B \$< |
| 2394 |
|
|
| 2395 |
# WHIRL' -> F' |
# WHIRL' -> F' |
| 2396 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.f: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be |
| 2397 |
./whirl2f -openad \$< |
./whirl2f -FLIST:ftn_file=\$@ -openad \$< |
| 2398 |
|
|
| 2399 |
# undo slice hiding |
# undo slice hiding |
| 2400 |
# insert template directives |
# insert template directives |
| 2401 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f reslicer.py ${MODS}/insertTemplateDir.bash |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f$FS90 reslicer.py ${MODS}/insertTemplateDir.bash |
| 2402 |
python reslicer.py \$< > \$<.1 |
python reslicer.py \$< > \$<.1 |
| 2403 |
${MODS}/insertTemplateDir.bash \$<.1 \$@ |
${MODS}/insertTemplateDir.bash \$<.1 \$@ |
| 2404 |
rm \$<.1 |
rm \$<.1 |
| 2405 |
|
|
| 2406 |
# postprocess F' |
# postprocess F' |
| 2407 |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f multi-pp.pl ${MODS}/ad_inline.f ${MODS}/ad_template.checkpoint.f ${MODS}/ad_template.plain.f ${MODS}/ad_template.split.f ${MODS}/ad_template.sa_cg2d.f |
ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f$FS90 multi-pp.pl ${MODS}/ad_inline.f ${MODS}/ad_template.checkpoint.f ${MODS}/ad_template.plain.f ${MODS}/ad_template.split.f ${MODS}/ad_template.sa_cg2d.f |
| 2408 |
perl multi-pp.pl -inline=${MODS}/ad_inline.f \$< |
perl multi-pp.pl -inline=${MODS}/ad_inline.f \$< |
| 2409 |
cat \$@ | sed 's/RETURN//' > \$@.1 |
# the postprocessor still gets the name wrong |
| 2410 |
mv \$@.1 \$@ |
cat \$<.pp | sed 's/RETURN//' > \$@ |
| 2411 |
|
|
| 2412 |
# extract all transformed modules |
# extract all transformed modules |
| 2413 |
all_mods.xb.x2w.w2f.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f |
all_mods.xb.x2w.w2f.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 |
| 2414 |
cat \$< | sed -n '/MODULE /,/END MODULE/p' > \$@ |
cat \$< | sed -n '/MODULE /,/END MODULE/p' > \$@ |
| 2415 |
|
|
| 2416 |
# remove the transformed globals module from the |
# remove the transformed globals module from the |
| 2417 |
# transformed ad_input_code file |
# transformed ad_input_code file |
| 2418 |
# and remove for now the duplicate variables |
# and remove for now the duplicate variables |
| 2419 |
# and fix 2 data statements |
# and fix 2 data statements |
| 2420 |
ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f ${MODS}/fixData.sed |
ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90 ${MODS}/fixData.sed |
| 2421 |
# cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' | sed -f ${MODS}/fixData.sed > \$@ |
# cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' | sed -f ${MODS}/fixData.sed > \$@ |
| 2422 |
cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' > \$@ |
cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' > \$@ |
| 2423 |
|
|