104 |
fi |
fi |
105 |
|
|
106 |
# look for possible fortran compilers |
# look for possible fortran compilers |
107 |
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" |
108 |
p_FC= |
p_FC= |
109 |
for c in $tmp ; do |
for c in $tmp ; do |
110 |
rm -f ./hello.f ./hello |
rm -f ./hello.f ./hello |
121 |
p_FC="$p_FC $c" |
p_FC="$p_FC $c" |
122 |
fi |
fi |
123 |
done |
done |
124 |
|
rm -f ./hello.f ./hello |
125 |
if test "x${p_FC}" = x ; then |
if test "x${p_FC}" = x ; then |
126 |
cat 1>&2 <<EOF |
cat 1>&2 <<EOF |
127 |
|
|
1041 |
fi |
fi |
1042 |
done |
done |
1043 |
|
|
1044 |
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" |
1045 |
echo " of \"#define ALLOW_PKGNAME\"-type statements:" |
echo " of \"#define ALLOW_PKGNAME\"-type statements:" |
1046 |
CPP_OPTIONS= |
CPP_OPTIONS= |
1047 |
spaths=". $INCLUDEDIRS" |
spaths=". $INCLUDEDIRS" |
1048 |
for i in $spaths ; do |
for i in $spaths ; do |
1173 |
echo "# $0 $@" >> $MAKEFILE |
echo "# $0 $@" >> $MAKEFILE |
1174 |
echo "# executed by:" >> $MAKEFILE |
echo "# executed by:" >> $MAKEFILE |
1175 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
1176 |
|
|
1177 |
|
EXE_AD=$EXECUTABLE"_ad" |
1178 |
|
EXE_FTL=$EXECUTABLE"_ftl" |
1179 |
|
EXE_SVD=$EXECUTABLE"_svd" |
1180 |
|
|
1181 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
1182 |
# |
# |
1183 |
# BUILDDIR : Directory where object files are written |
# BUILDDIR : Directory where object files are written |
1208 |
|
|
1209 |
#eh3 new defines for the adjoint work |
#eh3 new defines for the adjoint work |
1210 |
AUTODIFF = ${ROOTDIR}/pkg/autodiff |
AUTODIFF = ${ROOTDIR}/pkg/autodiff |
1211 |
|
EXE_AD = ${EXE_AD} |
1212 |
|
EXE_FTL = ${EXE_FTL} |
1213 |
|
EXE_SVD = ${EXE_SVD} |
1214 |
|
|
1215 |
EOF |
EOF |
1216 |
|
|
1292 |
@\$(EXECUTABLE) > \$@ |
@\$(EXECUTABLE) > \$@ |
1293 |
|
|
1294 |
clean: |
clean: |
1295 |
|
-cat AD_CONFIG.template > AD_CONFIG.h |
1296 |
-rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} |
-rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} |
1297 |
Clean: |
Clean: |
1298 |
@make clean |
@make clean |
1299 |
@make cleanlinks |
@make cleanlinks |
1300 |
-rm -f Makefile.bak genmake_state genmake_optfile make.log |
-rm -f Makefile.bak genmake_state genmake_*optfile make.log |
1301 |
CLEAN: |
CLEAN: |
1302 |
@make Clean |
@make Clean |
1303 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1360 |
echo -n " $i" >> $MAKEFILE |
echo -n " $i" >> $MAKEFILE |
1361 |
done |
done |
1362 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
1363 |
|
rm -f ad_files |
1364 |
|
|
1365 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
1366 |
|
|
1367 |
ad_input_code.f: \$(F77FILES) |
# ... AD ... |
1368 |
|
adall: ad_taf |
1369 |
|
adtaf: ad_taf_output.f |
1370 |
|
adtamc: ad_tamc_output.f |
1371 |
|
|
1372 |
|
ad_input_code.f: \$(SRCFILES) \$(HEADERFILES) |
1373 |
|
cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h |
1374 |
|
@make \$(F77FILES) |
1375 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
1376 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
1377 |
|
|
|
# ... AD ... |
|
1378 |
ad_taf_output.f: ad_input_code.f |
ad_taf_output.f: ad_input_code.f |
1379 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
1380 |
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 |
1381 |
|
|
1382 |
ad_taf: ad_taf_output.o \$(OBJFILES) |
ad_taf: ad_taf_output.o \$(OBJFILES) |
1383 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
1384 |
|
|
1385 |
ad_tamc_output.f: ad_input_code.f |
ad_tamc_output.f: ad_input_code.f |
1386 |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
1387 |
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 |
1388 |
|
|
1389 |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
1390 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
1391 |
|
|
1392 |
|
|
1393 |
# ... FLT ... |
# ... FTL ... |
1394 |
flt_taf_output.f: ad_input_code.f |
ftlall: ftl_taf |
1395 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
ftltaf: ftl_taf_output.f |
1396 |
cat ad_input_code_ad.f | sed -f adjoint_sed > flt_taf_output.f |
ftltamc: ftl_tamc_output.f |
1397 |
|
|
1398 |
flt_taf: flt_taf_output.o \$(OBJFILES) |
ftl_input_code.f: \$(SRCFILES) |
1399 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) flt_taf_output.o \$(LIBS) |
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
1400 |
|
@make \$(F77FILES) |
1401 |
|
@make \$(AD_FLOW_FILES) |
1402 |
|
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f |
1403 |
|
|
1404 |
|
ftl_taf_output.f: ftl_input_code.f |
1405 |
|
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
1406 |
|
cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f |
1407 |
|
|
1408 |
flt_tamc_output.f: ad_input_code.f |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
1409 |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
|
cat ad_input_code_ad.f | sed -f adjoint_sed > flt_tamc_output.f |
|
1410 |
|
|
1411 |
flt_tamc: flt_tamc_output.o \$(OBJFILES) |
ftl_tamc_output.f: ftl_input_code.f |
1412 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) flt_tamc_output.o \$(LIBS) |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f |
1413 |
|
cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f |
1414 |
|
|
1415 |
|
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
1416 |
|
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
1417 |
|
|
1418 |
|
|
1419 |
# ... SVD ... |
# ... SVD ... |
1420 |
svd_taf_output.f: ad_input_code.f |
svd: svd_taf |
1421 |
\$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
svd_taf_f: svd_taf_output.f |
1422 |
cat ad_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f |
|
1423 |
|
svd_input_code.f: \$(SRCFILES) |
1424 |
|
cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h |
1425 |
|
@make \$(F77FILES) |
1426 |
|
@make \$(AD_FLOW_FILES) |
1427 |
|
cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f |
1428 |
|
|
1429 |
|
svd_taf_output.f: svd_input_code.f |
1430 |
|
\$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f |
1431 |
|
cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f |
1432 |
|
|
1433 |
svd_taf: svd_taf_output.o \$(OBJFILES) |
svd_taf: svd_taf_output.o \$(OBJFILES) |
1434 |
\$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS) |
1435 |
|
|
1436 |
|
|
1437 |
#========================================= |
#========================================= |
1472 |
|
|
1473 |
printf "\n=== Done ===\n" |
printf "\n=== Done ===\n" |
1474 |
|
|
1475 |
|
# Write the "template" files for the adjoint builds |
1476 |
|
cat >AD_CONFIG.template <<EOF |
1477 |
|
C WARNING: This file is automatically generated by genmake2 and |
1478 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1479 |
|
C unless you are CERTAIN that you know what you are doing. |
1480 |
|
|
1481 |
|
#undef ALLOW_ADJOINT_RUN |
1482 |
|
#undef ALLOW_TANGENTLINEAR_RUN |
1483 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1484 |
|
EOF |
1485 |
|
cat >ad_config.template <<EOF |
1486 |
|
C WARNING: This file is automatically generated by genmake2 and |
1487 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1488 |
|
C unless you are CERTAIN that you know what you are doing. |
1489 |
|
|
1490 |
|
#define ALLOW_ADJOINT_RUN |
1491 |
|
#undef ALLOW_TANGENTLINEAR_RUN |
1492 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1493 |
|
EOF |
1494 |
|
cat >ftl_config.template <<EOF |
1495 |
|
C WARNING: This file is automatically generated by genmake2 and |
1496 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1497 |
|
C unless you are CERTAIN that you know what you are doing. |
1498 |
|
|
1499 |
|
#undef ALLOW_ADJOINT_RUN |
1500 |
|
#define ALLOW_TANGENTLINEAR_RUN |
1501 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1502 |
|
EOF |
1503 |
|
cat >svd_config.template <<EOF |
1504 |
|
C WARNING: This file is automatically generated by genmake2 and |
1505 |
|
C used by the Makefile rules. Please DO NOT EDIT this file |
1506 |
|
C unless you are CERTAIN that you know what you are doing. |
1507 |
|
|
1508 |
|
#undef ALLOW_ADJOINT_RUN |
1509 |
|
#undef ALLOW_TANGENTLINEAR_RUN |
1510 |
|
#undef ALLOW_ECCO_OPTIMIZATION |
1511 |
|
EOF |
1512 |
|
cp AD_CONFIG.template AD_CONFIG.h |
1513 |
|
|
1514 |
|
|
1515 |
# Write the "state" for future records |
# Write the "state" for future records |
1516 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" != xf ; then |