72 |
|
|
73 |
tmp1=`uname`"_"`uname -m` |
tmp1=`uname`"_"`uname -m` |
74 |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
75 |
PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
76 |
|
PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
77 |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
78 |
echo " The platform appears to be: $PLATFORM" |
echo " The platform appears to be: $PLATFORM" |
79 |
# if test "x$OFLIST" = x ; then |
# if test "x$OFLIST" = x ; then |
105 |
fi |
fi |
106 |
|
|
107 |
# look for possible fortran compilers |
# look for possible fortran compilers |
108 |
tmp="$MITGCM_FC $FC g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
109 |
p_FC= |
p_FC= |
110 |
for c in $tmp ; do |
for c in $tmp ; do |
111 |
rm -f ./hello.f ./hello |
rm -f ./hello.f ./hello |
122 |
p_FC="$p_FC $c" |
p_FC="$p_FC $c" |
123 |
fi |
fi |
124 |
done |
done |
125 |
|
rm -f ./hello.f ./hello |
126 |
if test "x${p_FC}" = x ; then |
if test "x${p_FC}" = x ; then |
127 |
cat 1>&2 <<EOF |
cat 1>&2 <<EOF |
128 |
|
|
264 |
exit 1 |
exit 1 |
265 |
} |
} |
266 |
|
|
267 |
#eh3 # This is the generic configuration. |
# Build a CPP macro to automate calling C routines from FORTRAN |
268 |
#eh3 set LN = ( 'ln -s' ) |
get_fortran_c_namemangling() { |
269 |
#eh3 set CPP = ( '/lib/cpp -P' ) |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
270 |
#eh3 set S64 = ( '$(TOOLSDIR)/set64bitConst.sh' ) |
|
271 |
#eh3 set KPP = ( ) |
cat > genmake_test.c <<EOF |
272 |
#eh3 set FC = ( 'f77' ) |
void tcall( char * string ) { tsub( string ); } |
273 |
#eh3 set LINK = $FC |
EOF |
274 |
#eh3 set MAKEDEPEND = ( 'makedepend' ) |
$MAKE genmake_test.o > genmake_test.log 2>&1 |
275 |
#eh3 set INCLUDES = ( -I. ) |
RETVAL=$? |
276 |
#eh3 set FFLAGS = ( ) |
if test "x$RETVAL" != x0 ; then |
277 |
#eh3 set FOPTIM = ( ) |
cat genmake_test.log >> genmake_errors |
278 |
#eh3 set CFLAGS = ( ) |
FC_NAMEMANGLE=$default_nm |
279 |
#eh3 set KFLAGS1 = ( ) |
echo |
280 |
#eh3 set KFLAGS2 = ( ) |
echo "WARNING: C test compile fails -- please see \"genmake_errors\"" |
281 |
#eh3 set LIBS = ( ) |
echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'" |
282 |
#eh3 set KPPFILES = ( ) |
echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here." |
283 |
#eh3 if (! $?NOOPTFILES ) set NOOPTFILES = ( ) |
return 1 |
284 |
#eh3 if (! $?NOOPTFLAGS ) set NOOPTFLAGS = ( ) |
fi |
285 |
|
c_tcall=`nm genmake_test.o | grep tcall | cut -d ' ' -f 3` |
286 |
|
RETVAL=$? |
287 |
|
if test "x$RETVAL" != x0 ; then |
288 |
|
FC_NAMEMANGLE=$default_nm |
289 |
|
echo |
290 |
|
echo "WARNING: The \"nm\" command failed." |
291 |
|
echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'" |
292 |
|
echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here." |
293 |
|
return 1 |
294 |
|
fi |
295 |
|
cat > genmake_tcomp.f <<EOF |
296 |
|
subroutine tcall( string ) |
297 |
|
character*(*) string |
298 |
|
call tsub( string ) |
299 |
|
end |
300 |
|
EOF |
301 |
|
$FC $FFLAGS $DEFINES -c genmake_tcomp.f > genmake_tcomp.log 2>&1 |
302 |
|
RETVAL=$? |
303 |
|
if test "x$RETVAL" != x0 ; then |
304 |
|
cat genmake_tcomp.log >> genmake_errors |
305 |
|
FC_NAMEMANGLE=$default_nm |
306 |
|
echo |
307 |
|
echo "WARNING: FORTRAN test compile fails -- please see \"genmake_errors\"" |
308 |
|
echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'" |
309 |
|
echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here." |
310 |
|
return 1 |
311 |
|
fi |
312 |
|
f_tcall=`nm genmake_tcomp.o | grep tcall | cut -d ' ' -f 3` |
313 |
|
RETVAL=$? |
314 |
|
if test "x$RETVAL" != x0 ; then |
315 |
|
FC_NAMEMANGLE=$default_nm |
316 |
|
echo |
317 |
|
echo "WARNING: The \"nm\" command failed." |
318 |
|
echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'" |
319 |
|
echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here." |
320 |
|
return 1 |
321 |
|
fi |
322 |
|
|
323 |
|
c_a=`echo $c_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 1 | sed -e 's|Y||'` |
324 |
|
f_a=`echo $f_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 1 | sed -e 's|Y||'` |
325 |
|
c_b=`echo $c_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 2 | sed -e 's|Y||'` |
326 |
|
f_b=`echo $f_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 2 | sed -e 's|Y||'` |
327 |
|
|
328 |
|
nmangle="X" |
329 |
|
if test "x$c_a" != "x$f_a" ; then |
330 |
|
comm="echo x$f_a | sed -e 's|x$c_a||'" |
331 |
|
a=`eval $comm` |
332 |
|
nmangle="$a ## $nmangle" |
333 |
|
fi |
334 |
|
if test "x$c_b" != "x$f_b" ; then |
335 |
|
comm="echo x$f_b | sed -e 's|x$c_b||'" |
336 |
|
b=`eval $comm` |
337 |
|
nmangle="$nmangle ## $b" |
338 |
|
fi |
339 |
|
|
340 |
|
FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) $nmangle" |
341 |
|
|
342 |
|
# cleanup the testing files |
343 |
|
rm -f genmake_tcomp.* genmake_test.* |
344 |
|
} |
345 |
|
|
346 |
# Set defaults here |
# Set defaults here |
347 |
COMMANDL="$0 $@" |
COMMANDL="$0 $@" |
352 |
KPP= |
KPP= |
353 |
FC= |
FC= |
354 |
LINK= |
LINK= |
355 |
DEFINES="-DWORDLENGTH=4" |
# DEFINES="-DWORDLENGTH=4" |
356 |
|
DEFINES= |
357 |
PACKAGES= |
PACKAGES= |
358 |
ENABLE= |
ENABLE= |
359 |
DISABLE= |
DISABLE= |
374 |
NOOPTFILES= |
NOOPTFILES= |
375 |
NOOPTFLAGS= |
NOOPTFLAGS= |
376 |
|
|
377 |
|
# DEFINES checked by test compilation |
378 |
|
HAVE_SYSTEM= |
379 |
|
HAVE_FDATE= |
380 |
|
FC_NAMEMANGLE= |
381 |
|
|
382 |
MODS= |
MODS= |
383 |
TOOLSDIR= |
TOOLSDIR= |
384 |
SOURCEDIRS= |
SOURCEDIRS= |
424 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
425 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
426 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
427 |
|
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE" |
428 |
|
|
429 |
# The following are all related to adjoint/tangent-linear stuff |
# The following are all related to adjoint/tangent-linear stuff |
430 |
gm_s7="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS" |
gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS" |
431 |
gm_s8="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS" |
gm_s11="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS" |
432 |
gm_s9="TAF_EXTRA TAMC_EXTRA" |
gm_s12="TAF_EXTRA TAMC_EXTRA" |
433 |
|
|
434 |
gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7 $gm_s8 $gm_s9" |
gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7" |
435 |
|
gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12" |
436 |
|
|
437 |
|
|
438 |
echo |
echo |
721 |
|
|
722 |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
1) within the options file ("CPP=...") as specified by "-of=OPTFILE" |
723 |
2) the "./genmake_local" file |
2) the "./genmake_local" file |
724 |
|
3) with the CPP environment variable |
725 |
|
|
726 |
EOF |
EOF |
727 |
exit 1 |
exit 1 |
732 |
MAKEDEPEND=makedepend |
MAKEDEPEND=makedepend |
733 |
fi |
fi |
734 |
|
|
735 |
|
|
736 |
|
printf "\n=== Checking system libraries ===\n" |
737 |
|
echo -n " Do we have the system() command using $FC... " |
738 |
|
cat > genmake_tcomp.f <<EOF |
739 |
|
program hello |
740 |
|
call system('echo hi') |
741 |
|
end |
742 |
|
EOF |
743 |
|
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
744 |
|
RETVAL=$? |
745 |
|
if test "x$RETVAL" = x0 ; then |
746 |
|
HAVE_SYSTEM=t |
747 |
|
DEFINES="$DEFINES -DHAVE_SYSTEM" |
748 |
|
echo "yes" |
749 |
|
else |
750 |
|
HAVE_SYSTEM= |
751 |
|
echo "no" |
752 |
|
fi |
753 |
|
rm -f genmake_tcomp* |
754 |
|
|
755 |
|
echo -n " Do we have the fdate() command using $FC... " |
756 |
|
cat > genmake_tcomp.f <<EOF |
757 |
|
program hello |
758 |
|
CHARACTER(128) string |
759 |
|
string = ' ' |
760 |
|
call fdate( string ) |
761 |
|
print *, string |
762 |
|
end |
763 |
|
EOF |
764 |
|
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
765 |
|
RETVAL=$? |
766 |
|
if test "x$RETVAL" = x0 ; then |
767 |
|
HAVE_FDATE=t |
768 |
|
DEFINES="$DEFINES -DHAVE_FDATE" |
769 |
|
echo "yes" |
770 |
|
else |
771 |
|
HAVE_FDATE= |
772 |
|
echo "no" |
773 |
|
fi |
774 |
|
rm -f genmake_tcomp* |
775 |
|
|
776 |
|
echo " The name mangling convention for $FC is... " |
777 |
|
#FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _" |
778 |
|
if test "x$FC_NAMEMANGLE" = x ; then |
779 |
|
get_fortran_c_namemangling |
780 |
|
fi |
781 |
|
echo " '$FC_NAMEMANGLE'" |
782 |
|
echo "$FC_NAMEMANGLE" > FC_NAMEMANGLE.h.template |
783 |
|
cmp FC_NAMEMANGLE.h FC_NAMEMANGLE.h.template > /dev/null 2>&1 |
784 |
|
RETVAL=$? |
785 |
|
if test "x$RETVAL" != x0 ; then |
786 |
|
mv -f FC_NAMEMANGLE.h.template FC_NAMEMANGLE.h |
787 |
|
fi |
788 |
|
|
789 |
|
|
790 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
791 |
echo -n " Adding MODS directories: " |
echo -n " Adding MODS directories: " |
792 |
for d in $MODS ; do |
for d in $MODS ; do |
1034 |
fi |
fi |
1035 |
done |
done |
1036 |
|
|
|
# This is compatible with the old genmake. The "DISABLE_*" flags |
|
|
# need to be replaced by the "ALLOW_*" flags set below. |
|
|
# |
|
|
# echo -n " Setting package-specific CPP flags: " |
|
|
# pkrm=( mom_fluxform mom_vecinv generic_advdiff ) |
|
|
# pkrmdef=( -DDISABLE_MOM_FLUXFORM -DDISABLE_MOM_VECINV -DDISABLE_GENERIC_ADVDIFF -DDISABLE_DEBUGMODE ) |
|
|
# echo -n " " |
|
|
# i=0 |
|
|
# while test $i -lt "${#pkrm[@]}" ; do |
|
|
# echo "$PACKAGES" | grep "${pk[$i]}" > /dev/null 2>&1 |
|
|
# RETVAL=$? |
|
|
# if test "x$RETVAL" = x1 ; then |
|
|
# DEFINES="$DEFINES ${pkdef[$i]}" |
|
|
# echo -n " ${pkdef[$i]}" |
|
|
# fi |
|
|
# i=$(( $i + 1 )) |
|
|
# done |
|
|
# echo |
|
1037 |
|
|
1038 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
1039 |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
1067 |
if test "x$has_pack" = xf ; then |
if test "x$has_pack" = xf ; then |
1068 |
undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'` |
undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'` |
1069 |
echo "#undef $undef" >> $PACKAGES_DOT_H".tmp" |
echo "#undef $undef" >> $PACKAGES_DOT_H".tmp" |
|
# DEFINES="$DEFINES -U$undef" |
|
|
|
|
|
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
|
|
case $n in |
|
|
mom_fluxform) |
|
|
DEFINES="$DEFINES -DDISABLE_MOM_FLUXFORM" |
|
|
;; |
|
|
mom_vecinv) |
|
|
DEFINES="$DEFINES -DDISABLE_MOM_VECINV" |
|
|
;; |
|
|
debug) |
|
|
DEFINES="$DEFINES -DDISABLE_DEBUGMODE" |
|
|
;; |
|
|
esac |
|
|
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
|
|
|
|
1070 |
fi |
fi |
1071 |
fi |
fi |
1072 |
done |
done |
1132 |
fi |
fi |
1133 |
done |
done |
1134 |
|
|
1135 |
echo " Searching for CPP_OPTIONS.h in order to warn about the presence" |
echo " Searching for CPP_OPTIONS.h in order to warn about the presence" |
1136 |
echo " of \"#define ALLOW_PKGNAME\"-type statements:" |
echo " of \"#define ALLOW_PKGNAME\"-type statements:" |
1137 |
CPP_OPTIONS= |
CPP_OPTIONS= |
1138 |
spaths=". $INCLUDEDIRS" |
spaths=". $INCLUDEDIRS" |
1139 |
for i in $spaths ; do |
for i in $spaths ; do |
1264 |
echo "# $0 $@" >> $MAKEFILE |
echo "# $0 $@" >> $MAKEFILE |
1265 |
echo "# executed by:" >> $MAKEFILE |
echo "# executed by:" >> $MAKEFILE |
1266 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
1267 |
|
|
1268 |
|
EXE_AD=$EXECUTABLE"_ad" |
1269 |
|
EXE_FTL=$EXECUTABLE"_ftl" |
1270 |
|
EXE_SVD=$EXECUTABLE"_svd" |
1271 |
|
|
1272 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
1273 |
# |
# |
1274 |
# BUILDDIR : Directory where object files are written |
# BUILDDIR : Directory where object files are written |
1299 |
|
|
1300 |
#eh3 new defines for the adjoint work |
#eh3 new defines for the adjoint work |
1301 |
AUTODIFF = ${ROOTDIR}/pkg/autodiff |
AUTODIFF = ${ROOTDIR}/pkg/autodiff |
1302 |
|
EXE_AD = ${EXE_AD} |
1303 |
|
EXE_FTL = ${EXE_FTL} |
1304 |
|
EXE_SVD = ${EXE_SVD} |
1305 |
|
|
1306 |
EOF |
EOF |
1307 |
|
|
1383 |
@\$(EXECUTABLE) > \$@ |
@\$(EXECUTABLE) > \$@ |
1384 |
|
|
1385 |
clean: |
clean: |
1386 |
|
-cat AD_CONFIG.template > AD_CONFIG.h |
1387 |
-rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} |
-rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} |
1388 |
Clean: |
Clean: |
1389 |
@make clean |
@make clean |
1390 |
@make cleanlinks |
@make cleanlinks |
1391 |
-rm -f Makefile.bak genmake_state genmake_optfile make.log |
-rm -f Makefile.bak genmake_state genmake_*optfile make.log |
1392 |
CLEAN: |
CLEAN: |
1393 |
@make Clean |
@make Clean |
1394 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1396 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
1397 |
-rm -f \$(EXECUTABLE) output.txt |
-rm -f \$(EXECUTABLE) output.txt |
1398 |
|
|
1399 |
Makefile: makefile |
#eh3 Makefile: makefile |
1400 |
makefile: |
makefile: |
1401 |
${0} $@ |
${0} $@ |
1402 |
cleanlinks: |
cleanlinks: |
1451 |
echo -n " $i" >> $MAKEFILE |
echo -n " $i" >> $MAKEFILE |
1452 |
done |
done |
1453 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
1454 |
|
rm -f ad_files |
1455 |
|
|
1456 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
1457 |
|
|
1458 |
ad_input_code.f: \$(F77FILES) |
# ... AD ... |
1459 |
|
adall: ad_taf |
1460 |
|
adtaf: ad_taf_output.f |
1461 |
|
adtamc: ad_tamc_output.f |
1462 |
|
|
1463 |
|
ad_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
1464 |
|
cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h |
1465 |
|
@make \$(F77FILES) |
1466 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
1467 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
1468 |
|
|
|
# ... AD ... |
|
1469 |
ad_taf_output.f: ad_input_code.f |
ad_taf_output.f: ad_input_code.f |
1470 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
1471 |
cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f |
cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f |
1472 |
|
|
1473 |
ad_taf: ad_taf_output.o \$(OBJFILES) |
ad_taf: ad_taf_output.o \$(OBJFILES) |
1474 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
1475 |
|
|
1476 |
ad_tamc_output.f: ad_input_code.f |
ad_tamc_output.f: ad_input_code.f |
1477 |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
1478 |
cat ad_input_code_ad.f | sed -f adjoint_sed > ad_tamc_output.f |
cat ad_input_code_ad.f | sed -f adjoint_sed > ad_tamc_output.f |
1479 |
|
|
1480 |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
1481 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
1482 |
|
|
1483 |
|
|
1484 |
|
# ... FTL ... |
1485 |
|
ftlall: ftl_taf |
1486 |
|
ftltaf: ftl_taf_output.f |
1487 |
|
ftltamc: ftl_tamc_output.f |
1488 |
|
|
1489 |
|
ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
1490 |
|
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
1491 |
|
@make \$(F77FILES) |
1492 |
|
@make \$(AD_FLOW_FILES) |
1493 |
|
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f |
1494 |
|
|
1495 |
# ... FLT ... |
ftl_taf_output.f: ftl_input_code.f |
1496 |
flt_taf_output.f: ad_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
1497 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f |
|
cat ad_input_code_ad.f | sed -f adjoint_sed > flt_taf_output.f |
|
1498 |
|
|
1499 |
flt_taf: flt_taf_output.o \$(OBJFILES) |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
1500 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) flt_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
1501 |
|
|
1502 |
flt_tamc_output.f: ad_input_code.f |
ftl_tamc_output.f: ftl_input_code.f |
1503 |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f |
1504 |
cat ad_input_code_ad.f | sed -f adjoint_sed > flt_tamc_output.f |
cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f |
1505 |
|
|
1506 |
flt_tamc: flt_tamc_output.o \$(OBJFILES) |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
1507 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) flt_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
1508 |
|
|
1509 |
|
|
1510 |
# ... SVD ... |
# ... SVD ... |
1511 |
svd_taf_output.f: ad_input_code.f |
svd: svd_taf |
1512 |
\$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
svd_taf_f: svd_taf_output.f |
1513 |
cat ad_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f |
|
1514 |
|
svd_input_code.f: \$(SRCFILES) |
1515 |
|
cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h |
1516 |
|
@make \$(F77FILES) |
1517 |
|
@make \$(AD_FLOW_FILES) |
1518 |
|
cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f |
1519 |
|
|
1520 |
|
svd_taf_output.f: svd_input_code.f |
1521 |
|
\$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f |
1522 |
|
cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f |
1523 |
|
|
1524 |
svd_taf: svd_taf_output.o \$(OBJFILES) |
svd_taf: svd_taf_output.o \$(OBJFILES) |
1525 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS) |
1526 |
|
|
1527 |
|
|
1528 |
#========================================= |
#========================================= |
1563 |
|
|
1564 |
printf "\n=== Done ===\n" |
printf "\n=== Done ===\n" |
1565 |
|
|
1566 |
|
# Write the "template" files for the adjoint builds |
1567 |
|
cat >AD_CONFIG.template <<EOF |
1568 |
|
C WARNING: This file is automatically generated by genmake2 and |
1569 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1570 |
|
C unless you are CERTAIN that you know what you are doing. |
1571 |
|
|
1572 |
|
#undef ALLOW_ADJOINT_RUN |
1573 |
|
#undef ALLOW_TANGENTLINEAR_RUN |
1574 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1575 |
|
EOF |
1576 |
|
cat >ad_config.template <<EOF |
1577 |
|
C WARNING: This file is automatically generated by genmake2 and |
1578 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1579 |
|
C unless you are CERTAIN that you know what you are doing. |
1580 |
|
|
1581 |
|
#define ALLOW_ADJOINT_RUN |
1582 |
|
#undef ALLOW_TANGENTLINEAR_RUN |
1583 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1584 |
|
EOF |
1585 |
|
cat >ftl_config.template <<EOF |
1586 |
|
C WARNING: This file is automatically generated by genmake2 and |
1587 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1588 |
|
C unless you are CERTAIN that you know what you are doing. |
1589 |
|
|
1590 |
|
#undef ALLOW_ADJOINT_RUN |
1591 |
|
#define ALLOW_TANGENTLINEAR_RUN |
1592 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1593 |
|
EOF |
1594 |
|
cat >svd_config.template <<EOF |
1595 |
|
C WARNING: This file is automatically generated by genmake2 and |
1596 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1597 |
|
C unless you are CERTAIN that you know what you are doing. |
1598 |
|
|
1599 |
|
#undef ALLOW_ADJOINT_RUN |
1600 |
|
#undef ALLOW_TANGENTLINEAR_RUN |
1601 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1602 |
|
EOF |
1603 |
|
cp AD_CONFIG.template AD_CONFIG.h |
1604 |
|
|
1605 |
|
|
1606 |
# Write the "state" for future records |
# Write the "state" for future records |
1607 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" != xf ; then |