32 |
"tools/adjoint_options/adjoint_oad" (for OpenAD built) or |
"tools/adjoint_options/adjoint_oad" (for OpenAD built) or |
33 |
"tools/adjoint_options/adjoint_default" will be used. |
"tools/adjoint_options/adjoint_default" will be used. |
34 |
|
|
35 |
-nooptfile | --nooptfile |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
|
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
|
36 |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
37 |
Use "NAME" as the optfile. By default, an attempt will be |
Use "NAME" as the optfile. By default, an attempt will be |
38 |
made to find an appropriate "standard" optfile in the |
made to find an appropriate "standard" optfile in the |
697 |
echo "Error: unable to parse package dependencies -- please check PKG_DEPEND=\"$1\"" |
echo "Error: unable to parse package dependencies -- please check PKG_DEPEND=\"$1\"" |
698 |
exit 1 |
exit 1 |
699 |
fi |
fi |
700 |
|
#echo "---- content of tmp file '.pd_tmp' :" ; cat .pd_tmp ; echo "---- end of file" |
701 |
. ./.pd_tmp |
. ./.pd_tmp |
702 |
rm -f ./.pd_tmp |
rm -f ./.pd_tmp |
703 |
} |
} |
1408 |
-help | --help | -h | --h) |
-help | --help | -h | --h) |
1409 |
usage ;; |
usage ;; |
1410 |
|
|
|
-nooptfile | --nooptfile) |
|
|
OPTFILE="NONE" ;; |
|
1411 |
-optfile | --optfile | -of | --of) |
-optfile | --optfile | -of | --of) |
1412 |
ac_prev=OPTFILE ;; |
ac_prev=OPTFILE ;; |
1413 |
-optfile=* | --optfile=* | -of=* | --of=*) |
-optfile=* | --optfile=* | -of=* | --of=*) |
1718 |
fi |
fi |
1719 |
|
|
1720 |
#==================================================================== |
#==================================================================== |
1721 |
|
# Initialize INCLUDEDIRSMK from and optfile INCLUDEDIRS |
1722 |
|
if test "x${INCLUDEDIRS}" != "x" ; then |
1723 |
|
INCLUDEDIRSMK=${INCLUDEDIRS} |
1724 |
|
fi |
1725 |
|
|
1726 |
|
#==================================================================== |
1727 |
# Set default values if not set by the optfile |
# Set default values if not set by the optfile |
1728 |
# |
# |
1729 |
# Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
# Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
2112 |
printf "$d " |
printf "$d " |
2113 |
SOURCEDIRS="$SOURCEDIRS $d" |
SOURCEDIRS="$SOURCEDIRS $d" |
2114 |
INCLUDEDIRS="$INCLUDEDIRS $d" |
INCLUDEDIRS="$INCLUDEDIRS $d" |
2115 |
|
SOURCEDIRSMK="$SOURCEDIRSMK $d" |
2116 |
|
INCLUDEDIRSMK="$INCLUDEDIRSMK $d" |
2117 |
fi |
fi |
2118 |
done |
done |
2119 |
echo |
echo |
2137 |
|
|
2138 |
if test "x${TOOLSDIR}" = x ; then |
if test "x${TOOLSDIR}" = x ; then |
2139 |
TOOLSDIR="$ROOTDIR/tools" |
TOOLSDIR="$ROOTDIR/tools" |
2140 |
|
TOOLSDIRMK='$(ROOTDIR)'"/tools" |
2141 |
|
else |
2142 |
|
TOOLSDIRMK=${TOOLSDIR} |
2143 |
fi |
fi |
2144 |
if test ! -d ${TOOLSDIR} ; then |
if test ! -d ${TOOLSDIR} ; then |
2145 |
echo "Error: the specified TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
echo "Error: the specified TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
2450 |
if test "x$p" = "x$pname" ; then pin="t" ; fi |
if test "x$p" = "x$pname" ; then pin="t" ; fi |
2451 |
done |
done |
2452 |
|
|
2453 |
# Is the DNAME entry a (+) or (-) rule ? |
# Is the DNAME entry a (=), (+) or (-) rule ? |
2454 |
tmp="dname=\"\$DNAME_$i\"" |
tmp="dname=\"\$DNAME_$i\"" |
2455 |
eval $tmp |
eval $tmp |
2456 |
plus="-" |
plus="a" |
2457 |
echo $dname | grep '^+' > /dev/null 2>&1 |
echo $dname | grep '^+' > /dev/null 2>&1 |
2458 |
RETVAL=$? |
RETVAL=$? |
2459 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then plus="+" ; fi |
2460 |
plus="+" |
echo $dname | grep '^-' > /dev/null 2>&1 |
2461 |
fi |
RETVAL=$? |
2462 |
|
if test "x$RETVAL" = x0 ; then plus="-" ; fi |
2463 |
|
|
2464 |
# Is $dname in the current $PACKAGES list? |
# Is $dname in the current $PACKAGES list? |
2465 |
dname=`echo $dname | sed -e 's/^[+-]//'` |
dname=`echo $dname | sed -e 's/^[=+-]//'` |
2466 |
din="f" |
din="f" |
2467 |
for p in $PACKAGES ; do |
for p in $PACKAGES ; do |
2468 |
if test "x$p" = "x$dname" ; then |
if test "x$p" = "x$dname" ; then |
2471 |
done |
done |
2472 |
|
|
2473 |
# Do we need to add $dname according to the dependency rules? |
# Do we need to add $dname according to the dependency rules? |
2474 |
if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then |
if test "x$pin" = xt -a "x$plus" != "x-" -a "x$din" = xf ; then |
2475 |
#echo " " $pname ": need to add :" $dname |
#echo " " $pname ": need to add :" $dname |
2476 |
in_dis="f" |
in_dis="f" |
2477 |
for dis in $DISABLE ; do |
for dis in $DISABLE ; do |
2480 |
fi |
fi |
2481 |
done |
done |
2482 |
if test "x$in_dis" = xt ; then |
if test "x$in_dis" = xt ; then |
2483 |
echo "Error: can't satisfy package dependencies:" |
if test "x$plus" = "x+" ; then |
2484 |
echo " \"$dname\" is required by the dependency rules" |
echo "Error: can't satisfy package dependencies:" |
2485 |
echo " but is disallowed by the DISABLE settings" |
echo " \"$dname\" is required with pkg \"$pname\" (dependency rules)" |
2486 |
exit 1 |
echo " but is disallowed by the DISABLE settings" |
2487 |
|
exit 1 |
2488 |
|
elif test "x$ck" = xt ; then |
2489 |
|
#- (=) is a weaker dependency rule: warning but no stop |
2490 |
|
echo "Warning: pkg \"$dname\" is set DISABLE (from: \"$PKG_LIST\")" |
2491 |
|
echo -n " but is recommended with pkg \"$pname\" (dependency rules)" |
2492 |
|
echo " <- ignores recommendation" |
2493 |
|
fi |
2494 |
else |
else |
2495 |
PACKAGES="$PACKAGES $dname" |
PACKAGES="$PACKAGES $dname" |
2496 |
ck= |
ck= |
2500 |
# Do we need to get rid of $dname according to the dependency rules? |
# Do we need to get rid of $dname according to the dependency rules? |
2501 |
if test "x$pin" = xt -a "x$plus" = "x-" -a "x$din" = xt; then |
if test "x$pin" = xt -a "x$plus" = "x-" -a "x$din" = xt; then |
2502 |
echo "Error: can't satisfy package dependencies:" |
echo "Error: can't satisfy package dependencies:" |
2503 |
echo " \"$pname\" was requested but is disallowed by" |
echo " \"$dname\" was requested but is disallowed by" |
2504 |
echo " the dependency rules for \"$dname\"" |
echo " the dependency rules for \"$pname\"" |
2505 |
exit 1 |
exit 1 |
2506 |
fi |
fi |
2507 |
i=`echo "$i + 1" | bc -l` |
i=`echo "$i + 1" | bc -l` |
2513 |
fi |
fi |
2514 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
2515 |
adr="$ROOTDIR/pkg/$i" |
adr="$ROOTDIR/pkg/$i" |
2516 |
|
adrmk='$(ROOTDIR)'"/pkg/$i" |
2517 |
if test -d $adr ; then |
if test -d $adr ; then |
2518 |
SOURCEDIRS="$SOURCEDIRS $adr" |
SOURCEDIRS="$SOURCEDIRS $adr" |
2519 |
INCLUDEDIRS="$INCLUDEDIRS $adr" |
INCLUDEDIRS="$INCLUDEDIRS $adr" |
2520 |
|
SOURCEDIRSMK="$SOURCEDIRSMK $adrmk" |
2521 |
|
INCLUDEDIRSMK="$INCLUDEDIRSMK $adrmk" |
2522 |
if test "x$i" = xautodiff ; then |
if test "x$i" = xautodiff ; then |
2523 |
AUTODIFF_PKG_USED=t |
AUTODIFF_PKG_USED=t |
2524 |
fi |
fi |
2574 |
if test "x$STANDARDDIRS" != x ; then |
if test "x$STANDARDDIRS" != x ; then |
2575 |
for d in $STANDARDDIRS ; do |
for d in $STANDARDDIRS ; do |
2576 |
adr="$ROOTDIR/$d/src" |
adr="$ROOTDIR/$d/src" |
2577 |
|
adrmk='$(ROOTDIR)/'"$d/src" |
2578 |
if test ! -d $adr ; then |
if test ! -d $adr ; then |
2579 |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
2580 |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
2581 |
exit 1 |
exit 1 |
2582 |
else |
else |
2583 |
SOURCEDIRS="$SOURCEDIRS $adr" |
SOURCEDIRS="$SOURCEDIRS $adr" |
2584 |
|
SOURCEDIRSMK="$SOURCEDIRSMK $adrmk" |
2585 |
fi |
fi |
2586 |
adr="$ROOTDIR/$d/inc" |
adr="$ROOTDIR/$d/inc" |
2587 |
|
adrmk='$(ROOTDIR)/'"$d/inc" |
2588 |
if test ! -d $adr ; then |
if test ! -d $adr ; then |
2589 |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
2590 |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
2591 |
exit 1 |
exit 1 |
2592 |
else |
else |
2593 |
INCLUDEDIRS="$INCLUDEDIRS $adr" |
INCLUDEDIRS="$INCLUDEDIRS $adr" |
2594 |
|
INCLUDEDIRSMK="$INCLUDEDIRSMK $adrmk" |
2595 |
fi |
fi |
2596 |
done |
done |
2597 |
fi |
fi |
2691 |
OAD_KEEP_ORIGINAL="/dev/null" |
OAD_KEEP_ORIGINAL="/dev/null" |
2692 |
OAD_CB2M_FILES="/dev/null" |
OAD_CB2M_FILES="/dev/null" |
2693 |
OADTOOLS="$TOOLSDIR/OAD_support" |
OADTOOLS="$TOOLSDIR/OAD_support" |
2694 |
|
OADTOOLSMK='$(TOOLSDIR)/OAD_support' |
2695 |
echo " looking for dontCompile file: " |
echo " looking for dontCompile file: " |
2696 |
for i in "." $MODS $OADTOOLS ; do |
for i in "." $MODS $OADTOOLS ; do |
2697 |
if test -r $i"/dontCompile" ; then |
if test -r $i"/dontCompile" ; then |
2736 |
printf 'H_SRC_FILES = ' > $TMP.hsrclist |
printf 'H_SRC_FILES = ' > $TMP.hsrclist |
2737 |
printf 'AD_FLOW_FILES = ' > $TMP.ad_flow_files |
printf 'AD_FLOW_FILES = ' > $TMP.ad_flow_files |
2738 |
alldirs="$SOURCEDIRS $INCLUDEDIRS ." |
alldirs="$SOURCEDIRS $INCLUDEDIRS ." |
2739 |
|
alldirsmk=(${SOURCEDIRSMK} ${INCLUDEDIRSMK} ".") |
2740 |
|
nd=0 |
2741 |
for d in $alldirs ; do |
for d in $alldirs ; do |
2742 |
|
dmk=${alldirsmk[${nd}]} |
2743 |
|
nd=$((${nd}+1)) |
2744 |
deplist= |
deplist= |
2745 |
sfiles=`( cd $d; echo *.[h,c,F] *.flow )` |
sfiles=`( cd $d; echo *.[h,c,F] *.flow )` |
2746 |
sfiles=`( echo $sfiles; cd $d; echo *.F90 )` |
sfiles=`( echo $sfiles; cd $d; echo *.F90 )` |
2843 |
if test "x$deplist" != x ; then |
if test "x$deplist" != x ; then |
2844 |
if test "$d" != "." ; then |
if test "$d" != "." ; then |
2845 |
echo "" >> $TMP.srclinks |
echo "" >> $TMP.srclinks |
2846 |
echo "# These files are linked from $d" >> $TMP.srclinks |
echo "# These files are linked from $dmk ( aka $d )" >> $TMP.srclinks |
2847 |
echo "$deplist :" >> $TMP.srclinks |
echo "$deplist :" >> $TMP.srclinks |
2848 |
# We need to make sure that the link isn't already there. |
# We need to make sure that the link isn't already there. |
2849 |
# This may happen when make thinks that a header file has to be "remade" |
# This may happen when make thinks that a header file has to be "remade" |
2850 |
# because a module it depends on has changed. In this case we do nothing. |
# because a module it depends on has changed. In this case we do nothing. |
2851 |
printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> $TMP.srclinks |
printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $dmk >> $TMP.srclinks |
2852 |
fi |
fi |
2853 |
fi |
fi |
2854 |
done |
done |
2905 |
|
|
2906 |
ROOTDIR = ${ROOTDIR} |
ROOTDIR = ${ROOTDIR} |
2907 |
BUILDDIR = ${BUILDDIR} |
BUILDDIR = ${BUILDDIR} |
2908 |
SOURCEDIRS = ${SOURCEDIRS} |
SOURCEDIRS = ${SOURCEDIRSMK} |
2909 |
INCLUDEDIRS = ${INCLUDEDIRS} |
INCLUDEDIRS = ${INCLUDEDIRSMK} |
2910 |
EXEDIR = ${EXEDIR} |
EXEDIR = ${EXEDIR} |
2911 |
EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} |
EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} |
2912 |
TOOLSDIR = ${TOOLSDIR} |
TOOLSDIR = ${TOOLSDIRMK} |
2913 |
OADTOOLS = ${OADTOOLS} |
OADTOOLS = ${OADTOOLSMK} |
2914 |
|
|
2915 |
#eh3 new defines for the adjoint work |
#eh3 new defines for the adjoint work |
2916 |
AUTODIFF = ${ROOTDIR}/pkg/autodiff |
AUTODIFF = \$(ROOTDIR)/pkg/autodiff |
2917 |
EXE_AD = ${EXE_AD} |
EXE_AD = ${EXE_AD} |
2918 |
EXE_FTL = ${EXE_FTL} |
EXE_FTL = ${EXE_FTL} |
2919 |
EXE_SVD = ${EXE_SVD} |
EXE_SVD = ${EXE_SVD} |
3027 |
|
|
3028 |
lib: libmitgcmuv.a |
lib: libmitgcmuv.a |
3029 |
|
|
3030 |
libmitgcmuv.a: \$(OBJFILES) |
libmitgcmuv.a: \$(SPECIAL_FILES) \$(OBJFILES) |
3031 |
ar rcv libmitgcmuv.a \$(OBJFILES) |
ar rcv libmitgcmuv.a \$(OBJFILES) |
3032 |
ar d libmitgcmuv.a main.o |
ar d libmitgcmuv.a main.o |
3033 |
|
|
3503 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS) |
3504 |
|
|
3505 |
# create sources files modules from header files containing common blocks |
# create sources files modules from header files containing common blocks |
3506 |
%_mod.FF90 : %.h \${OADTOOLS}/cb2mGetModules.csh \${OADTOOLS}/cb2mGetModules.awk |
%_mod.FF90 : %.h \$(OADTOOLS)/cb2mGetModules.csh \$(OADTOOLS)/cb2mGetModules.awk |
3507 |
\${OADTOOLS}/cb2mGetModules.csh $< \${OADTOOLS}/cb2mGetModules.awk |
\$(OADTOOLS)/cb2mGetModules.csh $< \$(OADTOOLS)/cb2mGetModules.awk |
3508 |
|
|
3509 |
# create new header files with USE statements for the new modules made above |
# create new header files with USE statements for the new modules made above |
3510 |
%_mod.h : %.h \${OADTOOLS}/cb2mGetHeaders.csh \${OADTOOLS}/cb2mGetHeaders.awk |
%_mod.h : %.h \$(OADTOOLS)/cb2mGetHeaders.csh \$(OADTOOLS)/cb2mGetHeaders.awk |
3511 |
\${OADTOOLS}/cb2mGetHeaders.csh $< \${OADTOOLS}/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) |
\$(OADTOOLS)/cb2mGetHeaders.csh $< \$(OADTOOLS)/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) |
3512 |
|
|
3513 |
# change the include directives of everybody to refer to the new header files with the USE statements |
# change the include directives of everybody to refer to the new header files with the USE statements |
3514 |
%_cb2m.FF90 : %.F \${OADTOOLS}/cb2mUseModules.bash |
%_cb2m.FF90 : %.F \$(OADTOOLS)/cb2mUseModules.bash |
3515 |
\${OADTOOLS}/cb2mUseModules.bash $< ${MPI} |
\$(OADTOOLS)/cb2mUseModules.bash $< ${MPI} |
3516 |
|
|
3517 |
# makefile debug rule |
# makefile debug rule |
3518 |
small_f: \$(CB2M_F90_PP_SRC_FILES) |
small_f: \$(CB2M_F90_PP_SRC_FILES) |
3527 |
|
|
3528 |
# replace stop statements (to avoid the implied unstructured control flow) with print statements |
# replace stop statements (to avoid the implied unstructured control flow) with print statements |
3529 |
ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90 |
ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90 |
3530 |
cat \$< | sed -f \${OADTOOLS}/stop2print.sed > ad_input_code_sf.pre.s2p.f90 |
cat \$< | sed -f \$(OADTOOLS)/stop2print.sed > ad_input_code_sf.pre.s2p.f90 |
3531 |
|
|
3532 |
# F -> WHIRL |
# F -> WHIRL |
3533 |
ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90 |
ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90 |
3550 |
\${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$< |
\${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$< |
3551 |
|
|
3552 |
# insert template directives |
# insert template directives |
3553 |
ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 \${OADTOOLS}/insertTemplateDir.bash |
ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 \$(OADTOOLS)/insertTemplateDir.bash |
3554 |
\${OADTOOLS}/insertTemplateDir.bash \$< \$@ |
\$(OADTOOLS)/insertTemplateDir.bash \$< \$@ |
3555 |
|
|
3556 |
PPEXTRAS=\$(notdir \$(wildcard \${OADTOOLS}/ad_template.*.F)) ad_inline.F |
PPEXTRAS=\$(notdir \$(wildcard \$(OADTOOLS)/ad_template.*.F)) ad_inline.F |
3557 |
# postprocess F' |
# postprocess F' |
3558 |
postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90 |
postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90 |
3559 |
\${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i ad_inline.f \$< |
\${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i ad_inline.f \$< |
3568 |
|
|
3569 |
# link the support files: |
# link the support files: |
3570 |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) \$(PPEXTRAS): |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) \$(PPEXTRAS): |
3571 |
\$(LN) \${OADTOOLS}/\$@ . |
\$(LN) \$(OADTOOLS)/\$@ . |
3572 |
|
|
3573 |
AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag |
AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag |
3574 |
|
|