290 |
} |
} |
291 |
|
|
292 |
|
|
293 |
# Guess possible config options for this host |
# look for possible C compilers |
294 |
find_possible_configs() { |
look_for_C_compilers() { |
|
|
|
|
tmp1=`uname`"_"`uname -m` |
|
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
|
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
|
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
|
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
|
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
|
|
PLATFORM=$tmp3 |
|
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
|
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
|
|
echo " The platform appears to be: $PLATFORM" |
|
|
|
|
|
echo "test" > test |
|
|
ln -s ./test link |
|
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
LN="ln -s" |
|
|
else |
|
|
echo "Error: \"ln -s\" does not appear to work on this system!" |
|
|
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
|
|
exit 1 |
|
|
fi |
|
|
rm -f test link |
|
|
|
|
|
if test "x$CPP" = x ; then |
|
|
CPP="cpp -traditional -P" |
|
|
fi |
|
|
|
|
|
look_for_makedepend |
|
|
|
|
|
#================================================================ |
|
|
# look for possible C compilers |
|
295 |
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" |
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" |
296 |
p_CC= |
p_CC= |
297 |
for c in $tmp ; do |
for c in $tmp ; do |
328 |
echo " Setting C compiler to: "$CC |
echo " Setting C compiler to: "$CC |
329 |
fi |
fi |
330 |
fi |
fi |
331 |
|
} |
332 |
|
|
333 |
|
# Guess possible config options for this host |
334 |
|
find_possible_optfile() { |
335 |
|
|
336 |
|
tmp1=`uname`"_"`uname -m` |
337 |
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
338 |
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
339 |
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
340 |
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
341 |
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
342 |
|
PLATFORM=$tmp3 |
343 |
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
344 |
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
345 |
|
echo " The platform appears to be: $PLATFORM" |
346 |
|
|
347 |
|
# echo "test" > test |
348 |
|
# ln -s ./test link |
349 |
|
# RETVAL=$? |
350 |
|
# if test "x${RETVAL}" = x0 ; then |
351 |
|
# LN="ln -s" |
352 |
|
# else |
353 |
|
# echo "Error: \"ln -s\" does not appear to work on this system!" |
354 |
|
# echo " For help, please contact <MITgcm-support@mitgcm.org>." |
355 |
|
# exit 1 |
356 |
|
# fi |
357 |
|
# rm -f test link |
358 |
|
# |
359 |
|
# if test "x$CPP" = x ; then |
360 |
|
# CPP="cpp -traditional -P" |
361 |
|
# fi |
362 |
|
# |
363 |
|
# look_for_makedepend |
364 |
|
# |
365 |
|
# look_for_C_compilers |
366 |
|
|
367 |
#================================================================ |
#================================================================ |
368 |
# look for possible FORTRAN compilers |
# look for possible FORTRAN compilers |
418 |
echo " I looked for the file "$OPTFILE" but did not find it" |
echo " I looked for the file "$OPTFILE" but did not find it" |
419 |
fi |
fi |
420 |
fi |
fi |
421 |
# echo " The options file: $p_OF" |
|
|
# echo " appears to match so we'll use it." |
|
|
# for i in $p_FC ; do |
|
|
#p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
|
|
#if test -r $p_OF ; then |
|
|
# OPTFILE=$p_OF |
|
|
# echo " The options file: $p_OF" |
|
|
# echo " appears to match so we'll use it." |
|
|
# break |
|
|
#fi |
|
|
# done |
|
422 |
if test "x$OPTFILE" = x ; then |
if test "x$OPTFILE" = x ; then |
423 |
cat 1>&2 <<EOF |
cat 1>&2 <<EOF |
424 |
|
|
649 |
if test ! "x$FC_NAMEMANGLE" = x ; then |
if test ! "x$FC_NAMEMANGLE" = x ; then |
650 |
return 0 |
return 0 |
651 |
fi |
fi |
652 |
|
echo " running: get_fortran_c_namemangling()" >> $LOGFILE |
653 |
|
|
654 |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
655 |
|
|
656 |
cat > genmake_test.c <<EOF |
cat > genmake_test.c <<EOF |
657 |
void tcall( char * string ) { tsub( string ); } |
void tcall( char * string ) { tsub( string ); } |
658 |
EOF |
EOF |
659 |
$MAKE genmake_test.o >> genmake_warnings 2>&1 |
# $MAKE genmake_test.o >> $LOGFILE 2>&1 |
660 |
|
COMM="$CC $CFLAGS -c genmake_test.c" |
661 |
|
echo ' '$COMM >> $LOGFILE |
662 |
|
$COMM >> $LOGFILE 2>&1 |
663 |
RETVAL=$? |
RETVAL=$? |
664 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
665 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
666 |
cat <<EOF>> genmake_errors |
cat <<EOF>> $LOGFILE |
667 |
|
|
668 |
WARNING: C test compile fails |
WARNING: C test compile fails |
669 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
670 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
671 |
EOF |
EOF |
672 |
return 1 |
return 1 |
673 |
fi |
fi |
675 |
RETVAL=$? |
RETVAL=$? |
676 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
677 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
678 |
cat <<EOF>> genmake_warnings |
cat <<EOF>> $LOGFILE |
679 |
|
|
680 |
WARNING: The "nm" command failed. |
WARNING: The "nm" command failed. |
681 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
682 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
683 |
EOF |
EOF |
684 |
return 1 |
return 1 |
685 |
fi |
fi |
689 |
call tsub( string ) |
call tsub( string ) |
690 |
end |
end |
691 |
EOF |
EOF |
692 |
$FC $FFLAGS -c genmake_tcomp.$FS >> genmake_warnings 2>&1 |
COMM="$FC $FFLAGS -c genmake_tcomp.$FS" |
693 |
|
echo ' '$COMM >> $LOGFILE |
694 |
|
$COMM >> $LOGFILE 2>&1 |
695 |
RETVAL=$? |
RETVAL=$? |
696 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
697 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
698 |
cat <<EOF>> genmake_warnings |
cat <<EOF>> $LOGFILE |
699 |
|
|
700 |
WARNING: FORTRAN test compile fails -- please see "genmake_errors" |
WARNING: FORTRAN test compile fails -- please see '$LOGFILE' |
701 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
702 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
703 |
EOF |
EOF |
704 |
return 1 |
return 1 |
705 |
fi |
fi |
707 |
RETVAL=$? |
RETVAL=$? |
708 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
709 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
710 |
cat <<EOF>> genmake_warnings |
cat <<EOF>> $LOGFILE |
711 |
|
|
712 |
WARNING: The "nm" command failed. |
WARNING: The "nm" command failed. |
713 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
714 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
715 |
EOF |
EOF |
716 |
return 1 |
return 1 |
717 |
fi |
fi |
737 |
|
|
738 |
# cleanup the testing files |
# cleanup the testing files |
739 |
rm -f genmake_tcomp.* genmake_test.* |
rm -f genmake_tcomp.* genmake_test.* |
740 |
|
|
741 |
|
echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE |
742 |
} |
} |
743 |
|
|
744 |
|
|
745 |
check_HAVE_CLOC() { |
check_HAVE_CLOC() { |
746 |
|
echo >> $LOGFILE |
747 |
|
echo "running: check_HAVE_CLOC()" >> $LOGFILE |
748 |
get_fortran_c_namemangling |
get_fortran_c_namemangling |
749 |
cat <<EOF > genmake_tc_1.c |
cat <<EOF > genmake_tc_1.c |
750 |
$FC_NAMEMANGLE |
$FC_NAMEMANGLE |
762 |
} |
} |
763 |
EOF |
EOF |
764 |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
765 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
766 |
$COMM >> genmake_warnings 2>&1 |
$COMM >> $LOGFILE 2>&1 |
767 |
RET_C=$? |
RET_C=$? |
768 |
cat <<EOF > genmake_tc_2.$FS |
cat <<EOF > genmake_tc_2.$FS |
769 |
program hello |
program hello |
774 |
end |
end |
775 |
EOF |
EOF |
776 |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
777 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
778 |
$COMM >> genmake_warnings 2>&1 |
$COMM >> $LOGFILE 2>&1 |
779 |
RET_F=$? |
RET_F=$? |
780 |
test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 |
test -x ./genmake_tc && ./genmake_tc >> $LOGFILE 2>&1 |
781 |
RETVAL=$? |
RETVAL=$? |
782 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
783 |
HAVE_CLOC=t |
HAVE_CLOC=t |
784 |
DEFINES="$DEFINES -DHAVE_CLOC" |
DEFINES="$DEFINES -DHAVE_CLOC" |
785 |
fi |
fi |
786 |
rm -f genmake_tc* |
rm -f genmake_tc* |
787 |
|
echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE |
788 |
} |
} |
789 |
|
|
790 |
|
|
792 |
if test ! "x$HAVE_SIGREG" = x ; then |
if test ! "x$HAVE_SIGREG" = x ; then |
793 |
return |
return |
794 |
fi |
fi |
795 |
|
echo >> $LOGFILE |
796 |
|
echo "running: check_HAVE_SIGREG()" >> $LOGFILE |
797 |
get_fortran_c_namemangling |
get_fortran_c_namemangling |
798 |
cat <<EOF > genmake_tc_1.c |
cat <<EOF > genmake_tc_1.c |
799 |
$FC_NAMEMANGLE |
$FC_NAMEMANGLE |
826 |
} |
} |
827 |
EOF |
EOF |
828 |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
829 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
830 |
$COMM >> genmake_warnings 2>&1 |
$COMM >> $LOGFILE 2>&1 |
831 |
RET_C=$? |
RET_C=$? |
832 |
cat <<EOF > genmake_tc_2.$FS |
cat <<EOF > genmake_tc_2.$FS |
833 |
program hello |
program hello |
837 |
call sigreg(anint) |
call sigreg(anint) |
838 |
end |
end |
839 |
EOF |
EOF |
840 |
echo >> genmake_warnings |
cat genmake_tc_2.$FS >> $LOGFILE |
|
echo "running: check_HAVE_SIGREG()" >> genmake_warnings |
|
|
cat genmake_tc_2.$FS >> genmake_warnings |
|
841 |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
842 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
843 |
$COMM >> genmake_warnings 2>&1 |
$COMM >> $LOGFILE 2>&1 |
844 |
RETVAL=$? |
RETVAL=$? |
845 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
846 |
HAVE_SIGREG=t |
HAVE_SIGREG=t |
847 |
DEFINES="$DEFINES -DHAVE_SIGREG" |
DEFINES="$DEFINES -DHAVE_SIGREG" |
848 |
fi |
fi |
849 |
rm -f genmake_tc* |
rm -f genmake_tc* |
850 |
|
echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE |
851 |
} |
} |
852 |
|
|
853 |
|
|
859 |
if test ! "x$HAVE_SETRLSTK" = x ; then |
if test ! "x$HAVE_SETRLSTK" = x ; then |
860 |
return |
return |
861 |
fi |
fi |
862 |
|
echo >> $LOGFILE |
863 |
|
echo "running: check_HAVE_SETRLSTK()" >> $LOGFILE |
864 |
get_fortran_c_namemangling |
get_fortran_c_namemangling |
865 |
cat <<EOF > genmake_tc_1.c |
cat <<EOF > genmake_tc_1.c |
866 |
$FC_NAMEMANGLE |
$FC_NAMEMANGLE |
877 |
} |
} |
878 |
EOF |
EOF |
879 |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
880 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
881 |
$COMM >> genmake_warnings 2>&1 |
$COMM >> $LOGFILE 2>&1 |
882 |
RET_C=$? |
RET_C=$? |
883 |
cat <<EOF > genmake_tc_2.$FS |
cat <<EOF > genmake_tc_2.$FS |
884 |
program hello |
program hello |
886 |
call setrlstk() |
call setrlstk() |
887 |
end |
end |
888 |
EOF |
EOF |
889 |
echo >> genmake_warnings |
cat genmake_tc_2.$FS >> $LOGFILE |
|
echo "running: check_HAVE_SETRLSTK()" >> genmake_warnings |
|
|
cat genmake_tc_2.$FS >> genmake_warnings |
|
890 |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
891 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
892 |
$COMM >> genmake_warnings 2>&1 |
$COMM >> $LOGFILE 2>&1 |
893 |
RETVAL=$? |
RETVAL=$? |
894 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
895 |
HAVE_SETRLSTK=t |
HAVE_SETRLSTK=t |
896 |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
897 |
fi |
fi |
898 |
rm -f genmake_tc* |
rm -f genmake_tc* |
899 |
|
echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE |
900 |
} |
} |
901 |
|
|
902 |
|
|
903 |
check_HAVE_STAT() { |
check_HAVE_STAT() { |
904 |
|
echo >> $LOGFILE |
905 |
|
echo "running: check_HAVE_STAT()" >> $LOGFILE |
906 |
get_fortran_c_namemangling |
get_fortran_c_namemangling |
907 |
cat <<EOF > genmake_tc_1.c |
cat <<EOF > genmake_tc_1.c |
908 |
$FC_NAMEMANGLE |
$FC_NAMEMANGLE |
924 |
} |
} |
925 |
EOF |
EOF |
926 |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
COMM="$CC $CFLAGS -c genmake_tc_1.c" |
927 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
928 |
$COMM >> genmake_tc.log 2>&1 |
$COMM >> genmake_tc.log 2>&1 |
929 |
RET_C=$? |
RET_C=$? |
930 |
cat <<EOF > genmake_tc_2.$FS |
cat <<EOF > genmake_tc_2.$FS |
934 |
print *," HELLO WORLD", nbyte |
print *," HELLO WORLD", nbyte |
935 |
end |
end |
936 |
EOF |
EOF |
937 |
echo >> genmake_warnings |
cat genmake_tc_2.$FS >> $LOGFILE |
|
echo "running: check_HAVE_STAT()" >> genmake_warnings |
|
|
cat genmake_tc_2.$FS >> genmake_warnings |
|
938 |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
939 |
echo $COMM >> genmake_warnings |
echo $COMM >> $LOGFILE |
940 |
$COMM >> genmake_tc.log 2>&1 |
$COMM >> genmake_tc.log 2>&1 |
941 |
RETVAL=$? |
RETVAL=$? |
942 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
944 |
DEFINES="$DEFINES -DHAVE_STAT" |
DEFINES="$DEFINES -DHAVE_STAT" |
945 |
fi |
fi |
946 |
rm -f genmake_tc* |
rm -f genmake_tc* |
947 |
|
echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE |
948 |
} |
} |
949 |
|
|
950 |
|
|
952 |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
953 |
return |
return |
954 |
fi |
fi |
955 |
echo >> genmake_warnings |
echo >> $LOGFILE |
956 |
echo "running: check_netcdf_libs()" >> genmake_warnings |
echo "running: check_netcdf_libs()" >> $LOGFILE |
957 |
cat <<EOF > genmake_tnc.F |
cat <<EOF > genmake_tnc.F |
958 |
program fgennc |
program fgennc |
959 |
#include "netcdf.inc" |
#include "netcdf.inc" |
971 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
972 |
end |
end |
973 |
EOF |
EOF |
974 |
echo "=== genmake_tnc.F ===" > genmake_tnc.log |
echo "=== genmake_tnc.F >>>" > genmake_tnc.log |
975 |
cat genmake_tnc.F >> genmake_tnc.log |
cat genmake_tnc.F >> genmake_tnc.log |
976 |
echo "=== genmake_tnc.F ===" >> genmake_tnc.log |
echo "<<< genmake_tnc.F ===" >> genmake_tnc.log |
977 |
RET_CPP=f |
RET_CPP=f |
978 |
COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES" |
COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES" |
979 |
echo "$COMM" >> genmake_tnc.log |
echo "$COMM" >> genmake_tnc.log |
989 |
$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
990 |
&& $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
&& $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
991 |
RET_COMPILE=$? |
RET_COMPILE=$? |
992 |
cat genmake_tnc.log >> genmake_warnings |
cat genmake_tnc.log >> $LOGFILE |
993 |
|
|
994 |
#EH3 Remove test program execution for machines that either disallow |
#EH3 Remove test program execution for machines that either disallow |
995 |
#EH3 execution or cannot support it (eg. cross-compilers) |
#EH3 execution or cannot support it (eg. cross-compilers) |
1000 |
|
|
1001 |
if test "x$RET_COMPILE" = x0 ; then |
if test "x$RET_COMPILE" = x0 ; then |
1002 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
1003 |
|
echo "check_netcdf: successful" >> $LOGFILE |
1004 |
else |
else |
1005 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
1006 |
echo "try again with added '-lnetcdf'" > genmake_tnc.log |
echo "==> try again with added '-lnetcdf'" > genmake_tnc.log |
1007 |
echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log |
echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log |
1008 |
echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
1009 |
echo " && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log |
echo " && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log |
1011 |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
1012 |
&& $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
&& $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
1013 |
RET_COMPILE=$? |
RET_COMPILE=$? |
1014 |
cat genmake_tnc.log >> genmake_warnings |
echo >> $LOGFILE |
1015 |
|
cat genmake_tnc.log >> $LOGFILE |
1016 |
if test "x$RET_COMPILE" = x0 ; then |
if test "x$RET_COMPILE" = x0 ; then |
1017 |
LIBS="$LIBS -lnetcdf" |
LIBS="$LIBS -lnetcdf" |
1018 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
1019 |
|
echo "check_netcdf: successful" >> $LOGFILE |
1020 |
else |
else |
1021 |
# try again with "-lnetcdff" added to the libs |
# try again with "-lnetcdff" added to the libs |
1022 |
echo "try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log |
echo "==> try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log |
1023 |
echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log |
echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log |
1024 |
echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
1025 |
echo " && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log |
echo " && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log |
1027 |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
1028 |
&& $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdff -lnetcdf >> genmake_tnc.log 2>&1 |
&& $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdff -lnetcdf >> genmake_tnc.log 2>&1 |
1029 |
RET_COMPILE=$? |
RET_COMPILE=$? |
1030 |
cat genmake_tnc.log >> genmake_warnings |
echo >> $LOGFILE |
1031 |
|
cat genmake_tnc.log >> $LOGFILE |
1032 |
if test "x$RET_COMPILE" = x0 ; then |
if test "x$RET_COMPILE" = x0 ; then |
1033 |
LIBS="$LIBS -lnetcdff -lnetcdf" |
LIBS="$LIBS -lnetcdff -lnetcdf" |
1034 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
1035 |
|
echo "check_netcdf: successful" >> $LOGFILE |
1036 |
fi |
fi |
1037 |
fi |
fi |
1038 |
fi |
fi |
1039 |
rm -f genmake_tnc* |
rm -f genmake_tnc* |
1040 |
|
echo " --> set HAVE_NETCDF='$HAVE_NETCDF'" >> $LOGFILE |
1041 |
} |
} |
1042 |
|
|
1043 |
|
|
1065 |
# MAKEDEPEND= |
# MAKEDEPEND= |
1066 |
PKG_DEPEND= |
PKG_DEPEND= |
1067 |
PKG_GROUPS= |
PKG_GROUPS= |
1068 |
DUMPSTATE=t |
DUMPSTATE=f |
1069 |
OPTFILE= |
OPTFILE= |
1070 |
INCLUDES="-I. $INCLUDES" |
INCLUDES="-I. $INCLUDES" |
1071 |
FFLAGS= |
FFLAGS= |
1173 |
|
|
1174 |
GENMAKE : |
GENMAKE : |
1175 |
|
|
1176 |
A program for GENerating MAKEfiles for the MITgcm project. For a |
A program for GENerating MAKEfiles for the MITgcm project. |
1177 |
quick list of options, use "genmake -h" or for more detail see: |
For a quick list of options, use "genmake2 -h" |
1178 |
|
or for more detail see the Developer's HOWTO manual at: |
1179 |
http://mitgcm.org/devel_HOWTO/ |
http://mitgcm.org/public/docs.html |
1180 |
|
|
1181 |
EOF |
EOF |
1182 |
|
|
1183 |
#- clean-up previous genmake logfiles: |
LOGFILE="genmake.log" |
1184 |
rm -f genmake_state genmake_*optfile genmake_warnings genmake_errors |
#- clean-up previous genmake logfiles: |
1185 |
|
rm -f genmake_state genmake_*optfile $LOGFILE |
1186 |
|
|
1187 |
echo "=== Processing options files and arguments ===" |
echo "=== Processing options files and arguments ===" |
1188 |
gm_local="genmake_local" |
gm_local="genmake_local" |
1449 |
if test "x$MITGCM_OF" = x ; then |
if test "x$MITGCM_OF" = x ; then |
1450 |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
1451 |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
1452 |
find_possible_configs |
find_possible_optfile |
1453 |
else |
else |
1454 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
1455 |
fi |
fi |
1464 |
echo "--please check that variable syntax is bash-compatible" |
echo "--please check that variable syntax is bash-compatible" |
1465 |
exit 1 |
exit 1 |
1466 |
fi |
fi |
1467 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" = xt ; then |
1468 |
cp -f $OPTFILE "genmake_optfile" |
cp -f $OPTFILE "genmake_optfile" |
1469 |
fi |
fi |
1470 |
else |
else |
1491 |
echo "--please check that variable syntax is bash-compatible" |
echo "--please check that variable syntax is bash-compatible" |
1492 |
exit 1 |
exit 1 |
1493 |
fi |
fi |
1494 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" = xt ; then |
1495 |
cp -f $AD_OPTFILE "genmake_ad_optfile" |
cp -f $AD_OPTFILE "genmake_ad_optfile" |
1496 |
fi |
fi |
1497 |
else |
else |
1519 |
EOF |
EOF |
1520 |
exit 1 |
exit 1 |
1521 |
fi |
fi |
1522 |
|
|
1523 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
1524 |
CC=cc |
look_for_C_compilers |
1525 |
|
# CC=cc |
1526 |
# cat <<EOF 1>&2 |
# cat <<EOF 1>&2 |
1527 |
# Error: no C compiler: please specify using one of the following: |
# Error: no C compiler: please specify using one of the following: |
1528 |
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
1531 |
# EOF |
# EOF |
1532 |
# exit 1 |
# exit 1 |
1533 |
fi |
fi |
1534 |
|
|
1535 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1536 |
LINK=$FC |
LINK=$FC |
1537 |
fi |
fi |
1539 |
MAKE="make" |
MAKE="make" |
1540 |
fi |
fi |
1541 |
if test "x$CPP" = x ; then |
if test "x$CPP" = x ; then |
1542 |
CPP=cpp |
CPP="cpp -traditional -P" |
1543 |
fi |
fi |
1544 |
#EH3 === UGLY === |
#EH3 === UGLY === |
1545 |
# The following is an ugly little hack to check for $CPP in /lib/ and |
# The following is an ugly little hack to check for $CPP in /lib/ and |
1566 |
else |
else |
1567 |
rm -f test_cpp |
rm -f test_cpp |
1568 |
fi |
fi |
1569 |
|
|
1570 |
look_for_makedepend |
look_for_makedepend |
1571 |
|
|
1572 |
|
# Check that soft-link command is set and usable |
1573 |
if test "x$LN" = x ; then |
if test "x$LN" = x ; then |
1574 |
LN="ln -s" |
LN="ln -s" |
1575 |
fi |
fi |
1579 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
1580 |
cat <<EOF 1>&2 |
cat <<EOF 1>&2 |
1581 |
|
|
1582 |
Error: The command "ln -s" failed -- please specify a working soft-link |
Error: The command "$LN" failed -- please specify a working soft-link |
1583 |
command in the optfile. |
command in the optfile. |
1584 |
|
|
1585 |
EOF |
EOF |
1832 |
done |
done |
1833 |
echo |
echo |
1834 |
|
|
1835 |
if test "x${PLATFORM}" = x ; then |
#if test "x${PLATFORM}" = x ; then |
1836 |
PLATFORM=$p_PLATFORM |
# PLATFORM=$p_PLATFORM |
1837 |
fi |
#fi |
1838 |
|
|
1839 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
1840 |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
2709 |
@printf 'running ... ' |
@printf 'running ... ' |
2710 |
@\$(EXECUTABLE) > \$@ |
@\$(EXECUTABLE) > \$@ |
2711 |
|
|
2712 |
|
# remove most of the files that "make" generates |
2713 |
clean: |
clean: |
2714 |
-rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template |
-rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template |
2715 |
-rm -rf *.o |
-rm -rf *.o |
2716 |
-rm -rf *.$FS *.flowdir |
-rm -rf *.$FS *.flowdir |
2717 |
-rm -rf *.f$FS90 \$(AD_CLEAN) ad_input* |
-rm -rf *.f$FS90 \$(AD_CLEAN) ad_input* |
2718 |
|
|
2719 |
|
# remove most of the files that "make" and "make depend" generate |
2720 |
Clean: |
Clean: |
2721 |
@make clean |
@make clean |
2722 |
@make cleanlinks |
@make cleanlinks |
2723 |
-rm -f \$(SPECIAL_FILES) |
-rm -f \$(SPECIAL_FILES) f90mkdepend.log |
|
-rm -f make.log run.log f90mkdepend.log *.bak "$MAKEFILE.old" |
|
2724 |
-rm -f taf_command taf_output taf_ad.log taf_ad_flow.log |
-rm -f taf_command taf_output taf_ad.log taf_ad_flow.log |
2725 |
|
-rm -f genmake_warnings genmake_errors make.log |
2726 |
|
|
2727 |
|
# remove also the executable, files that "genmake2" generates (except Makefile) |
2728 |
|
# and output from a run (plus log files from testreport) |
2729 |
CLEAN: |
CLEAN: |
2730 |
@make Clean |
@make Clean |
2731 |
-rm -f genmake_state genmake_*optfile genmake_warnings genmake_errors |
-rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak $MAKEFILE.old |
2732 |
|
-rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log |
2733 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
2734 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
2735 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
2736 |
-rm -f \$(EXECUTABLE) \$(EXE_AD) *.txt STD* *diagnostics.log datetime |
-rm -f *.txt STD* *diagnostics.log datetime |
2737 |
-rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
-rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
2738 |
-rm -rf mnc_test_* |
-rm -rf mnc_test_* |
2739 |
|
|
|
#eh3 Makefile: makefile |
|
2740 |
makefile: |
makefile: |
2741 |
$THIS_SCRIPT $G2ARGS |
$THIS_SCRIPT $G2ARGS |
2742 |
cleanlinks: |
cleanlinks: |
3252 |
|
|
3253 |
|
|
3254 |
# Write the "state" for future records |
# Write the "state" for future records |
3255 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" = xt ; then |
3256 |
printf "" > genmake_state |
printf "" > genmake_state |
3257 |
for i in $gm_state ; do |
for i in $gm_state ; do |
3258 |
t1="t2=\$$i" |
t1="t2=\$$i" |