124 |
EOF |
EOF |
125 |
test -f Makefile && mv -f Makefile Makefile.bak |
test -f Makefile && mv -f Makefile Makefile.bak |
126 |
cat <<EOF >> Makefile |
cat <<EOF >> Makefile |
|
%.$tfs : %.F |
|
127 |
.SUFFIXES: |
.SUFFIXES: |
128 |
genmake_hello.$tfs: genmake_hello.F |
.SUFFIXES: .$tfs .F |
129 |
$LN genmake_hello.F genmake_hello.$tfs |
.F.$tfs: |
130 |
|
$LN \$< \$@ |
131 |
EOF |
EOF |
132 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
133 |
RETVAL=$? |
RETVAL=$? |
269 |
|
|
270 |
look_for_makedepend |
look_for_makedepend |
271 |
|
|
272 |
# look for possible fortran compilers |
#================================================================ |
273 |
|
# look for possible C compilers |
274 |
|
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc" |
275 |
|
p_CC= |
276 |
|
for c in $tmp ; do |
277 |
|
rm -f ./genmake_hello.c ./genmake_hello |
278 |
|
cat >> genmake_hello.c << EOF |
279 |
|
#include <stdio.h> |
280 |
|
int main(int argc, char **argv) { |
281 |
|
printf("Hello!\n"); |
282 |
|
return 0; |
283 |
|
} |
284 |
|
EOF |
285 |
|
$c -o genmake_hello genmake_hello.c > /dev/null 2>&1 |
286 |
|
RETVAL=$? |
287 |
|
if test "x${RETVAL}" = x0 ; then |
288 |
|
p_CC="$p_CC $c" |
289 |
|
fi |
290 |
|
done |
291 |
|
rm -f ./genmake_hello.c ./genmake_hello |
292 |
|
if test "x${p_CC}" = x ; then |
293 |
|
cat 1>&2 <<EOF |
294 |
|
|
295 |
|
Error: No C compilers were found in your path. Please specify one using: |
296 |
|
|
297 |
|
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
298 |
|
2) the CC or MITGCM_CC environment variables. |
299 |
|
|
300 |
|
EOF |
301 |
|
exit 1 |
302 |
|
else |
303 |
|
echo " The possible C compilers found in your path are:" |
304 |
|
echo " "$p_CC |
305 |
|
if test "x$CC" = x ; then |
306 |
|
CC=`echo $p_CC | $AWK '{print $1}'` |
307 |
|
echo " Setting C compiler to: "$CC |
308 |
|
fi |
309 |
|
fi |
310 |
|
|
311 |
|
#================================================================ |
312 |
|
# look for possible FORTRAN compilers |
313 |
tmp="$MITGCM_FC $FC efc 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" |
314 |
p_FC= |
p_FC= |
315 |
for c in $tmp ; do |
for c in $tmp ; do |
335 |
|
|
336 |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
337 |
2) a command-line option (eg. "-fc NAME"), or |
2) a command-line option (eg. "-fc NAME"), or |
338 |
3) the MITGCM_FC environment variable. |
3) the FC or MITGCM_FC environment variables. |
339 |
|
|
340 |
EOF |
EOF |
341 |
exit 1 |
exit 1 |
506 |
will search for a working compiler by trying a list of |
will search for a working compiler by trying a list of |
507 |
"usual suspects" such as g77, f77, etc. |
"usual suspects" such as g77, f77, etc. |
508 |
|
|
509 |
|
-cc NAME | --cc NAME | -cc=NAME | --cc=NAME |
510 |
|
Use "NAME" as the C compiler. By default, genmake |
511 |
|
will search for a working compiler by trying a list of |
512 |
|
"usual suspects" such as gcc, c89, cc, etc. |
513 |
|
|
514 |
-[no]ieee | --[no]ieee |
-[no]ieee | --[no]ieee |
515 |
Do or don't use IEEE numerics. Note that this option |
Do or don't use IEEE numerics. Note that this option |
516 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
520 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
521 |
-mpi=PATH | --mpi=PATH |
-mpi=PATH | --mpi=PATH |
522 |
Include MPI header files and link to MPI libraries using MPI_ROOT |
Include MPI header files and link to MPI libraries using MPI_ROOT |
523 |
set to PATH. i.e. Include files from $PATH/include, link to libraries |
set to PATH. i.e. Include files from \$PATH/include, link to libraries |
524 |
from $PATH/lib and use binaries from $PATH/bin. |
from \$PATH/lib and use binaries from \$PATH/bin. |
525 |
|
|
526 |
-bash NAME |
-bash NAME |
527 |
Explicitly specify the Bourne or BASH shell to use |
Explicitly specify the Bourne or BASH shell to use |
569 |
EOF |
EOF |
570 |
return 1 |
return 1 |
571 |
fi |
fi |
572 |
c_tcall=`nm genmake_test.o | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
c_tcall=`nm genmake_test.o 2>/dev/null | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
573 |
RETVAL=$? |
RETVAL=$? |
574 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
575 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
599 |
EOF |
EOF |
600 |
return 1 |
return 1 |
601 |
fi |
fi |
602 |
f_tcall=`nm genmake_tcomp.o | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
f_tcall=`nm genmake_tcomp.o 2>/dev/null | grep 'T ' | grep tcall | cut -d ' ' -f 3` |
603 |
RETVAL=$? |
RETVAL=$? |
604 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
605 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
675 |
} |
} |
676 |
|
|
677 |
|
|
678 |
|
check_HAVE_STAT() { |
679 |
|
get_fortran_c_namemangling |
680 |
|
cat <<EOF > genmake_tc_1.c |
681 |
|
$FC_NAMEMANGLE |
682 |
|
#include <stdio.h> |
683 |
|
#include <stdlib.h> |
684 |
|
#include <unistd.h> |
685 |
|
#include <sys/stat.h> |
686 |
|
#include <sys/types.h> |
687 |
|
void FC_NAMEMANGLE(tfsize) ( int *nbyte ) |
688 |
|
{ |
689 |
|
char name[512]; |
690 |
|
struct stat astat; |
691 |
|
|
692 |
|
name[0] = 'a'; name[1] = '\0'; |
693 |
|
if (! stat(name, &astat)) |
694 |
|
*nbyte = (int)(astat.st_size); |
695 |
|
else |
696 |
|
*nbyte = -1; |
697 |
|
} |
698 |
|
EOF |
699 |
|
make genmake_tc_1.o >> genmake_tc.log 2>&1 |
700 |
|
RET_C=$? |
701 |
|
cat <<EOF > genmake_tc_2.f |
702 |
|
program hello |
703 |
|
integer nbyte |
704 |
|
call tfsize(nbyte) |
705 |
|
print *," HELLO WORLD", nbyte |
706 |
|
end program hello |
707 |
|
EOF |
708 |
|
$FC $FFLAGS -o genmake_tc genmake_tc_2.f genmake_tc_1.o >> genmake_tc.log 2>&1 |
709 |
|
RET_F=$? |
710 |
|
test -x ./genmake_tc && ./genmake_tc >> genmake_tc.log 2>&1 |
711 |
|
RETVAL=$? |
712 |
|
if test "x$RETVAL" = x0 ; then |
713 |
|
HAVE_STAT=t |
714 |
|
DEFINES="$DEFINES -DHAVE_STAT" |
715 |
|
fi |
716 |
|
rm -f genmake_tc* |
717 |
|
} |
718 |
|
|
719 |
|
|
720 |
check_netcdf_libs() { |
check_netcdf_libs() { |
721 |
|
echo "" > genmake_tnc.log |
722 |
cat <<EOF > genmake_tnc.for |
cat <<EOF > genmake_tnc.for |
723 |
program fgennc |
program fgennc |
724 |
#include "netcdf.inc" |
#include "netcdf.inc" |
731 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
732 |
end |
end |
733 |
EOF |
EOF |
734 |
#echo "$CPP $DEFINES $INCLUDES" |
#echo "$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f" |
735 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f \ |
#echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.f" |
736 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
#echo "$LINK -o genmake_tnc.o $LIBS" |
737 |
|
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
738 |
|
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.f >> genmake_tnc.log 2>&1 \ |
739 |
|
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
740 |
RET_COMPILE=$? |
RET_COMPILE=$? |
741 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
|
742 |
RETVAL=$? |
#EH3 Remove test program execution for machines that either disallow |
743 |
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
#EH3 execution or cannot support it (eg. cross-compilers) |
744 |
|
#EH3 |
745 |
|
#EH3 test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
746 |
|
#EH3 RETVAL=$? |
747 |
|
#EH3 if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
748 |
|
|
749 |
|
if test "x$RET_COMPILE" = x0 ; then |
750 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
751 |
else |
else |
752 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
753 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f \ |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
754 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.f >> genmake_tnc.log 2>&1 \ |
755 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
756 |
RET_COMPILE=$? |
RET_COMPILE=$? |
757 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
if test "x$RET_COMPILE" = x0 ; then |
|
RETVAL=$? |
|
|
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
|
758 |
LIBS="$LIBS -lnetcdf" |
LIBS="$LIBS -lnetcdf" |
759 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
760 |
else |
else |
778 |
S64= |
S64= |
779 |
KPP= |
KPP= |
780 |
FC= |
FC= |
781 |
|
#CC=gcc |
782 |
CPP= |
CPP= |
783 |
LINK= |
LINK= |
784 |
DEFINES= |
DEFINES= |
810 |
HAVE_FDATE= |
HAVE_FDATE= |
811 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
812 |
HAVE_CLOC= |
HAVE_CLOC= |
813 |
|
HAVE_STAT= |
814 |
HAVE_NETCDF= |
HAVE_NETCDF= |
815 |
HAVE_ETIME= |
HAVE_ETIME= |
816 |
|
|
825 |
PWD=`pwd` |
PWD=`pwd` |
826 |
MAKE=make |
MAKE=make |
827 |
AWK=awk |
AWK=awk |
828 |
THISHOSTNAME=`hostname` |
THISHOST=`hostname` |
829 |
THISCWD=`pwd` |
THISCWD=`pwd` |
830 |
THISDATE=`date` |
THISDATE=`date` |
831 |
|
THISUSER=`echo $USER` |
832 |
|
THISVER= |
833 |
MACHINE=`uname -a` |
MACHINE=`uname -a` |
834 |
EXECUTABLE= |
EXECUTABLE= |
835 |
EXEHOOK= |
EXEHOOK= |
863 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
864 |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
865 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
866 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE" |
867 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
868 |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
869 |
|
|
904 |
echo "none found" |
echo "none found" |
905 |
fi |
fi |
906 |
|
|
907 |
# echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
#echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
908 |
#OPTIONS= |
#OPTIONS= |
909 |
#n=0 |
#n=0 |
910 |
#for i ; do |
#for i ; do |
916 |
#done |
#done |
917 |
#parse_options |
#parse_options |
918 |
ac_prev= |
ac_prev= |
919 |
for ac_option in $@ ; do |
for ac_option in "$@" ; do |
920 |
|
|
921 |
G2ARGS="$G2ARGS \"$ac_option\"" |
G2ARGS="$G2ARGS \"$ac_option\"" |
922 |
|
|
1012 |
# ac_prev=cpp ;; |
# ac_prev=cpp ;; |
1013 |
# -cpp=* | --cpp=*) |
# -cpp=* | --cpp=*) |
1014 |
# CPP=$ac_optarg ;; |
# CPP=$ac_optarg ;; |
1015 |
|
|
1016 |
|
-cc | --cc) |
1017 |
|
ac_prev=CC ;; |
1018 |
|
-cc=* | --cc=*) |
1019 |
|
CC=$ac_optarg ;; |
1020 |
|
|
1021 |
-fortran | --fortran | -fc | --fc) |
-fortran | --fortran | -fc | --fc) |
1022 |
ac_prev=FC ;; |
ac_prev=FC ;; |
1023 |
-fc=* | --fc=*) |
-fc=* | --fc=*) |
1088 |
echo |
echo |
1089 |
fi |
fi |
1090 |
|
|
1091 |
|
# Find the MITgcm ${ROOTDIR} |
1092 |
if test "x${ROOTDIR}" = x ; then |
if test "x${ROOTDIR}" = x ; then |
1093 |
tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'` |
tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'` |
1094 |
if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
1115 |
exit 1 |
exit 1 |
1116 |
fi |
fi |
1117 |
|
|
1118 |
|
# Find the MITgcm ${THISVER} |
1119 |
|
if test -f "${ROOTDIR}/doc/tag-index" ; then |
1120 |
|
THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1` |
1121 |
|
fi |
1122 |
|
|
1123 |
echo " getting OPTFILE information: " |
echo " getting OPTFILE information: " |
1124 |
if test "x${OPTFILE}" = x ; then |
if test "x${OPTFILE}" = x ; then |
1125 |
if test "x$MITGCM_OF" = x ; then |
if test "x$MITGCM_OF" = x ; then |
1179 |
fi |
fi |
1180 |
fi |
fi |
1181 |
|
|
1182 |
# Check that FC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
# Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
1183 |
# either set defaults or complain and abort! |
# either set defaults or complain and abort! |
1184 |
if test ! "x$BASH" = x ; then |
if test ! "x$BASH" = x ; then |
1185 |
# add a trailing space so that it works within the Makefile syntax (see below) |
# add a trailing space so that it works within the Makefile syntax (see below) |
1195 |
EOF |
EOF |
1196 |
exit 1 |
exit 1 |
1197 |
fi |
fi |
1198 |
|
if test "x$CC" = x ; then |
1199 |
|
CC=cc |
1200 |
|
# cat <<EOF 1>&2 |
1201 |
|
# Error: no C compiler: please specify using one of the following: |
1202 |
|
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
1203 |
|
# 2) the "-cc=XXX" command-line option |
1204 |
|
# 3) the "./genmake_local" file |
1205 |
|
# EOF |
1206 |
|
# exit 1 |
1207 |
|
fi |
1208 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1209 |
LINK=$FC |
LINK=$FC |
1210 |
fi |
fi |
1336 |
fi |
fi |
1337 |
rm -f genmake_t* |
rm -f genmake_t* |
1338 |
|
|
1339 |
|
printf " Can we use stat() through C calls... " |
1340 |
|
check_HAVE_STAT |
1341 |
|
if test "x$HAVE_STAT" != x ; then |
1342 |
|
echo "yes" |
1343 |
|
else |
1344 |
|
echo "no" |
1345 |
|
fi |
1346 |
|
rm -f genmake_t* |
1347 |
|
|
1348 |
printf " Can we create NetCDF-enabled binaries... " |
printf " Can we create NetCDF-enabled binaries... " |
1349 |
check_netcdf_libs |
check_netcdf_libs |
1350 |
if test "x$HAVE_NETCDF" != x ; then |
if test "x$HAVE_NETCDF" != x ; then |
1397 |
exit 1 |
exit 1 |
1398 |
fi |
fi |
1399 |
if test "x$S64" = x ; then |
if test "x$S64" = x ; then |
1400 |
S64='$(TOOLSDIR)/set64bitConst.sh' |
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.sh > /dev/null 2>&1 |
1401 |
|
RETVAL=$? |
1402 |
|
if test "x${RETVAL}" = x0 ; then |
1403 |
|
S64='$(TOOLSDIR)/set64bitConst.sh' |
1404 |
|
else |
1405 |
|
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.csh > /dev/null 2>&1 |
1406 |
|
RETVAL=$? |
1407 |
|
if test "x${RETVAL}" = x0 ; then |
1408 |
|
S64='$(TOOLSDIR)/set64bitConst.csh' |
1409 |
|
else |
1410 |
|
cat <<EOF |
1411 |
|
|
1412 |
|
ERROR: neither of the two default scripts: |
1413 |
|
|
1414 |
|
${TOOLSDIR}/set64bitConst.sh |
1415 |
|
${TOOLSDIR}/set64bitConst.csh |
1416 |
|
|
1417 |
|
are working so please check paths or specify (with \$S64) a |
1418 |
|
working version of this script. |
1419 |
|
|
1420 |
|
EOF |
1421 |
|
exit 1 |
1422 |
|
fi |
1423 |
|
fi |
1424 |
fi |
fi |
1425 |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
1426 |
|
|
1565 |
rm -f ./.tmp_pack |
rm -f ./.tmp_pack |
1566 |
echo " packages are: $PACKAGES" |
echo " packages are: $PACKAGES" |
1567 |
|
|
1568 |
|
# Check availability of NetCDF and then either build the MNC template |
1569 |
|
# files or delete mnc from the list of available packages. |
1570 |
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
1571 |
|
RETVAL=$? |
1572 |
|
if test "x$RETVAL" = x0 ; then |
1573 |
|
if test "x$HAVE_NETCDF" != xt ; then |
1574 |
|
cat <<EOF |
1575 |
|
|
1576 |
|
********************************************************************* |
1577 |
|
WARNING: the "mnc" package was enabled but tests failed to compile |
1578 |
|
NetCDF applications. Please check that: |
1579 |
|
|
1580 |
|
1) NetCDF is correctly installed for this compiler and |
1581 |
|
2) the LIBS variable (within the "optfile") specifies the correct |
1582 |
|
NetCDF library to link against. |
1583 |
|
|
1584 |
|
Due to this failure, the "mnc" package is now DISABLED. |
1585 |
|
********************************************************************* |
1586 |
|
|
1587 |
|
EOF |
1588 |
|
PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'` |
1589 |
|
DISABLE="$DISABLE mnc" |
1590 |
|
else |
1591 |
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1 |
1592 |
|
RETVAL=$? |
1593 |
|
if test "x${RETVAL}" = x0 ; then |
1594 |
|
rm -f make_mnc.errors |
1595 |
|
else |
1596 |
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
1597 |
|
cat make_mnc.errors 1>&2 |
1598 |
|
exit 1 |
1599 |
|
fi |
1600 |
|
fi |
1601 |
|
fi |
1602 |
|
|
1603 |
echo " applying package dependency rules" |
echo " applying package dependency rules" |
1604 |
ck= |
ck= |
1605 |
while test "x$ck" != xtt ; do |
while test "x$ck" != xtt ; do |
1684 |
fi |
fi |
1685 |
done |
done |
1686 |
|
|
|
# Build MNC templates and check for ability to build and use NetCDF |
|
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
|
|
RETVAL=$? |
|
|
if test "x$RETVAL" = x0 ; then |
|
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1 |
|
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
rm -f make_mnc.errors |
|
|
else |
|
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
|
|
cat make_mnc.errors 1>&2 |
|
|
exit 1 |
|
|
fi |
|
|
if test "x$HAVE_NETCDF" != xt ; then |
|
|
cat <<EOF |
|
|
|
|
|
WARNING: the "mnc" package has been enabled but tests failed to |
|
|
compile and/or execute NetCDF applications. Please check that: |
|
|
|
|
|
1) NetCDF is installed for your compiler and |
|
|
2) the LIBS variable (within the 'optfile") specifies the correct |
|
|
NetCDF library to link against. |
|
|
|
|
|
EOF |
|
|
fi |
|
|
fi |
|
|
|
|
1687 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
1688 |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
1689 |
# The following UGLY HACK sets multiple "#undef"s and it needs to go |
# The following UGLY HACK sets multiple "#undef"s and it needs to go |
1830 |
;; |
;; |
1831 |
./FC_NAMEMANGLE.h) |
./FC_NAMEMANGLE.h) |
1832 |
;; |
;; |
1833 |
|
./BUILD_INFO.h) |
1834 |
|
;; |
1835 |
*) |
*) |
1836 |
touch .links.tmp/$sf |
touch .links.tmp/$sf |
1837 |
deplist="$deplist $sf" |
deplist="$deplist $sf" |
1888 |
echo "# by the command:" >> $MAKEFILE |
echo "# by the command:" >> $MAKEFILE |
1889 |
echo "# $0 $G2ARGS" >> $MAKEFILE |
echo "# $0 $G2ARGS" >> $MAKEFILE |
1890 |
echo "# executed by:" >> $MAKEFILE |
echo "# executed by:" >> $MAKEFILE |
1891 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
echo "# ${THISUSER}@${THISHOST}:${THISCWD}" >> $MAKEFILE |
1892 |
|
|
1893 |
EXE_AD=$EXECUTABLE"_ad" |
EXE_AD=$EXECUTABLE"_ad" |
1894 |
EXE_FTL=$EXECUTABLE"_ftl" |
EXE_FTL=$EXECUTABLE"_ftl" |
1934 |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
1935 |
|
|
1936 |
# These files are created by Makefile |
# These files are created by Makefile |
1937 |
SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h |
SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h BUILD_INFO.h |
1938 |
|
|
1939 |
EOF |
EOF |
1940 |
|
|
1953 |
FC = ${FC} |
FC = ${FC} |
1954 |
# Fortran compiler |
# Fortran compiler |
1955 |
F90C = ${F90C} |
F90C = ${F90C} |
1956 |
|
# C compiler |
1957 |
|
CC = ${CC} |
1958 |
# Link editor |
# Link editor |
1959 |
LINK = ${LINK} ${LDADD} |
LINK = ${LINK} ${LDADD} |
1960 |
|
|
1977 |
NOOPTFILES = ${NOOPTFILES} |
NOOPTFILES = ${NOOPTFILES} |
1978 |
NOOPTFLAGS = ${NOOPTFLAGS} |
NOOPTFLAGS = ${NOOPTFLAGS} |
1979 |
# Flags and libraries needed for linking |
# Flags and libraries needed for linking |
1980 |
LIBS = ${LIBS} \$(XLIBS) |
LIBS = ${LIBS} |
1981 |
# Name of the Mekfile |
# Name of the Mekfile |
1982 |
MAKEFILE=${MAKEFILE} |
MAKEFILE=${MAKEFILE} |
1983 |
|
|
2038 |
cleanlinks: |
cleanlinks: |
2039 |
-find . -type l -exec rm {} \; |
-find . -type l -exec rm {} \; |
2040 |
|
|
2041 |
# Special targets ($SPECIAL_FILES) which are create by make |
# Special targets (SPECIAL_FILES) which are create by make |
2042 |
${PACKAGES_DOT_H}: |
${PACKAGES_DOT_H}: |
2043 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2044 |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@ |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@ |
2049 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2050 |
echo "$FC_NAMEMANGLE" > \$@ |
echo "$FC_NAMEMANGLE" > \$@ |
2051 |
|
|
2052 |
|
BUILD_INFO.h: |
2053 |
|
@echo Creating \$@ ... |
2054 |
|
EOF |
2055 |
|
|
2056 |
|
test ! "x$THISVER" = x && echo " -echo \"#define THISVER '$THISVER'\" > \$@" >> $MAKEFILE |
2057 |
|
test ! "x$THISUSER" = x && echo " -echo \"#define THISUSER '$THISUSER'\" >> \$@" >> $MAKEFILE |
2058 |
|
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
2059 |
|
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
2060 |
|
|
2061 |
|
cat >>$MAKEFILE <<EOF |
2062 |
|
|
2063 |
# The normal chain of rules is ( .F - .$FS - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |
2064 |
|
|
2065 |
%.o : %.F |
## This nullifies any default implicit rules concerning these two file types: |
2066 |
|
## %.o : %.F |
2067 |
|
|
2068 |
.F.$FS: |
.F.$FS: |
2069 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2148 |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
2149 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
2150 |
|
|
2151 |
|
adonlyfwd: |
2152 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff |
2153 |
|
|
2154 |
|
adtrick: |
2155 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff |
2156 |
|
|
2157 |
# ... FTL ... |
# ... FTL ... |
2158 |
ftlall: ftl_taf |
ftlall: ftl_taf |
2188 |
|
|
2189 |
# ... SVD ... |
# ... SVD ... |
2190 |
svdtaf: ad_taf_output.f ftl_taf_output.f |
svdtaf: ad_taf_output.f ftl_taf_output.f |
2191 |
svdall: svd_taf |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
2192 |
|
@echo "--->>> Do make svdall afterwards to compile. <<<---" |
2193 |
|
svdall: svd_touch svd_taf |
2194 |
|
|
2195 |
svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES) |
svd_taf: \$(OBJFILES) |
2196 |
\$(LINK) -o mitgcmuv_svd \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o ftl_taf_output.o \$(LIBS) |
\$(LINK) -o mitgcmuv_svd \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o ftl_taf_output.o \$(LIBS) |
2197 |
|
|
2198 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2199 |
|
@echo "--->>> Assumes you previously <<<---" |
2200 |
|
@echo "--->>> did make svdtaf <<<---" |
2201 |
|
|
2202 |
|
svd_touch: |
2203 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2204 |
|
@echo "--->>> Assumes you previously <<<---" |
2205 |
|
@echo "--->>> did make svdtaf <<<---" |
2206 |
|
touch ad_taf_output.f ftl_taf_output.f |
2207 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.f |
2208 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.f |
2209 |
|
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template |
2210 |
|
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
2211 |
|
-rm -f ftl_config.template |
2212 |
|
|
2213 |
#========================================= |
#========================================= |
2214 |
|
|