13 |
test_for_package_in_cpp_options() { |
test_for_package_in_cpp_options() { |
14 |
cpp_options=$1 |
cpp_options=$1 |
15 |
pkg=$2 |
pkg=$2 |
16 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg[ ]" |
17 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg[ ]" |
18 |
test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg[ ]" |
19 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg[ ]" |
20 |
|
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg$" |
21 |
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg$" |
22 |
|
test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg$" |
23 |
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg$" |
24 |
} |
} |
25 |
|
|
26 |
# Search for particular CPP #cmds associated with MPI |
# Search for particular CPP #cmds associated with MPI |
27 |
# usage: test_for_mpi_in_cpp_eeoptions CPP_file |
# usage: test_for_mpi_in_cpp_eeoptions CPP_file |
28 |
test_for_mpi_in_cpp_eeoptions() { |
test_for_mpi_in_cpp_eeoptions() { |
29 |
cpp_options=$1 |
cpp_options=$1 |
30 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI[ ]" |
31 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI[ ]" |
32 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI[ ]" |
33 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI" || exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI[ ]" |
34 |
|
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI$" |
35 |
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI$" |
36 |
|
test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI$" |
37 |
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI$" |
38 |
} |
} |
39 |
|
|
40 |
# Search for particular string in a file. Return 1 if detected, 0 if not |
# Search for particular string in a file. Return 1 if detected, 0 if not |
47 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
48 |
printf "Error: In $file there is an illegal line: " |
printf "Error: In $file there is an illegal line: " |
49 |
grep -i "$strng" $file |
grep -i "$strng" $file |
50 |
return 1 |
exit 99 |
51 |
fi |
fi |
52 |
return 0 |
return 0 |
53 |
} |
} |
130 |
stop |
stop |
131 |
end |
end |
132 |
EOF |
EOF |
133 |
test -f Makefile && mv -f Makefile Makefile.bak |
test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" |
134 |
cat <<EOF >> Makefile |
cat <<EOF >> $MAKEFILE |
|
%.$tfs : %.F |
|
135 |
.SUFFIXES: |
.SUFFIXES: |
136 |
genmake_hello.$tfs: genmake_hello.F |
.SUFFIXES: .$tfs .F |
137 |
$LN genmake_hello.F genmake_hello.$tfs |
.F.$tfs: |
138 |
|
$LN \$< \$@ |
139 |
EOF |
EOF |
140 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
141 |
RETVAL=$? |
RETVAL=$? |
156 |
return |
return |
157 |
fi |
fi |
158 |
fi |
fi |
159 |
rm -f genmake_hello.* Makefile |
rm -f genmake_hello.* $MAKEFILE |
160 |
test -f Makefile && mv -f Makefile.bak Makefile |
test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE |
161 |
|
|
162 |
# If we make it here, use the extensions |
# If we make it here, use the extensions |
163 |
FS=$tfs |
FS=$tfs |
189 |
if test "x${MAKEDEPEND}" = x ; then |
if test "x${MAKEDEPEND}" = x ; then |
190 |
which makedepend > /dev/null 2>&1 |
which makedepend > /dev/null 2>&1 |
191 |
RV0=$? |
RV0=$? |
192 |
|
test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" |
193 |
|
# echo 'MAKEFILE="'$MAKEFILE'"' |
194 |
|
cat <<EOF >> $MAKEFILE |
195 |
|
# THIS IS A TEST MAKEFILE GENERATED BY "genmake2" |
196 |
|
# |
197 |
|
# Some "makedepend" implementations will die if they cannot |
198 |
|
# find a Makefile -- so this file is here to gives them an |
199 |
|
# empty one to find and parse. |
200 |
|
EOF |
201 |
cat <<EOF >> genmake_tc.f |
cat <<EOF >> genmake_tc.f |
202 |
program test |
program test |
203 |
write(*,*) 'test' |
write(*,*) 'test' |
206 |
EOF |
EOF |
207 |
makedepend genmake_tc.f > /dev/null 2>&1 |
makedepend genmake_tc.f > /dev/null 2>&1 |
208 |
RV1=$? |
RV1=$? |
209 |
|
test -f $MAKEFILE && rm -f $MAKEFILE |
210 |
|
test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE |
211 |
if test "x${RV0}${RV1}" = x00 ; then |
if test "x${RV0}${RV1}" = x00 ; then |
212 |
MAKEDEPEND=makedepend |
MAKEDEPEND=makedepend |
213 |
else |
else |
256 |
fi |
fi |
257 |
} |
} |
258 |
|
|
259 |
|
|
260 |
|
build_embed_encode() |
261 |
|
{ |
262 |
|
printf " building the embed-encode utility... " |
263 |
|
if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then |
264 |
|
if test ! -d "$ROOTDIR/tools/embed_encode" ; then |
265 |
|
echo |
266 |
|
echo " Error: can't locate \"$ROOTDIR/tools/embed_encode\"" |
267 |
|
echo |
268 |
|
EMBED_SRC=f |
269 |
|
return 1 |
270 |
|
fi |
271 |
|
clist="cc gcc c89 $CC" |
272 |
|
for ic in $clist ; do |
273 |
|
comm="$ic -o encode_files encode_files.c" |
274 |
|
( cd $ROOTDIR/tools/embed_encode && $comm ) > /dev/null 2>&1 |
275 |
|
RETVAL=$? |
276 |
|
if test "x$RETVAL" = x0 ; then |
277 |
|
echo "OK" |
278 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
279 |
|
return 0 |
280 |
|
fi |
281 |
|
done |
282 |
|
echo |
283 |
|
echo " Error: unable to build $ROOTDIR/embed_encode/encode_files" |
284 |
|
echo " so it has been disabled" |
285 |
|
echo |
286 |
|
EMBED_SRC=f |
287 |
|
return 1 |
288 |
|
fi |
289 |
|
echo "OK" |
290 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
291 |
|
} |
292 |
|
|
293 |
|
|
294 |
# Guess possible config options for this host |
# Guess possible config options for this host |
295 |
find_possible_configs() { |
find_possible_configs() { |
296 |
|
|
364 |
|
|
365 |
#================================================================ |
#================================================================ |
366 |
# look for possible FORTRAN compilers |
# look for possible FORTRAN compilers |
367 |
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 gfortran" |
368 |
p_FC= |
p_FC= |
369 |
for c in $tmp ; do |
for c in $tmp ; do |
370 |
rm -f ./hello.f ./hello |
rm -f ./hello.f ./hello |
396 |
else |
else |
397 |
echo " The possible FORTRAN compilers found in your path are:" |
echo " The possible FORTRAN compilers found in your path are:" |
398 |
echo " "$p_FC |
echo " "$p_FC |
399 |
if test "x$FC" = x ; then |
fi |
400 |
FC=`echo $p_FC | $AWK '{print $1}'` |
|
401 |
echo " Setting FORTRAN compiler to: "$FC |
# Use the first of the compilers found in the current PATH |
402 |
fi |
# that has a correctly-named optfile |
403 |
|
if test "x$OPTFILE" = x -a "x$FC" = x ; then |
404 |
|
for i in $p_FC ; do |
405 |
|
OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
406 |
|
if test -r $OPTFILE ; then |
407 |
|
echo " Setting OPTFILE to: "$OPTFILE |
408 |
|
break |
409 |
|
fi |
410 |
|
done |
411 |
fi |
fi |
412 |
|
|
413 |
if test "x$OPTFILE" = x ; then |
if test "x$OPTFILE" = x ; then |
578 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
579 |
is being used. |
is being used. |
580 |
|
|
581 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time |
582 |
|
Ignore all the "wall clock" routines entirely. This will |
583 |
|
not in any way hurt the model results -- it simply means |
584 |
|
that the code that checks how long the model spends in |
585 |
|
various routines will give junk values. |
586 |
|
|
587 |
|
-ts | --ts |
588 |
|
Produce timing information per timestep |
589 |
|
-papis | --papis |
590 |
|
Produce summary MFlop/s with PAPI per timestep |
591 |
|
-foolad | --foolad |
592 |
|
Fool the AD code generator |
593 |
|
-papi | --papi |
594 |
|
Performance analysis with PAPI |
595 |
|
-hpmt | --hpmt |
596 |
|
Performance analysis with the HPM Toolkit |
597 |
|
|
598 |
|
-gsl | --gsl |
599 |
|
Use GSL to control floating point rounding and precision |
600 |
|
|
601 |
-mpi | --mpi |
-mpi | --mpi |
602 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
603 |
-mpi=PATH | --mpi=PATH |
-mpi=PATH | --mpi=PATH |
604 |
Include MPI header files and link to MPI libraries using MPI_ROOT |
Include MPI header files and link to MPI libraries using MPI_ROOT |
605 |
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 |
606 |
from $PATH/lib and use binaries from $PATH/bin. |
from \$PATH/lib and use binaries from \$PATH/bin. |
607 |
|
|
608 |
|
-es | --es | -embed-source | --embed-source |
609 |
|
Embed a tarball containing the full source code |
610 |
|
(including the Makefile, etc.) used to build the |
611 |
|
executable [off by default] |
612 |
|
|
613 |
-bash NAME |
-bash NAME |
614 |
Explicitly specify the Bourne or BASH shell to use |
Explicitly specify the Bourne or BASH shell to use |
668 |
EOF |
EOF |
669 |
return 1 |
return 1 |
670 |
fi |
fi |
671 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
672 |
subroutine tcall( string ) |
subroutine tcall( string ) |
673 |
character*(*) string |
character*(*) string |
674 |
call tsub( string ) |
call tsub( string ) |
675 |
end |
end |
676 |
EOF |
EOF |
677 |
$FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1 |
$FC $FFLAGS -c genmake_tcomp.$FS >> genmake_warnings 2>&1 |
678 |
RETVAL=$? |
RETVAL=$? |
679 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
680 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
740 |
*curtim = *curtim/1.E6; |
*curtim = *curtim/1.E6; |
741 |
} |
} |
742 |
EOF |
EOF |
743 |
make genmake_tc_1.o >> genmake_tc.log 2>&1 |
make genmake_tc_1.o >> genmake_warnings 2>&1 |
744 |
RET_C=$? |
RET_C=$? |
745 |
cat <<EOF > genmake_tc_2.f |
cat <<EOF > genmake_tc_2.$FS |
746 |
program hello |
program hello |
747 |
Real*8 wtime |
REAL*8 wtime |
748 |
external cloc |
external cloc |
749 |
call cloc(wtime) |
call cloc(wtime) |
750 |
print *," HELLO WORLD", wtime |
print *," HELLO WORLD", wtime |
751 |
end program hello |
end |
752 |
EOF |
EOF |
753 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.f genmake_tc_1.o >> genmake_tc.log 2>&1 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
754 |
RET_F=$? |
RET_F=$? |
755 |
test -x ./genmake_tc && ./genmake_tc >> genmake_tc.log 2>&1 |
test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 |
756 |
RETVAL=$? |
RETVAL=$? |
757 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
758 |
HAVE_CLOC=t |
HAVE_CLOC=t |
762 |
} |
} |
763 |
|
|
764 |
|
|
765 |
|
check_HAVE_SIGREG() { |
766 |
|
get_fortran_c_namemangling |
767 |
|
cat <<EOF > genmake_tc_1.c |
768 |
|
$FC_NAMEMANGLE |
769 |
|
#include <stdlib.h> |
770 |
|
#include <stdio.h> |
771 |
|
#include <signal.h> |
772 |
|
#include <errno.h> |
773 |
|
#include <ucontext.h> |
774 |
|
|
775 |
|
int * ip; |
776 |
|
|
777 |
|
static void killhandler( |
778 |
|
unsigned int sn, siginfo_t si, struct ucontext *sc ) |
779 |
|
{ |
780 |
|
*ip = *ip + 1; |
781 |
|
return; |
782 |
|
} |
783 |
|
|
784 |
|
void FC_NAMEMANGLE(sigreg) (int * aip) |
785 |
|
{ |
786 |
|
struct sigaction s; |
787 |
|
ip = aip; |
788 |
|
s.sa_flags = SA_SIGINFO; |
789 |
|
s.sa_sigaction = (void *)killhandler; |
790 |
|
if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) { |
791 |
|
printf("Sigaction returned error = %d\n", errno); |
792 |
|
exit(0); |
793 |
|
} |
794 |
|
return; |
795 |
|
} |
796 |
|
EOF |
797 |
|
make genmake_tc_1.o >> genmake_warnings 2>&1 |
798 |
|
RET_C=$? |
799 |
|
cat <<EOF > genmake_tc_2.$FS |
800 |
|
program hello |
801 |
|
integer anint |
802 |
|
common /iv/ anint |
803 |
|
external sigreg |
804 |
|
call sigreg(anint) |
805 |
|
end |
806 |
|
EOF |
807 |
|
echo >> genmake_warnings |
808 |
|
echo "running: check_HAVE_SIGREG()" >> genmake_warnings |
809 |
|
cat genmake_tc_2.$FS >> genmake_warnings |
810 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
811 |
|
echo $COMM >> genmake_warnings |
812 |
|
$COMM >> genmake_warnings 2>&1 |
813 |
|
RETVAL=$? |
814 |
|
if test "x$RETVAL" = x0 ; then |
815 |
|
HAVE_SIGREG=t |
816 |
|
DEFINES="$DEFINES -DHAVE_SIGREG" |
817 |
|
fi |
818 |
|
rm -f genmake_tc* |
819 |
|
} |
820 |
|
|
821 |
|
|
822 |
|
check_HAVE_SETRLSTK() { |
823 |
|
get_fortran_c_namemangling |
824 |
|
cat <<EOF > genmake_tc_1.c |
825 |
|
$FC_NAMEMANGLE |
826 |
|
#include <sys/time.h> |
827 |
|
#include <sys/resource.h> |
828 |
|
#include <unistd.h> |
829 |
|
void FC_NAMEMANGLE(setrlstk) () |
830 |
|
{ |
831 |
|
struct rlimit rls; |
832 |
|
rls.rlim_cur = RLIM_INFINITY; |
833 |
|
rls.rlim_max = RLIM_INFINITY; |
834 |
|
setrlimit(RLIMIT_STACK, &rls); |
835 |
|
return; |
836 |
|
} |
837 |
|
EOF |
838 |
|
make genmake_tc_1.o >> genmake_warnings 2>&1 |
839 |
|
RET_C=$? |
840 |
|
cat <<EOF > genmake_tc_2.$FS |
841 |
|
program hello |
842 |
|
external setrlstk |
843 |
|
call setrlstk() |
844 |
|
end |
845 |
|
EOF |
846 |
|
echo >> genmake_warnings |
847 |
|
echo "running: check_HAVE_SETRLSTK()" >> genmake_warnings |
848 |
|
cat genmake_tc_2.$FS >> genmake_warnings |
849 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
850 |
|
echo $COMM >> genmake_warnings |
851 |
|
$COMM >> genmake_warnings 2>&1 |
852 |
|
RETVAL=$? |
853 |
|
if test "x$RETVAL" = x0 ; then |
854 |
|
HAVE_SETRLSTK=t |
855 |
|
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
856 |
|
fi |
857 |
|
rm -f genmake_tc* |
858 |
|
} |
859 |
|
|
860 |
|
|
861 |
|
check_HAVE_STAT() { |
862 |
|
get_fortran_c_namemangling |
863 |
|
cat <<EOF > genmake_tc_1.c |
864 |
|
$FC_NAMEMANGLE |
865 |
|
#include <stdio.h> |
866 |
|
#include <stdlib.h> |
867 |
|
#include <unistd.h> |
868 |
|
#include <sys/stat.h> |
869 |
|
#include <sys/types.h> |
870 |
|
void FC_NAMEMANGLE(tfsize) ( int *nbyte ) |
871 |
|
{ |
872 |
|
char name[512]; |
873 |
|
struct stat astat; |
874 |
|
|
875 |
|
name[0] = 'a'; name[1] = '\0'; |
876 |
|
if (! stat(name, &astat)) |
877 |
|
*nbyte = (int)(astat.st_size); |
878 |
|
else |
879 |
|
*nbyte = -1; |
880 |
|
} |
881 |
|
EOF |
882 |
|
make genmake_tc_1.o >> genmake_tc.log 2>&1 |
883 |
|
RET_C=$? |
884 |
|
cat <<EOF > genmake_tc_2.$FS |
885 |
|
program hello |
886 |
|
integer nbyte |
887 |
|
call tfsize(nbyte) |
888 |
|
print *," HELLO WORLD", nbyte |
889 |
|
end |
890 |
|
EOF |
891 |
|
echo >> genmake_warnings |
892 |
|
echo "running: check_HAVE_STAT()" >> genmake_warnings |
893 |
|
cat genmake_tc_2.$FS >> genmake_warnings |
894 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
895 |
|
echo $COMM >> genmake_warnings |
896 |
|
$COMM >> genmake_tc.log 2>&1 |
897 |
|
RETVAL=$? |
898 |
|
if test "x$RETVAL" = x0 ; then |
899 |
|
HAVE_STAT=t |
900 |
|
DEFINES="$DEFINES -DHAVE_STAT" |
901 |
|
fi |
902 |
|
rm -f genmake_tc* |
903 |
|
} |
904 |
|
|
905 |
|
|
906 |
check_netcdf_libs() { |
check_netcdf_libs() { |
907 |
echo "" > genmake_tnc.log |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
908 |
cat <<EOF > genmake_tnc.for |
return |
909 |
|
fi |
910 |
|
echo >> genmake_warnings |
911 |
|
echo "running: check_netcdf_libs()" >> genmake_warnings |
912 |
|
cat <<EOF > genmake_tnc.F |
913 |
program fgennc |
program fgennc |
914 |
#include "netcdf.inc" |
#include "netcdf.inc" |
915 |
|
EOF |
916 |
|
if test ! "x$MPI" = x ; then |
917 |
|
echo '#include "mpif.h"' >> genmake_tnc.F |
918 |
|
fi |
919 |
|
cat <<EOF >> genmake_tnc.F |
920 |
integer iret, ncid, xid |
integer iret, ncid, xid |
921 |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
922 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
926 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
927 |
end |
end |
928 |
EOF |
EOF |
929 |
#echo "$CPP $DEFINES $INCLUDES" |
echo "=== genmake_tnc.F ===" > genmake_tnc.log |
930 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
cat genmake_tnc.F >> genmake_tnc.log |
931 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
echo "=== genmake_tnc.F ===" >> genmake_tnc.log |
932 |
|
RET_CPP=f |
933 |
|
COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F" |
934 |
|
echo "$COMM" >> genmake_tnc.log |
935 |
|
$COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t |
936 |
|
if test "x$RET_CPP" = xf ; then |
937 |
|
echo " WARNING: CPP failed to pre-process the netcdf test." \ |
938 |
|
>> genmake_tnc.log |
939 |
|
echo " Please check that \$INCLUDES is properly set." \ |
940 |
|
>> genmake_tnc.log |
941 |
|
fi |
942 |
|
echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
943 |
|
echo " && $LINK -o genmake_tnc.o $LIBS" >> genmake_tnc.log |
944 |
|
$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
945 |
|
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
946 |
RET_COMPILE=$? |
RET_COMPILE=$? |
947 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
cat genmake_tnc.log >> genmake_warnings |
948 |
RETVAL=$? |
|
949 |
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
#EH3 Remove test program execution for machines that either disallow |
950 |
|
#EH3 execution or cannot support it (eg. cross-compilers) |
951 |
|
#EH3 |
952 |
|
#EH3 test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
953 |
|
#EH3 RETVAL=$? |
954 |
|
#EH3 if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
955 |
|
|
956 |
|
if test "x$RET_COMPILE" = x0 ; then |
957 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
958 |
else |
else |
959 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
960 |
$CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null \ |
echo "try again with added '-lnetcdf'" > genmake_tnc.log |
961 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
echo "$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS \ " >> genmake_tnc.log |
962 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
963 |
|
echo " && $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log |
964 |
|
$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ |
965 |
|
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
966 |
|
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
967 |
RET_COMPILE=$? |
RET_COMPILE=$? |
968 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
cat genmake_tnc.log >> genmake_warnings |
969 |
RETVAL=$? |
if test "x$RET_COMPILE" = x0 ; then |
|
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
|
970 |
LIBS="$LIBS -lnetcdf" |
LIBS="$LIBS -lnetcdf" |
971 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
|
else |
|
|
cat genmake_tnc.log >> genmake_warnings |
|
972 |
fi |
fi |
973 |
fi |
fi |
974 |
rm -f genmake_tnc* |
rm -f genmake_tnc* |
987 |
LN= |
LN= |
988 |
S64= |
S64= |
989 |
KPP= |
KPP= |
990 |
FC= |
#FC= |
991 |
#CC=gcc |
#CC=gcc |
992 |
CPP= |
#CPP= |
993 |
LINK= |
LINK= |
994 |
DEFINES= |
DEFINES= |
995 |
PACKAGES= |
PACKAGES= |
996 |
ENABLE= |
ENABLE= |
997 |
DISABLE= |
DISABLE= |
998 |
MAKEFILE= |
# MAKEFILE= |
999 |
#MAKEDEPEND= |
# MAKEDEPEND= |
1000 |
PDEPEND= |
PDEPEND= |
1001 |
DUMPSTATE=t |
DUMPSTATE=t |
1002 |
PDEFAULT= |
PDEFAULT= |
1003 |
OPTFILE= |
OPTFILE= |
1004 |
INCLUDES="-I." |
INCLUDES="-I. $INCLUDES" |
1005 |
FFLAGS= |
FFLAGS= |
1006 |
FOPTIM= |
FOPTIM= |
1007 |
CFLAGS= |
CFLAGS= |
1014 |
NOOPTFLAGS= |
NOOPTFLAGS= |
1015 |
MPI= |
MPI= |
1016 |
MPIPATH= |
MPIPATH= |
1017 |
|
TS= |
1018 |
|
PAPIS= |
1019 |
|
FOOLAD= |
1020 |
|
PAPI= |
1021 |
|
HPMT= |
1022 |
|
GSL= |
1023 |
|
HAVE_TEST_L= |
1024 |
|
|
1025 |
# DEFINES checked by test compilation |
# DEFINES checked by test compilation or command-line |
1026 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
1027 |
HAVE_FDATE= |
HAVE_FDATE= |
1028 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
1029 |
HAVE_CLOC= |
HAVE_CLOC= |
1030 |
|
HAVE_SETRLSTK= |
1031 |
|
HAVE_STAT= |
1032 |
HAVE_NETCDF= |
HAVE_NETCDF= |
1033 |
HAVE_ETIME= |
HAVE_ETIME= |
1034 |
|
IGNORE_TIME= |
1035 |
|
|
1036 |
MODS= |
MODS= |
1037 |
TOOLSDIR= |
TOOLSDIR= |
1042 |
G2ARGS= |
G2ARGS= |
1043 |
BASH= |
BASH= |
1044 |
PWD=`pwd` |
PWD=`pwd` |
1045 |
MAKE=make |
test "x$MAKE" = x && MAKE=make |
1046 |
AWK=awk |
test "x$AWK" = x && AWK=awk |
1047 |
THISHOSTNAME=`hostname` |
EMBED_SRC= |
1048 |
|
THISHOST=`hostname` |
1049 |
THISCWD=`pwd` |
THISCWD=`pwd` |
1050 |
THISDATE=`date` |
THISDATE=`date` |
1051 |
|
THISUSER=`echo $USER` |
1052 |
|
THISVER= |
1053 |
MACHINE=`uname -a` |
MACHINE=`uname -a` |
1054 |
EXECUTABLE= |
EXECUTABLE= |
1055 |
EXEHOOK= |
EXEHOOK= |
1078 |
|
|
1079 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
1080 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
1081 |
gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
gm_s2="FC CPP IEEE TS PAPIS PAPI HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS" |
1082 |
|
|
1083 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
1084 |
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 " |
1085 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
1086 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE" |
1087 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
1088 |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
1089 |
|
|
1124 |
echo "none found" |
echo "none found" |
1125 |
fi |
fi |
1126 |
|
|
1127 |
# echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
#echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
1128 |
#OPTIONS= |
#OPTIONS= |
1129 |
#n=0 |
#n=0 |
1130 |
#for i ; do |
#for i ; do |
1136 |
#done |
#done |
1137 |
#parse_options |
#parse_options |
1138 |
ac_prev= |
ac_prev= |
1139 |
for ac_option in $@ ; do |
for ac_option in "$@" ; do |
1140 |
|
|
1141 |
G2ARGS="$G2ARGS \"$ac_option\"" |
G2ARGS="$G2ARGS \"$ac_option\"" |
1142 |
|
|
1258 |
-noieee | --noieee) |
-noieee | --noieee) |
1259 |
IEEE= ;; |
IEEE= ;; |
1260 |
|
|
1261 |
|
-ts | --ts) |
1262 |
|
TS=true ;; |
1263 |
|
-papis | --papis) |
1264 |
|
PAPIS=true ;; |
1265 |
|
-foolad | --foolad) |
1266 |
|
FOOLAD=true ;; |
1267 |
|
-papi | --papi) |
1268 |
|
PAPI=true ;; |
1269 |
|
-hpmt | --hpmt) |
1270 |
|
HPMT=true ;; |
1271 |
|
|
1272 |
|
-gsl | --gsl) |
1273 |
|
GSL=true ;; |
1274 |
|
|
1275 |
-mpi | --mpi) |
-mpi | --mpi) |
1276 |
MPI=true ;; |
MPI=true ;; |
1277 |
-mpi=* | --mpi=*) |
-mpi=* | --mpi=*) |
1295 |
ac_prev=TAMC_EXTRA ;; |
ac_prev=TAMC_EXTRA ;; |
1296 |
-tamc_extra=* | --tamc_extra=*) |
-tamc_extra=* | --tamc_extra=*) |
1297 |
TAMC_EXTRA=$ac_optarg ;; |
TAMC_EXTRA=$ac_optarg ;; |
1298 |
|
|
1299 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
1300 |
|
IGNORE_TIME="-DIGNORE_TIME" ;; |
1301 |
|
|
1302 |
|
-es | --es | -embed-source | --embed-source) |
1303 |
|
EMBED_SRC=t ;; |
1304 |
|
|
1305 |
-*) |
-*) |
1306 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
1316 |
|
|
1317 |
done |
done |
1318 |
|
|
1319 |
|
|
1320 |
if test -f ./.genmakerc ; then |
if test -f ./.genmakerc ; then |
1321 |
echo |
echo |
1322 |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
1329 |
echo |
echo |
1330 |
fi |
fi |
1331 |
|
|
1332 |
|
# Find the MITgcm ${ROOTDIR} |
1333 |
if test "x${ROOTDIR}" = x ; then |
if test "x${ROOTDIR}" = x ; then |
1334 |
tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'` |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
1335 |
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 |
1336 |
ROOTDIR=".." |
ROOTDIR=".." |
1337 |
else |
else |
1356 |
exit 1 |
exit 1 |
1357 |
fi |
fi |
1358 |
|
|
1359 |
|
# Find the MITgcm ${THISVER} |
1360 |
|
if test -f "${ROOTDIR}/doc/tag-index" ; then |
1361 |
|
THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1` |
1362 |
|
fi |
1363 |
|
|
1364 |
|
if test "x$MAKEFILE" = x ; then |
1365 |
|
MAKEFILE="Makefile" |
1366 |
|
fi |
1367 |
|
|
1368 |
echo " getting OPTFILE information: " |
echo " getting OPTFILE information: " |
1369 |
if test "x${OPTFILE}" = x ; then |
if test "x${OPTFILE}" = x ; then |
1370 |
if test "x$MITGCM_OF" = x ; then |
if test "x$MITGCM_OF" = x ; then |
1394 |
fi |
fi |
1395 |
fi |
fi |
1396 |
|
|
|
# Check for broken systems that cannot correctly distinguish *.F and *.f files |
|
|
# check_for_broken_Ff |
|
|
|
|
1397 |
echo " getting AD_OPTFILE information: " |
echo " getting AD_OPTFILE information: " |
1398 |
if test "x${AD_OPTFILE}" = x ; then |
if test "x${AD_OPTFILE}" = x ; then |
1399 |
if test "x$MITGCM_AD_OF" = x ; then |
if test "x$MITGCM_AD_OF" = x ; then |
1421 |
fi |
fi |
1422 |
fi |
fi |
1423 |
|
|
1424 |
|
#==================================================================== |
1425 |
|
# Set default values if not set by the optfile |
1426 |
|
# |
1427 |
# 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, |
1428 |
# either set defaults or complain and abort! |
# either set defaults or complain and abort! |
1429 |
if test ! "x$BASH" = x ; then |
if test ! "x$BASH" = x ; then |
1500 |
EOF |
EOF |
1501 |
exit 1 |
exit 1 |
1502 |
fi |
fi |
1503 |
|
test -L genmake_tlink > /dev/null 2>&1 |
1504 |
|
RETVAL=$? |
1505 |
|
if test "x$RETVAL" = x0 ; then |
1506 |
|
HAVE_TEST_L=t |
1507 |
|
fi |
1508 |
rm -f genmake_test_ln genmake_tlink |
rm -f genmake_test_ln genmake_tlink |
1509 |
|
|
1510 |
# Check for broken *.F/*.f handling and fix if possible |
# Check for broken *.F/*.f handling and fix if possible |
1515 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
1516 |
fi |
fi |
1517 |
|
|
1518 |
|
if test ! "x$TS" = x ; then |
1519 |
|
echo " Turning on timing per timestep" |
1520 |
|
if test ! "x$FOOLAD" = x ; then |
1521 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP" |
1522 |
|
else |
1523 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP" |
1524 |
|
fi |
1525 |
|
fi |
1526 |
|
if test ! "x$PAPIS" = x ; then |
1527 |
|
echo " Turning on PAPI flop summary per timestep" |
1528 |
|
echo " Please make sure PAPIINC, PAPILIB are defined" |
1529 |
|
if test ! "x$FOOLAD" = x ; then |
1530 |
|
DEFINES="$DEFINES -DUSE_PAPI_FLOPS_SFP" |
1531 |
|
else |
1532 |
|
DEFINES="$DEFINES -DUSE_PAPI_FLOPS" |
1533 |
|
fi |
1534 |
|
INCLUDES="$INCLUDES $PAPIINC" |
1535 |
|
LIBS="$LIBS $PAPILIB" |
1536 |
|
fi |
1537 |
|
if test ! "x$PAPI" = x ; then |
1538 |
|
if test ! "x$PAPIS" = x ; then |
1539 |
|
echo " PAPI performance analysis and flop summary per timestep cannot co-exist!" |
1540 |
|
echo " Sticking with PAPI flop summary per timestep!" |
1541 |
|
else |
1542 |
|
echo " Turning on performance analysis with PAPI" |
1543 |
|
echo " Please make sure PAPIINC, PAPILIB are defined" |
1544 |
|
DEFINES="$DEFINES -DUSE_PAPI" |
1545 |
|
INCLUDES="$INCLUDES $PAPIINC" |
1546 |
|
LIBS="$LIBS $PAPILIB" |
1547 |
|
fi |
1548 |
|
fi |
1549 |
|
if test ! "x$HPMT" = x ; then |
1550 |
|
if test ! "x$PAPI" = x ; then |
1551 |
|
echo " PAPI and the HPM Toolkit cannot co-exist!" |
1552 |
|
echo " Sticking with PAPI!" |
1553 |
|
else |
1554 |
|
echo " Turning on performance analysis with the HPM Toolkit" |
1555 |
|
echo " Please make sure HPMTINC, HPMTLIB are defined" |
1556 |
|
DEFINES="$DEFINES -DUSE_LIBHPM" |
1557 |
|
INCLUDES="$INCLUDES $HPMTINC" |
1558 |
|
LIBS="$LIBS $HPMTLIB" |
1559 |
|
fi |
1560 |
|
fi |
1561 |
|
if test ! "x$GSL" = x ; then |
1562 |
|
echo " Turning on use of GSL to control floating point calculations" |
1563 |
|
echo " Please make sure GSLINC, GSLLIB are defined" |
1564 |
|
DEFINES="$DEFINES -DUSE_GSL_IEEE" |
1565 |
|
INCLUDES="$INCLUDES $GSLINC" |
1566 |
|
LIBS="$LIBS $GSLLIB" |
1567 |
|
fi |
1568 |
|
|
1569 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
1570 |
printf " Do we have the system() command using $FC... " |
printf " Do we have the system() command using $FC... " |
1571 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1572 |
program hello |
program hello |
1573 |
call system('echo hi') |
call system('echo hi') |
1574 |
end |
end |
1575 |
EOF |
EOF |
1576 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
$FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1577 |
RETVAL=$? |
RETVAL=$? |
1578 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1579 |
HAVE_SYSTEM=t |
HAVE_SYSTEM=t |
1586 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1587 |
|
|
1588 |
printf " Do we have the fdate() command using $FC... " |
printf " Do we have the fdate() command using $FC... " |
1589 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1590 |
program hello |
program hello |
1591 |
CHARACTER(128) string |
CHARACTER*(128) string |
1592 |
string = ' ' |
string = ' ' |
1593 |
call fdate( string ) |
call fdate( string ) |
1594 |
print *, string |
print *, string |
1595 |
end |
end |
1596 |
EOF |
EOF |
1597 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
$FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1598 |
RETVAL=$? |
RETVAL=$? |
1599 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1600 |
HAVE_FDATE=t |
HAVE_FDATE=t |
1607 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1608 |
|
|
1609 |
printf " Do we have the etime() command using $FC... " |
printf " Do we have the etime() command using $FC... " |
1610 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1611 |
program hello |
program hello |
1612 |
REAL*4 ACTUAL, TARRAY(2) |
REAL*4 ACTUAL, TARRAY(2) |
1613 |
EXTERNAL ETIME |
EXTERNAL ETIME |
1616 |
print *, tarray |
print *, tarray |
1617 |
end |
end |
1618 |
EOF |
EOF |
1619 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
$FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1620 |
RETVAL=$? |
RETVAL=$? |
1621 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1622 |
HAVE_ETIME=t |
HAVE_ETIME=t |
1634 |
echo "yes" |
echo "yes" |
1635 |
else |
else |
1636 |
echo "no" |
echo "no" |
1637 |
|
if test "x$EMBED_SRC" = xt ; then |
1638 |
|
echo " WARNING: you requested file embedding but it has" |
1639 |
|
echo " been disabled since C code cannot be called" |
1640 |
|
EMBED_SRC= |
1641 |
|
fi |
1642 |
|
fi |
1643 |
|
rm -f genmake_t* |
1644 |
|
|
1645 |
|
printf " Can we unlimit the stack size using $FC... " |
1646 |
|
check_HAVE_SETRLSTK |
1647 |
|
if test "x$HAVE_SETRLSTK" != x ; then |
1648 |
|
echo "yes" |
1649 |
|
else |
1650 |
|
echo "no" |
1651 |
|
fi |
1652 |
|
rm -f genmake_t* |
1653 |
|
|
1654 |
|
printf " Can we register a signal handler using $FC... " |
1655 |
|
check_HAVE_SIGREG |
1656 |
|
if test "x$HAVE_SIGREG" != x ; then |
1657 |
|
echo "yes" |
1658 |
|
else |
1659 |
|
echo "no" |
1660 |
|
fi |
1661 |
|
rm -f genmake_t* |
1662 |
|
|
1663 |
|
printf " Can we use stat() through C calls... " |
1664 |
|
check_HAVE_STAT |
1665 |
|
if test "x$HAVE_STAT" != x ; then |
1666 |
|
echo "yes" |
1667 |
|
else |
1668 |
|
echo "no" |
1669 |
fi |
fi |
1670 |
rm -f genmake_t* |
rm -f genmake_t* |
1671 |
|
|
1676 |
else |
else |
1677 |
echo "no" |
echo "no" |
1678 |
fi |
fi |
1679 |
|
DEFINES="$DEFINES $IGNORE_TIME" |
1680 |
|
|
1681 |
|
if test "x$EMBED_SRC" = xt ; then |
1682 |
|
build_embed_encode |
1683 |
|
fi |
1684 |
|
if test "x$EMBED_SRC" = xt ; then |
1685 |
|
ENABLE="$ENABLE embed_files" |
1686 |
|
fi |
1687 |
|
|
1688 |
|
|
1689 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1701 |
done |
done |
1702 |
echo |
echo |
1703 |
|
|
|
if test "x$MAKEFILE" = x ; then |
|
|
MAKEFILE="Makefile" |
|
|
fi |
|
1704 |
if test "x${PLATFORM}" = x ; then |
if test "x${PLATFORM}" = x ; then |
1705 |
PLATFORM=$p_PLATFORM |
PLATFORM=$p_PLATFORM |
1706 |
fi |
fi |
1707 |
|
|
1708 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
1709 |
tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'` |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
1710 |
if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then |
if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then |
1711 |
EXEDIR=../exe |
EXEDIR=../exe |
1712 |
else |
else |
1726 |
exit 1 |
exit 1 |
1727 |
fi |
fi |
1728 |
if test "x$S64" = x ; then |
if test "x$S64" = x ; then |
1729 |
S64='$(TOOLSDIR)/set64bitConst.sh' |
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.sh > /dev/null 2>&1 |
1730 |
|
RETVAL=$? |
1731 |
|
if test "x${RETVAL}" = x0 ; then |
1732 |
|
S64='$(TOOLSDIR)/set64bitConst.sh' |
1733 |
|
else |
1734 |
|
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.csh > /dev/null 2>&1 |
1735 |
|
RETVAL=$? |
1736 |
|
if test "x${RETVAL}" = x0 ; then |
1737 |
|
S64='$(TOOLSDIR)/set64bitConst.csh' |
1738 |
|
else |
1739 |
|
cat <<EOF |
1740 |
|
|
1741 |
|
ERROR: neither of the two default scripts: |
1742 |
|
|
1743 |
|
${TOOLSDIR}/set64bitConst.sh |
1744 |
|
${TOOLSDIR}/set64bitConst.csh |
1745 |
|
|
1746 |
|
are working so please check paths or specify (with \$S64) a |
1747 |
|
working version of this script. |
1748 |
|
|
1749 |
|
EOF |
1750 |
|
exit 1 |
1751 |
|
fi |
1752 |
|
fi |
1753 |
fi |
fi |
1754 |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
1755 |
|
|
1894 |
rm -f ./.tmp_pack |
rm -f ./.tmp_pack |
1895 |
echo " packages are: $PACKAGES" |
echo " packages are: $PACKAGES" |
1896 |
|
|
1897 |
|
# Check availability of NetCDF and then either build the MNC template |
1898 |
|
# files or delete mnc from the list of available packages. |
1899 |
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
1900 |
|
RETVAL=$? |
1901 |
|
if test "x$RETVAL" = x0 ; then |
1902 |
|
if test "x$HAVE_NETCDF" != xt ; then |
1903 |
|
cat <<EOF |
1904 |
|
|
1905 |
|
********************************************************************* |
1906 |
|
WARNING: the "mnc" package was enabled but tests failed to compile |
1907 |
|
NetCDF applications. Please check that: |
1908 |
|
|
1909 |
|
1) NetCDF is correctly installed for this compiler and |
1910 |
|
2) the LIBS variable (within the "optfile") specifies the correct |
1911 |
|
NetCDF library to link against. |
1912 |
|
|
1913 |
|
Due to this failure, the "mnc" package is now DISABLED. |
1914 |
|
********************************************************************* |
1915 |
|
|
1916 |
|
EOF |
1917 |
|
PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'` |
1918 |
|
DISABLE="$DISABLE mnc" |
1919 |
|
else |
1920 |
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1 |
1921 |
|
RETVAL=$? |
1922 |
|
if test "x${RETVAL}" = x0 ; then |
1923 |
|
rm -f make_mnc.errors |
1924 |
|
else |
1925 |
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
1926 |
|
cat make_mnc.errors 1>&2 |
1927 |
|
exit 1 |
1928 |
|
fi |
1929 |
|
fi |
1930 |
|
fi |
1931 |
|
|
1932 |
echo " applying package dependency rules" |
echo " applying package dependency rules" |
1933 |
ck= |
ck= |
1934 |
while test "x$ck" != xtt ; do |
while test "x$ck" != xtt ; do |
2013 |
fi |
fi |
2014 |
done |
done |
2015 |
|
|
|
# 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 |
|
|
|
|
2016 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
2017 |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
2018 |
# 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 |
2032 |
fi |
fi |
2033 |
done |
done |
2034 |
if test "x$has_pack" = xf ; then |
if test "x$has_pack" = xf ; then |
2035 |
undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'` |
undef=`echo "ALLOW_$n" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` |
2036 |
DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef" |
DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef" |
2037 |
fi |
fi |
2038 |
fi |
fi |
2039 |
done |
done |
2040 |
ENABLED_PACKAGES= |
ENABLED_PACKAGES= |
2041 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
2042 |
def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'` |
def=`echo "ALLOW_$i" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` |
2043 |
ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def" |
ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def" |
2044 |
#eh3 DEFINES="$DEFINES -D$def" |
#eh3 DEFINES="$DEFINES -D$def" |
2045 |
|
|
2123 |
cat $i/$j >> ad_files |
cat $i/$j >> ad_files |
2124 |
done |
done |
2125 |
done |
done |
2126 |
|
if test ! "x"$FS = "x.f" ; then |
2127 |
|
cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f |
2128 |
|
mv -f ad_files_f ad_files |
2129 |
|
fi |
2130 |
|
|
2131 |
echo |
echo |
2132 |
echo "=== Creating the Makefile ===" |
echo "=== Creating the Makefile ===" |
2137 |
fi |
fi |
2138 |
done |
done |
2139 |
|
|
2140 |
|
if test ! "x$DIVA" = x ; then |
2141 |
|
echo " Creating the pseudo-MPI include directory" |
2142 |
|
INCLUDES="-I./mpi_headers $INCLUDES" |
2143 |
|
rm -rf ./mpi_headers |
2144 |
|
mkdir -p ./mpi_headers |
2145 |
|
|
2146 |
|
if test "x$MPIINCLUDEDIR" = x ; then |
2147 |
|
if test "x$MPIHOME" = x ; then |
2148 |
|
MPIHOME='/usr' |
2149 |
|
fi |
2150 |
|
MPIINCLUDEDIR='$MPIHOME/include' |
2151 |
|
fi |
2152 |
|
|
2153 |
|
if test -r $MPIINCLUDEDIR/mpif.h ; then |
2154 |
|
for i in $MPI_HEADER_FILES; do |
2155 |
|
cp -p $MPIINCLUDEDIR/$i ./mpi_headers |
2156 |
|
done |
2157 |
|
|
2158 |
|
perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h |
2159 |
|
else |
2160 |
|
echo " We cannot create a copy of mpif.h!" |
2161 |
|
exit -1 |
2162 |
|
fi |
2163 |
|
fi |
2164 |
|
|
2165 |
echo " Determining the list of source and include files" |
echo " Determining the list of source and include files" |
2166 |
rm -rf .links.tmp |
rm -rf .links.tmp |
2167 |
mkdir .links.tmp |
mkdir .links.tmp |
2168 |
|
touch .links.tmp/foo |
2169 |
|
if test ! -r ".links.tmp/foo" ; then |
2170 |
|
echo |
2171 |
|
echo "ERROR : something is wrong with your directory permissions or" |
2172 |
|
echo " your user file-creation mask (\"umask\") since creating a" |
2173 |
|
echo " sub-dir, touch-ing a file within it, and then reading it is" |
2174 |
|
echo " not working. Please try setting your umask to something" |
2175 |
|
echo " sane such as:" |
2176 |
|
echo |
2177 |
|
echo " umask 0002" |
2178 |
|
echo |
2179 |
|
echo " and please verify that you have the proper permissions for" |
2180 |
|
echo " creating sub-directories and then reading files created" |
2181 |
|
echo " within them." |
2182 |
|
echo |
2183 |
|
exit 1 |
2184 |
|
fi |
2185 |
|
rm -f .links.tmp/foo |
2186 |
echo "# This section creates symbolic links" > srclinks.tmp |
echo "# This section creates symbolic links" > srclinks.tmp |
2187 |
echo "" >> srclinks.tmp |
echo "" >> srclinks.tmp |
2188 |
printf 'SRCFILES = ' > srclist.inc |
printf 'SRCFILES = ' > srclist.inc |
2198 |
for sf in $sfiles ; do |
for sf in $sfiles ; do |
2199 |
if test ! -r ".links.tmp/$sf" ; then |
if test ! -r ".links.tmp/$sf" ; then |
2200 |
if test -f "$d/$sf" ; then |
if test -f "$d/$sf" ; then |
2201 |
|
ignore_f=f |
2202 |
case $d/$sf in |
case $d/$sf in |
2203 |
./$PACKAGES_DOT_H) |
./$PACKAGES_DOT_H) |
2204 |
|
ignore_f=t |
2205 |
;; |
;; |
2206 |
./AD_CONFIG.h) |
./AD_CONFIG.h) |
2207 |
|
ignore_f=t |
2208 |
;; |
;; |
2209 |
./FC_NAMEMANGLE.h) |
./FC_NAMEMANGLE.h) |
2210 |
|
ignore_f=t |
2211 |
;; |
;; |
2212 |
*) |
./BUILD_INFO.h) |
2213 |
touch .links.tmp/$sf |
ignore_f=t |
|
deplist="$deplist $sf" |
|
|
;; |
|
|
esac |
|
|
extn=`echo $sf | $AWK -F '.' '{print $NF}'` |
|
|
case $extn in |
|
|
F) |
|
|
echo " \\" >> srclist.inc |
|
|
printf " $sf" >> srclist.inc |
|
|
;; |
|
|
F90) |
|
|
echo " \\" >> f90srclist.inc |
|
|
printf " $sf" >> f90srclist.inc |
|
|
;; |
|
|
c) |
|
|
echo " \\" >> csrclist.inc |
|
|
printf " $sf" >> csrclist.inc |
|
2214 |
;; |
;; |
2215 |
h) |
./EMBEDDED_FILES.h) |
2216 |
echo " \\" >> hlist.inc |
ignore_f=t |
|
printf " $sf" >> hlist.inc |
|
2217 |
;; |
;; |
2218 |
flow) |
*) |
2219 |
echo " \\" >> ad_flow_files.inc |
# For the local directory *ONLY*, |
2220 |
printf " $sf" >> ad_flow_files.inc |
# ignore all soft-links |
2221 |
|
if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then |
2222 |
|
ignore_f=t |
2223 |
|
else |
2224 |
|
touch .links.tmp/$sf |
2225 |
|
deplist="$deplist $sf" |
2226 |
|
fi |
2227 |
;; |
;; |
2228 |
esac |
esac |
2229 |
|
if test "x$ignore_f" = xf ; then |
2230 |
|
extn=`echo $sf | $AWK -F. '{print $NF}'` |
2231 |
|
case $extn in |
2232 |
|
F) |
2233 |
|
echo " \\" >> srclist.inc |
2234 |
|
printf " $sf" >> srclist.inc |
2235 |
|
;; |
2236 |
|
F90) |
2237 |
|
echo " \\" >> f90srclist.inc |
2238 |
|
printf " $sf" >> f90srclist.inc |
2239 |
|
;; |
2240 |
|
c) |
2241 |
|
echo " \\" >> csrclist.inc |
2242 |
|
printf " $sf" >> csrclist.inc |
2243 |
|
;; |
2244 |
|
h) |
2245 |
|
echo " \\" >> hlist.inc |
2246 |
|
printf " $sf" >> hlist.inc |
2247 |
|
;; |
2248 |
|
flow) |
2249 |
|
echo " \\" >> ad_flow_files.inc |
2250 |
|
printf " $sf" >> ad_flow_files.inc |
2251 |
|
;; |
2252 |
|
esac |
2253 |
|
fi |
2254 |
fi |
fi |
2255 |
fi |
fi |
2256 |
done |
done |
2279 |
echo "# by the command:" >> $MAKEFILE |
echo "# by the command:" >> $MAKEFILE |
2280 |
echo "# $0 $G2ARGS" >> $MAKEFILE |
echo "# $0 $G2ARGS" >> $MAKEFILE |
2281 |
echo "# executed by:" >> $MAKEFILE |
echo "# executed by:" >> $MAKEFILE |
2282 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
echo "# ${THISUSER}@${THISHOST}:${THISCWD}" >> $MAKEFILE |
2283 |
|
|
2284 |
EXE_AD=$EXECUTABLE"_ad" |
EXE_AD=$EXECUTABLE"_ad" |
2285 |
EXE_FTL=$EXECUTABLE"_ftl" |
EXE_FTL=$EXECUTABLE"_ftl" |
2325 |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
2326 |
|
|
2327 |
# These files are created by Makefile |
# These files are created by Makefile |
2328 |
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 |
|
|
|
2329 |
EOF |
EOF |
2330 |
|
|
2331 |
# Note: figure out some way to add Hyades JAM libraries here |
if test "x$EMBED_SRC" = xt ; then |
2332 |
|
echo "EMBEDDED_FILES = EMBEDDED_FILES.h" >>$MAKEFILE |
2333 |
|
else |
2334 |
|
echo "EMBEDDED_FILES = " >>$MAKEFILE |
2335 |
|
fi |
2336 |
|
|
2337 |
|
# Note: figure out some way to add Hyades JAM libraries here |
2338 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2339 |
# Unix ln (link) |
# Unix ln (link) |
2340 |
LN = ${LN} |
LN = ${LN} |
2372 |
NOOPTFILES = ${NOOPTFILES} |
NOOPTFILES = ${NOOPTFILES} |
2373 |
NOOPTFLAGS = ${NOOPTFLAGS} |
NOOPTFLAGS = ${NOOPTFLAGS} |
2374 |
# Flags and libraries needed for linking |
# Flags and libraries needed for linking |
2375 |
LIBS = ${LIBS} \$(XLIBS) |
LIBS = ${LIBS} |
2376 |
# Name of the Mekfile |
# Name of the Mekfile |
2377 |
MAKEFILE=${MAKEFILE} |
MAKEFILE=${MAKEFILE} |
2378 |
|
|
2385 |
cat ad_flow_files.inc >> $MAKEFILE |
cat ad_flow_files.inc >> $MAKEFILE |
2386 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2387 |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
2388 |
echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE |
echo 'F90FILES = $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE |
2389 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
2390 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2391 |
echo '.SUFFIXES:' >> $MAKEFILE |
echo '.SUFFIXES:' >> $MAKEFILE |
2396 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2397 |
|
|
2398 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
2399 |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) \$(EMBEDDED_FILES) |
2400 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2401 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
2402 |
depend: |
depend: |
2405 |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
2406 |
-rm -f makedepend.out |
-rm -f makedepend.out |
2407 |
|
|
2408 |
|
lib: libmitgcmuv.a |
2409 |
|
|
2410 |
|
libmitgcmuv.a: \$(OBJFILES) |
2411 |
|
ar rcv libmitgcmuv.a \$(OBJFILES) |
2412 |
|
|
2413 |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) |
2414 |
|
|
2415 |
small_f: \$(F77FILES) \$(F90FILES) |
small_f: \$(F77FILES) \$(F90FILES) |
2430 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
2431 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
2432 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
2433 |
-rm -f \$(EXECUTABLE) output.txt STD* |
-rm -f \$(EXECUTABLE) *.txt STD* *diagnostics.log datetime |
2434 |
|
-rm -rf mnc_test_* |
2435 |
|
|
2436 |
#eh3 Makefile: makefile |
#eh3 Makefile: makefile |
2437 |
makefile: |
makefile: |
2439 |
cleanlinks: |
cleanlinks: |
2440 |
-find . -type l -exec rm {} \; |
-find . -type l -exec rm {} \; |
2441 |
|
|
2442 |
# Special targets ($SPECIAL_FILES) which are create by make |
# Special targets (SPECIAL_FILES) which are create by make |
2443 |
${PACKAGES_DOT_H}: |
${PACKAGES_DOT_H}: |
2444 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2445 |
@$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) > \$@ |
2450 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2451 |
echo "$FC_NAMEMANGLE" > \$@ |
echo "$FC_NAMEMANGLE" > \$@ |
2452 |
|
|
2453 |
|
BUILD_INFO.h: |
2454 |
|
@echo Creating \$@ ... |
2455 |
|
EOF |
2456 |
|
|
2457 |
|
test ! "x$THISVER" = x && echo " -echo \"#define THISVER '$THISVER'\" > \$@" >> $MAKEFILE |
2458 |
|
test ! "x$THISUSER" = x && echo " -echo \"#define THISUSER '$THISUSER'\" >> \$@" >> $MAKEFILE |
2459 |
|
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
2460 |
|
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
2461 |
|
|
2462 |
|
if test "x$EMBED_SRC" = xt ; then |
2463 |
|
cat >>$MAKEFILE <<EOF |
2464 |
|
|
2465 |
|
decode_files.o : EMBEDDED_FILES.h |
2466 |
|
|
2467 |
|
## \$(F77FILES) |
2468 |
|
all_fF.tar.gz : \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2469 |
|
@echo Creating \$@ ... |
2470 |
|
-tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2471 |
|
-rm -f all_fF.tar.gz |
2472 |
|
-gzip all_fF.tar |
2473 |
|
|
2474 |
|
EMBEDDED_FILES.h : all_fF.tar.gz |
2475 |
|
@echo Creating \$@ ... |
2476 |
|
-\${ROOTDIR}/tools/embed_encode/encode_files EMBEDDED_FILES.h all_fF.tar.gz |
2477 |
|
|
2478 |
|
EOF |
2479 |
|
fi |
2480 |
|
|
2481 |
|
cat >>$MAKEFILE <<EOF |
2482 |
|
|
2483 |
# The normal chain of rules is ( .F - .$FS - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |
2484 |
|
|
2485 |
%.o : %.F |
## This nullifies any default implicit rules concerning these two file types: |
2486 |
|
## %.o : %.F |
2487 |
|
|
2488 |
.F.$FS: |
.F.$FS: |
2489 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2494 |
.$FS90.o: |
.$FS90.o: |
2495 |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
2496 |
.c.o: |
.c.o: |
2497 |
\$(CC) \$(CFLAGS) -c \$< |
\$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$< |
2498 |
|
|
2499 |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
2500 |
.F.p: |
.F.p: |
2539 |
|
|
2540 |
# ... AD ... |
# ... AD ... |
2541 |
adall: ad_taf |
adall: ad_taf |
2542 |
adtaf: ad_taf_output.f |
adtaf: ad_taf_output.$FS |
2543 |
adtamc: ad_tamc_output.f |
adtamc: ad_tamc_output.$FS |
2544 |
|
|
2545 |
ad_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2546 |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template |
2547 |
cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h |
cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h |
2548 |
-rm -f ad_config.template |
-rm -f ad_config.template |
2549 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2550 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2551 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS |
2552 |
|
|
2553 |
ad_taf_output.f: ad_input_code.f |
ad_taf_output.$FS: ad_input_code.$FS |
2554 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2555 |
cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS |
2556 |
|
|
2557 |
adtafonly: |
adtafonly: |
2558 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2559 |
cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS |
2560 |
|
|
2561 |
ad_taf: ad_taf_output.o \$(OBJFILES) |
ad_taf: ad_taf_output.o \$(OBJFILES) |
2562 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
2563 |
|
|
2564 |
ad_tamc_output.f: ad_input_code.f |
ad_tamc_output.$FS: ad_input_code.$FS |
2565 |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS |
2566 |
cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.f |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS |
2567 |
|
|
2568 |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
2569 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
2570 |
|
|
2571 |
|
adonlyfwd: |
2572 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff |
2573 |
|
|
2574 |
|
adtrick: |
2575 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff |
2576 |
|
|
2577 |
# ... FTL ... |
# ... FTL ... |
2578 |
ftlall: ftl_taf |
ftlall: ftl_taf |
2579 |
ftltaf: ftl_taf_output.f |
ftltaf: ftl_taf_output.$FS |
2580 |
ftltamc: ftl_tamc_output.f |
ftltamc: ftl_tamc_output.$FS |
2581 |
|
|
2582 |
ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2583 |
@$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 |
@$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 |
2584 |
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
2585 |
-rm -f ftl_config.template |
-rm -f ftl_config.template |
2586 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2587 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2588 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS |
2589 |
|
|
2590 |
ftl_taf_output.f: ftl_input_code.f |
ftl_taf_output.$FS: ftl_input_code.$FS |
2591 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2592 |
cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS |
2593 |
|
|
2594 |
ftltafonly: |
ftltafonly: |
2595 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2596 |
cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS |
2597 |
|
|
2598 |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
2599 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
2600 |
|
|
2601 |
ftl_tamc_output.f: ftl_input_code.f |
ftl_tamc_output.$FS: ftl_input_code.$FS |
2602 |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS |
2603 |
cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.f |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS |
2604 |
|
|
2605 |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
2606 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
2607 |
|
|
2608 |
|
|
2609 |
# ... SVD ... |
# ... SVD ... |
2610 |
svdtaf: ad_taf_output.f ftl_taf_output.f |
svdtaf: ad_taf_output.$FS ftl_taf_output.$FS |
2611 |
svdall: svd_taf |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
2612 |
|
@echo "--->>> Do make svdall afterwards to compile. <<<---" |
2613 |
|
svdall: svd_touch svd_taf |
2614 |
|
|
2615 |
svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES) |
svd_taf: \$(OBJFILES) |
2616 |
\$(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) |
2617 |
|
|
2618 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2619 |
|
@echo "--->>> Assumes you previously <<<---" |
2620 |
|
@echo "--->>> did make svdtaf <<<---" |
2621 |
|
|
2622 |
|
svd_touch: |
2623 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2624 |
|
@echo "--->>> Assumes you previously <<<---" |
2625 |
|
@echo "--->>> did make svdtaf <<<---" |
2626 |
|
touch ad_taf_output.$FS ftl_taf_output.$FS |
2627 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS |
2628 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS |
2629 |
|
@$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 |
2630 |
|
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
2631 |
|
-rm -f ftl_config.template |
2632 |
|
|
2633 |
#========================================= |
#========================================= |
2634 |
|
|