73 |
fi |
fi |
74 |
} |
} |
75 |
|
|
76 |
|
# Check for broken environments (eg. cygwin, MacOSX w/HFS+) that |
77 |
|
# cannot distinguish [*.F/*.F90] from [*.f/*.f90] files. |
78 |
|
check_for_broken_Ff() { |
79 |
|
# Do we have defaults for $FS and/or $FS90 ? |
80 |
|
tfs=f |
81 |
|
tfs9=f90 |
82 |
|
if test "x$FS" != x ; then |
83 |
|
tfs="$FS" |
84 |
|
fi |
85 |
|
if test "x$FS90" != x ; then |
86 |
|
tfs9="$FS90" |
87 |
|
fi |
88 |
|
|
89 |
|
# First check the ability to create a *.F/.f pair. |
90 |
|
cat <<EOF >> genmake_hello.F |
91 |
|
program hello |
92 |
|
write(*,*) 'hi' |
93 |
|
stop |
94 |
|
end |
95 |
|
EOF |
96 |
|
cp genmake_hello.F "genmake_hello."$tfs > /dev/null 2>&1 |
97 |
|
RETVAL=$? |
98 |
|
if test "x$RETVAL" != x0 ; then |
99 |
|
if test "x$FS" = x ; then |
100 |
|
FS='for' |
101 |
|
FS90='fr9' |
102 |
|
check_for_broken_Ff |
103 |
|
else |
104 |
|
cat <<EOF 2>&1 |
105 |
|
ERROR: Your file system cannot distinguish between *.F and *.f files |
106 |
|
(fails the "cp" test) and this program cannot find a suitable |
107 |
|
replacement extension. Please try a different build environment or |
108 |
|
contact the <MITgcm-support@mitgcm.org> list for help. |
109 |
|
|
110 |
|
EOF |
111 |
|
exit -1 |
112 |
|
fi |
113 |
|
return |
114 |
|
fi |
115 |
|
rm -f genmake_hello.* |
116 |
|
|
117 |
|
# Check the ability of ${MAKE} and ${LN} to use the current set |
118 |
|
# of extensions. |
119 |
|
cat <<EOF >> genmake_hello.F |
120 |
|
program hello |
121 |
|
write(*,*) 'hi' |
122 |
|
stop |
123 |
|
end |
124 |
|
EOF |
125 |
|
test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" |
126 |
|
cat <<EOF >> $MAKEFILE |
127 |
|
.SUFFIXES: |
128 |
|
.SUFFIXES: .$tfs .F |
129 |
|
.F.$tfs: |
130 |
|
$LN \$< \$@ |
131 |
|
EOF |
132 |
|
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
133 |
|
RETVAL=$? |
134 |
|
if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then |
135 |
|
if test "x$FS" = x ; then |
136 |
|
FS='for' |
137 |
|
FS90='fr9' |
138 |
|
check_for_broken_Ff |
139 |
|
else |
140 |
|
cat <<EOF 2>&1 |
141 |
|
ERROR: Your file system cannot distinguish between *.F and *.f files |
142 |
|
(fails the "make/ln" test) and this program cannot find a suitable |
143 |
|
replacement extension. Please try a different build environment or |
144 |
|
contact the <MITgcm-support@mitgcm.org> list for help. |
145 |
|
|
146 |
|
EOF |
147 |
|
exit -1 |
148 |
|
return |
149 |
|
fi |
150 |
|
fi |
151 |
|
rm -f genmake_hello.* $MAKEFILE |
152 |
|
test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE |
153 |
|
|
154 |
|
# If we make it here, use the extensions |
155 |
|
FS=$tfs |
156 |
|
FS90=$tfs9 |
157 |
|
return |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
look_for_makedepend() { |
162 |
|
|
163 |
|
# The "original" makedepend is part of the Imake system that is |
164 |
|
# most often distributed with XFree86 or with an XFree86 source |
165 |
|
# package. As a result, many machines (eg. generic Linux) do not |
166 |
|
# have a system-default "makedepend" available. For those |
167 |
|
# systems, we have two fall-back options: |
168 |
|
# |
169 |
|
# 1) a makedepend implementation shipped with the cyrus-imapd |
170 |
|
# package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ |
171 |
|
# |
172 |
|
# 2) a known-buggy xmakedpend shell script |
173 |
|
# |
174 |
|
# So the choices are, in order: |
175 |
|
# |
176 |
|
# 1) use the user-specified program |
177 |
|
# 2) use a system-wide default |
178 |
|
# 3) locally build and use the cyrus implementation |
179 |
|
# 4) fall back to the buggy local xmakedpend script |
180 |
|
# |
181 |
|
if test "x${MAKEDEPEND}" = x ; then |
182 |
|
which makedepend > /dev/null 2>&1 |
183 |
|
RV0=$? |
184 |
|
test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" |
185 |
|
# echo 'MAKEFILE="'$MAKEFILE'"' |
186 |
|
cat <<EOF >> $MAKEFILE |
187 |
|
# THIS IS A TEST MAKEFILE GENERATED BY "genmake2" |
188 |
|
# |
189 |
|
# Some "makedepend" implementations will die if they cannot |
190 |
|
# find a Makefile -- so this file is here to gives them an |
191 |
|
# empty one to find and parse. |
192 |
|
EOF |
193 |
|
cat <<EOF >> genmake_tc.f |
194 |
|
program test |
195 |
|
write(*,*) 'test' |
196 |
|
stop |
197 |
|
end |
198 |
|
EOF |
199 |
|
makedepend genmake_tc.f > /dev/null 2>&1 |
200 |
|
RV1=$? |
201 |
|
test -f $MAKEFILE && rm -f $MAKEFILE |
202 |
|
test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE |
203 |
|
if test "x${RV0}${RV1}" = x00 ; then |
204 |
|
MAKEDEPEND=makedepend |
205 |
|
else |
206 |
|
echo " a system-default makedepend was not found." |
207 |
|
|
208 |
|
# Try to build the cyrus implementation |
209 |
|
build_cyrus_makedepend |
210 |
|
RETVAL=$? |
211 |
|
if test "x$RETVAL" != x0 ; then |
212 |
|
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
213 |
|
fi |
214 |
|
rm -f ./genmake_cy_md |
215 |
|
fi |
216 |
|
else |
217 |
|
# echo "MAKEDEPEND=${MAKEDEPEND}" |
218 |
|
echo "${MAKEDEPEND}" | grep -i cyrus > /dev/null 2>&1 |
219 |
|
RETVAL=$? |
220 |
|
if test x"$RETVAL" = x0 ; then |
221 |
|
build_cyrus_makedepend |
222 |
|
fi |
223 |
|
fi |
224 |
|
} |
225 |
|
|
226 |
|
|
227 |
|
build_cyrus_makedepend() { |
228 |
|
rm -f ./genmake_cy_md |
229 |
|
( |
230 |
|
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
231 |
|
&& ./configure > /dev/null 2>&1 \ |
232 |
|
&& make > /dev/null 2>&1 |
233 |
|
if test -x ./makedepend.exe ; then |
234 |
|
$LN ./makedepend.exe ./makedepend |
235 |
|
fi |
236 |
|
./makedepend ifparser.c > /dev/null 2>&1 \ |
237 |
|
&& echo "true" |
238 |
|
) > ./genmake_cy_md |
239 |
|
grep true ./genmake_cy_md > /dev/null 2>&1 |
240 |
|
RETVAL=$? |
241 |
|
rm -f ./genmake_cy_md |
242 |
|
if test "x$RETVAL" = x0 ; then |
243 |
|
MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend' |
244 |
|
return 0 |
245 |
|
else |
246 |
|
echo "WARNING: unable to build cyrus-imapd-makedepend" |
247 |
|
return 1 |
248 |
|
fi |
249 |
|
} |
250 |
|
|
251 |
# Guess possible config options for this host |
# Guess possible config options for this host |
252 |
find_possible_configs() { |
find_possible_configs() { |
253 |
|
|
258 |
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
259 |
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
260 |
PLATFORM=$tmp3 |
PLATFORM=$tmp3 |
261 |
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
262 |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
263 |
echo " The platform appears to be: $PLATFORM" |
echo " The platform appears to be: $PLATFORM" |
264 |
|
|
278 |
CPP="cpp -traditional -P" |
CPP="cpp -traditional -P" |
279 |
fi |
fi |
280 |
|
|
281 |
# The "original" makedepend is part of the Imake system that is |
look_for_makedepend |
282 |
# most often distributed with XFree86 or with an XFree86 source |
|
283 |
# package. As a result, many machines (eg. generic Linux) do not |
#================================================================ |
284 |
# have a system-default "makedepend" available. For those |
# look for possible C compilers |
285 |
# systems, we have two fall-back options: |
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc" |
286 |
# |
p_CC= |
287 |
# 1) a makedepend implementation shipped with the cyrus-imapd |
for c in $tmp ; do |
288 |
# package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ |
rm -f ./genmake_hello.c ./genmake_hello |
289 |
# |
cat >> genmake_hello.c << EOF |
290 |
# 2) a known-buggy xmakedpend shell script |
#include <stdio.h> |
291 |
# |
int main(int argc, char **argv) { |
292 |
# So the choices are, in order: |
printf("Hello!\n"); |
293 |
# |
return 0; |
294 |
# 1) use the user-specified program |
} |
295 |
# 2) use a system-wide default |
EOF |
296 |
# 3) locally build and use the cyrus implementation |
$c -o genmake_hello genmake_hello.c > /dev/null 2>&1 |
297 |
# 4) fall back to the buggy local xmakedpend script |
RETVAL=$? |
298 |
# |
if test "x${RETVAL}" = x0 ; then |
299 |
if test "x${MAKEDEPEND}" = x ; then |
p_CC="$p_CC $c" |
300 |
which makedepend > /dev/null 2>&1 |
fi |
301 |
RETVAL=$? |
done |
302 |
if test ! "x${RETVAL}" = x0 ; then |
rm -f ./genmake_hello.c ./genmake_hello |
303 |
echo " a system-default makedepend was not found." |
if test "x${p_CC}" = x ; then |
304 |
|
cat 1>&2 <<EOF |
305 |
# Try to build the cyrus impl |
|
306 |
rm -f ./genmake_cy_md |
Error: No C compilers were found in your path. Please specify one using: |
307 |
( |
|
308 |
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
309 |
&& ./configure > /dev/null 2>&1 \ |
2) the CC or MITGCM_CC environment variables. |
310 |
&& make > /dev/null 2>&1 \ |
|
311 |
&& ./makedepend ifparser.c > /dev/null 2>&1 \ |
EOF |
312 |
&& echo "true" |
exit 1 |
313 |
) > ./genmake_cy_md |
else |
314 |
grep true ./genmake_cy_md > /dev/null 2>&1 |
echo " The possible C compilers found in your path are:" |
315 |
RETVAL=$? |
echo " "$p_CC |
316 |
if test "x$RETVAL" = x0 ; then |
if test "x$CC" = x ; then |
317 |
MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend' |
CC=`echo $p_CC | $AWK '{print $1}'` |
318 |
else |
echo " Setting C compiler to: "$CC |
319 |
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
fi |
|
fi |
|
|
rm -f ./genmake_cy_md |
|
|
fi |
|
320 |
fi |
fi |
321 |
|
|
322 |
# look for possible fortran compilers |
#================================================================ |
323 |
|
# look for possible FORTRAN compilers |
324 |
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" |
325 |
p_FC= |
p_FC= |
326 |
for c in $tmp ; do |
for c in $tmp ; do |
346 |
|
|
347 |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
348 |
2) a command-line option (eg. "-fc NAME"), or |
2) a command-line option (eg. "-fc NAME"), or |
349 |
3) the MITGCM_FC environment variable. |
3) the FC or MITGCM_FC environment variables. |
350 |
|
|
351 |
EOF |
EOF |
352 |
exit 1 |
exit 1 |
448 |
-help | --help | -h | --h |
-help | --help | -h | --h |
449 |
Print this help message and exit. |
Print this help message and exit. |
450 |
|
|
451 |
|
-adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME |
452 |
|
-adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME |
453 |
|
Use "NAME" as the adoptfile. By default, the file at |
454 |
|
"tools/adjoint_options/adjoint_default" will be used. |
455 |
|
|
456 |
-nooptfile | --nooptfile |
-nooptfile | --nooptfile |
457 |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
458 |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
517 |
will search for a working compiler by trying a list of |
will search for a working compiler by trying a list of |
518 |
"usual suspects" such as g77, f77, etc. |
"usual suspects" such as g77, f77, etc. |
519 |
|
|
520 |
|
-cc NAME | --cc NAME | -cc=NAME | --cc=NAME |
521 |
|
Use "NAME" as the C compiler. By default, genmake |
522 |
|
will search for a working compiler by trying a list of |
523 |
|
"usual suspects" such as gcc, c89, cc, etc. |
524 |
|
|
525 |
-[no]ieee | --[no]ieee |
-[no]ieee | --[no]ieee |
526 |
Do or don't use IEEE numerics. Note that this option |
Do or don't use IEEE numerics. Note that this option |
527 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
531 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
532 |
-mpi=PATH | --mpi=PATH |
-mpi=PATH | --mpi=PATH |
533 |
Include MPI header files and link to MPI libraries using MPI_ROOT |
Include MPI header files and link to MPI libraries using MPI_ROOT |
534 |
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 |
535 |
from $PATH/lib and use binaries from $PATH/bin. |
from \$PATH/lib and use binaries from \$PATH/bin. |
536 |
|
|
537 |
-bash NAME |
-bash NAME |
538 |
Explicitly specify the Bourne or BASH shell to use |
Explicitly specify the Bourne or BASH shell to use |
557 |
|
|
558 |
# Build a CPP macro to automate calling C routines from FORTRAN |
# Build a CPP macro to automate calling C routines from FORTRAN |
559 |
get_fortran_c_namemangling() { |
get_fortran_c_namemangling() { |
560 |
|
|
561 |
|
#echo "FC_NAMEMANGLE = \"$FC_NAMEMANGLE\"" |
562 |
|
if test ! "x$FC_NAMEMANGLE" = x ; then |
563 |
|
return 0 |
564 |
|
fi |
565 |
|
|
566 |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
567 |
|
|
568 |
cat > genmake_test.c <<EOF |
cat > genmake_test.c <<EOF |
580 |
EOF |
EOF |
581 |
return 1 |
return 1 |
582 |
fi |
fi |
583 |
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` |
584 |
RETVAL=$? |
RETVAL=$? |
585 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
586 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
592 |
EOF |
EOF |
593 |
return 1 |
return 1 |
594 |
fi |
fi |
595 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
596 |
subroutine tcall( string ) |
subroutine tcall( string ) |
597 |
character*(*) string |
character*(*) string |
598 |
call tsub( string ) |
call tsub( string ) |
599 |
end |
end |
600 |
EOF |
EOF |
601 |
$FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1 |
$FC $FFLAGS $DEFINES -c genmake_tcomp.$FS >> genmake_warnings 2>&1 |
602 |
RETVAL=$? |
RETVAL=$? |
603 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
604 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
610 |
EOF |
EOF |
611 |
return 1 |
return 1 |
612 |
fi |
fi |
613 |
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` |
614 |
RETVAL=$? |
RETVAL=$? |
615 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
616 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
664 |
*curtim = *curtim/1.E6; |
*curtim = *curtim/1.E6; |
665 |
} |
} |
666 |
EOF |
EOF |
667 |
make genmake_tc_1.o >> genmake_tc.log 2>&1 |
make genmake_tc_1.o >> genmake_warnings 2>&1 |
668 |
RET_C=$? |
RET_C=$? |
669 |
cat <<EOF > genmake_tc_2.f |
cat <<EOF > genmake_tc_2.$FS |
670 |
program hello |
program hello |
671 |
Real*8 wtime |
Real*8 wtime |
672 |
external cloc |
external cloc |
674 |
print *," HELLO WORLD", wtime |
print *," HELLO WORLD", wtime |
675 |
end program hello |
end program hello |
676 |
EOF |
EOF |
677 |
$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 |
678 |
RET_F=$? |
RET_F=$? |
679 |
test -x ./genmake_tc && ./genmake_tc >> genmake_tc.log 2>&1 |
test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 |
680 |
RETVAL=$? |
RETVAL=$? |
681 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
682 |
HAVE_CLOC=t |
HAVE_CLOC=t |
686 |
} |
} |
687 |
|
|
688 |
|
|
689 |
|
check_HAVE_STAT() { |
690 |
|
get_fortran_c_namemangling |
691 |
|
cat <<EOF > genmake_tc_1.c |
692 |
|
$FC_NAMEMANGLE |
693 |
|
#include <stdio.h> |
694 |
|
#include <stdlib.h> |
695 |
|
#include <unistd.h> |
696 |
|
#include <sys/stat.h> |
697 |
|
#include <sys/types.h> |
698 |
|
void FC_NAMEMANGLE(tfsize) ( int *nbyte ) |
699 |
|
{ |
700 |
|
char name[512]; |
701 |
|
struct stat astat; |
702 |
|
|
703 |
|
name[0] = 'a'; name[1] = '\0'; |
704 |
|
if (! stat(name, &astat)) |
705 |
|
*nbyte = (int)(astat.st_size); |
706 |
|
else |
707 |
|
*nbyte = -1; |
708 |
|
} |
709 |
|
EOF |
710 |
|
make genmake_tc_1.o >> genmake_tc.log 2>&1 |
711 |
|
RET_C=$? |
712 |
|
cat <<EOF > genmake_tc_2.$FS |
713 |
|
program hello |
714 |
|
integer nbyte |
715 |
|
call tfsize(nbyte) |
716 |
|
print *," HELLO WORLD", nbyte |
717 |
|
end program hello |
718 |
|
EOF |
719 |
|
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
720 |
|
RET_F=$? |
721 |
|
test -x ./genmake_tc && ./genmake_tc >> genmake_tc.log 2>&1 |
722 |
|
RETVAL=$? |
723 |
|
if test "x$RETVAL" = x0 ; then |
724 |
|
HAVE_STAT=t |
725 |
|
DEFINES="$DEFINES -DHAVE_STAT" |
726 |
|
fi |
727 |
|
rm -f genmake_tc* |
728 |
|
} |
729 |
|
|
730 |
|
|
731 |
check_netcdf_libs() { |
check_netcdf_libs() { |
732 |
|
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
733 |
|
return |
734 |
|
fi |
735 |
|
echo "" > genmake_tnc.log |
736 |
cat <<EOF > genmake_tnc.F |
cat <<EOF > genmake_tnc.F |
737 |
program fgennc |
program fgennc |
738 |
#include "netcdf.inc" |
#include "netcdf.inc" |
739 |
|
EOF |
740 |
|
if test ! "x$MPI" = x ; then |
741 |
|
echo '#include "mpif.h"' >> genmake_tnc.F |
742 |
|
fi |
743 |
|
cat <<EOF >> genmake_tnc.F |
744 |
integer iret, ncid, xid |
integer iret, ncid, xid |
745 |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
746 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
750 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
751 |
end |
end |
752 |
EOF |
EOF |
753 |
$CPP genmake_tnc.F > genmake_tnc.f \ |
echo "Executing:" > genmake_tnc.log |
754 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
echo " $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS" \ |
755 |
|
> genmake_tnc.log |
756 |
|
RET_CPP=f |
757 |
|
$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ |
758 |
|
&& RET_CPP=t |
759 |
|
if test "x$RET_CPP" = xf ; then |
760 |
|
echo " WARNING: CPP failed to pre-process the netcdf test." \ |
761 |
|
> genmake_tnc.log |
762 |
|
echo " Please check that \$INCLUDES is properly set." \ |
763 |
|
> genmake_tnc.log |
764 |
|
fi |
765 |
|
echo "Executing:" > genmake_tnc.log |
766 |
|
echo " $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS" > genmake_tnc.log |
767 |
|
echo " $LINK -o genmake_tnc.o $LIBS" > genmake_tnc.log |
768 |
|
$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
769 |
|
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
770 |
RET_COMPILE=$? |
RET_COMPILE=$? |
771 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
|
772 |
RETVAL=$? |
#EH3 Remove test program execution for machines that either disallow |
773 |
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
#EH3 execution or cannot support it (eg. cross-compilers) |
774 |
|
#EH3 |
775 |
|
#EH3 test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
776 |
|
#EH3 RETVAL=$? |
777 |
|
#EH3 if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
778 |
|
|
779 |
|
if test "x$RET_COMPILE" = x0 ; then |
780 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
781 |
else |
else |
782 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
783 |
$CPP genmake_tnc.F > genmake_tnc.f \ |
$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ |
784 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
785 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
786 |
RET_COMPILE=$? |
RET_COMPILE=$? |
787 |
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 |
|
788 |
LIBS="$LIBS -lnetcdf" |
LIBS="$LIBS -lnetcdf" |
789 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
790 |
else |
else |
807 |
LN= |
LN= |
808 |
S64= |
S64= |
809 |
KPP= |
KPP= |
810 |
FC= |
#FC= |
811 |
CPP= |
#CC=gcc |
812 |
|
#CPP= |
813 |
LINK= |
LINK= |
814 |
DEFINES= |
DEFINES= |
815 |
PACKAGES= |
PACKAGES= |
816 |
ENABLE= |
ENABLE= |
817 |
DISABLE= |
DISABLE= |
818 |
MAKEFILE= |
# MAKEFILE= |
819 |
MAKEDEPEND= |
# MAKEDEPEND= |
820 |
PDEPEND= |
PDEPEND= |
821 |
DUMPSTATE=t |
DUMPSTATE=t |
822 |
PDEFAULT= |
PDEFAULT= |
823 |
OPTFILE= |
OPTFILE= |
824 |
INCLUDES="-I." |
INCLUDES="-I. $INCLUDES" |
825 |
FFLAGS= |
FFLAGS= |
826 |
FOPTIM= |
FOPTIM= |
827 |
CFLAGS= |
CFLAGS= |
840 |
HAVE_FDATE= |
HAVE_FDATE= |
841 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
842 |
HAVE_CLOC= |
HAVE_CLOC= |
843 |
|
HAVE_STAT= |
844 |
HAVE_NETCDF= |
HAVE_NETCDF= |
845 |
|
HAVE_ETIME= |
846 |
|
|
847 |
MODS= |
MODS= |
848 |
TOOLSDIR= |
TOOLSDIR= |
853 |
G2ARGS= |
G2ARGS= |
854 |
BASH= |
BASH= |
855 |
PWD=`pwd` |
PWD=`pwd` |
856 |
MAKE=make |
test "x$MAKE" = x && MAKE=make |
857 |
AWK=awk |
test "x$AWK" = x && AWK=awk |
858 |
THISHOSTNAME=`hostname` |
THISHOST=`hostname` |
859 |
THISCWD=`pwd` |
THISCWD=`pwd` |
860 |
THISDATE=`date` |
THISDATE=`date` |
861 |
|
THISUSER=`echo $USER` |
862 |
|
THISVER= |
863 |
MACHINE=`uname -a` |
MACHINE=`uname -a` |
864 |
EXECUTABLE= |
EXECUTABLE= |
865 |
EXEHOOK= |
EXEHOOK= |
869 |
if test "x$MITGCM_IEEE" != x ; then |
if test "x$MITGCM_IEEE" != x ; then |
870 |
IEEE=$MITGCM_IEEE |
IEEE=$MITGCM_IEEE |
871 |
fi |
fi |
872 |
|
FS= |
873 |
|
FS90= |
874 |
|
|
875 |
AUTODIFF_PKG_USED=f |
AUTODIFF_PKG_USED=f |
876 |
AD_OPTFILE= |
AD_OPTFILE= |
893 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
894 |
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 " |
895 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
896 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE" |
897 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
898 |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE" |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
899 |
|
|
900 |
# The following are all related to adjoint/tangent-linear stuff |
# The following are all related to adjoint/tangent-linear stuff |
901 |
gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS" |
gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS" |
925 |
fi |
fi |
926 |
done |
done |
927 |
printf " getting local config information: " |
printf " getting local config information: " |
928 |
if test -e $gm_local ; then |
if test -f $gm_local ; then |
929 |
echo "using $gm_local" |
echo "using $gm_local" |
930 |
. $gm_local |
. $gm_local |
931 |
# echo "DISABLE=$DISABLE" |
# echo "DISABLE=$DISABLE" |
934 |
echo "none found" |
echo "none found" |
935 |
fi |
fi |
936 |
|
|
937 |
# echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
#echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
938 |
#OPTIONS= |
#OPTIONS= |
939 |
#n=0 |
#n=0 |
940 |
#for i ; do |
#for i ; do |
946 |
#done |
#done |
947 |
#parse_options |
#parse_options |
948 |
ac_prev= |
ac_prev= |
949 |
for ac_option ; do |
for ac_option in "$@" ; do |
950 |
|
|
951 |
G2ARGS="$G2ARGS \"$ac_option\"" |
G2ARGS="$G2ARGS \"$ac_option\"" |
952 |
|
|
1042 |
# ac_prev=cpp ;; |
# ac_prev=cpp ;; |
1043 |
# -cpp=* | --cpp=*) |
# -cpp=* | --cpp=*) |
1044 |
# CPP=$ac_optarg ;; |
# CPP=$ac_optarg ;; |
1045 |
|
|
1046 |
|
-cc | --cc) |
1047 |
|
ac_prev=CC ;; |
1048 |
|
-cc=* | --cc=*) |
1049 |
|
CC=$ac_optarg ;; |
1050 |
|
|
1051 |
-fortran | --fortran | -fc | --fc) |
-fortran | --fortran | -fc | --fc) |
1052 |
ac_prev=FC ;; |
ac_prev=FC ;; |
1053 |
-fc=* | --fc=*) |
-fc=* | --fc=*) |
1054 |
FC=$ac_optarg ;; |
FC=$ac_optarg ;; |
1055 |
|
|
1056 |
|
-fs | --fs) |
1057 |
|
ac_prev=FS ;; |
1058 |
|
-fs=* | --fs=*) |
1059 |
|
FS=$ac_optarg ;; |
1060 |
|
|
1061 |
|
-fs90 | --fs90) |
1062 |
|
ac_prev=FS90 ;; |
1063 |
|
-fs90=* | --fs90=*) |
1064 |
|
FS90=$ac_optarg ;; |
1065 |
|
|
1066 |
-ieee | --ieee) |
-ieee | --ieee) |
1067 |
IEEE=true ;; |
IEEE=true ;; |
1068 |
-noieee | --noieee) |
-noieee | --noieee) |
1106 |
|
|
1107 |
done |
done |
1108 |
|
|
1109 |
|
|
1110 |
if test -f ./.genmakerc ; then |
if test -f ./.genmakerc ; then |
1111 |
echo |
echo |
1112 |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
1119 |
echo |
echo |
1120 |
fi |
fi |
1121 |
|
|
1122 |
|
# Find the MITgcm ${ROOTDIR} |
1123 |
if test "x${ROOTDIR}" = x ; then |
if test "x${ROOTDIR}" = x ; then |
1124 |
if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
1125 |
|
if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
1126 |
ROOTDIR=".." |
ROOTDIR=".." |
1127 |
else |
else |
1128 |
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
1146 |
exit 1 |
exit 1 |
1147 |
fi |
fi |
1148 |
|
|
1149 |
|
# Find the MITgcm ${THISVER} |
1150 |
|
if test -f "${ROOTDIR}/doc/tag-index" ; then |
1151 |
|
THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1` |
1152 |
|
fi |
1153 |
|
|
1154 |
|
if test "x$MAKEFILE" = x ; then |
1155 |
|
MAKEFILE="Makefile" |
1156 |
|
fi |
1157 |
|
|
1158 |
echo " getting OPTFILE information: " |
echo " getting OPTFILE information: " |
1159 |
if test "x${OPTFILE}" = x ; then |
if test "x${OPTFILE}" = x ; then |
1160 |
if test "x$MITGCM_OF" = x ; then |
if test "x$MITGCM_OF" = x ; then |
1211 |
fi |
fi |
1212 |
fi |
fi |
1213 |
|
|
1214 |
# Check that FC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
#==================================================================== |
1215 |
|
# Set default values if not set by the optfile |
1216 |
|
# |
1217 |
|
# Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
1218 |
# either set defaults or complain and abort! |
# either set defaults or complain and abort! |
1219 |
if test ! "x$BASH" = x ; then |
if test ! "x$BASH" = x ; then |
1220 |
# 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) |
1230 |
EOF |
EOF |
1231 |
exit 1 |
exit 1 |
1232 |
fi |
fi |
1233 |
|
if test "x$CC" = x ; then |
1234 |
|
CC=cc |
1235 |
|
# cat <<EOF 1>&2 |
1236 |
|
# Error: no C compiler: please specify using one of the following: |
1237 |
|
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
1238 |
|
# 2) the "-cc=XXX" command-line option |
1239 |
|
# 3) the "./genmake_local" file |
1240 |
|
# EOF |
1241 |
|
# exit 1 |
1242 |
|
fi |
1243 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1244 |
LINK=$FC |
LINK=$FC |
1245 |
fi |
fi |
1250 |
CPP=cpp |
CPP=cpp |
1251 |
fi |
fi |
1252 |
#EH3 === UGLY === |
#EH3 === UGLY === |
1253 |
# The following an ugly little hack to check for $CPP in /lib/ and it |
# The following is an ugly little hack to check for $CPP in /lib/ and |
1254 |
# should eventually be replaced with a more general function that |
# it should eventually be replaced with a more general function that |
1255 |
# searches a combo of the user's path and a list of "usual suspects" |
# searches a combo of the user's path and a list of "usual suspects" |
1256 |
# to find the correct location for binaries such as $CPP. |
# to find the correct location for binaries such as $CPP. |
1257 |
for i in " " "/lib/" ; do |
for i in " " "/lib/" ; do |
1274 |
else |
else |
1275 |
rm -f test_cpp |
rm -f test_cpp |
1276 |
fi |
fi |
1277 |
if test "x$MAKEDEPEND" = x ; then |
look_for_makedepend |
|
MAKEDEPEND=makedepend |
|
|
fi |
|
1278 |
if test "x$LN" = x ; then |
if test "x$LN" = x ; then |
1279 |
LN="ln -s" |
LN="ln -s" |
1280 |
fi |
fi |
1292 |
fi |
fi |
1293 |
rm -f genmake_test_ln genmake_tlink |
rm -f genmake_test_ln genmake_tlink |
1294 |
|
|
1295 |
|
# Check for broken *.F/*.f handling and fix if possible |
1296 |
|
check_for_broken_Ff |
1297 |
|
|
1298 |
if test ! "x$MPI" = x ; then |
if test ! "x$MPI" = x ; then |
1299 |
echo " Turning on MPI cpp macros" |
echo " Turning on MPI cpp macros" |
1300 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
1302 |
|
|
1303 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
1304 |
printf " Do we have the system() command using $FC... " |
printf " Do we have the system() command using $FC... " |
1305 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1306 |
program hello |
program hello |
1307 |
call system('echo hi') |
call system('echo hi') |
1308 |
end |
end |
1309 |
EOF |
EOF |
1310 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1311 |
RETVAL=$? |
RETVAL=$? |
1312 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1313 |
HAVE_SYSTEM=t |
HAVE_SYSTEM=t |
1320 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1321 |
|
|
1322 |
printf " Do we have the fdate() command using $FC... " |
printf " Do we have the fdate() command using $FC... " |
1323 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1324 |
program hello |
program hello |
1325 |
CHARACTER(128) string |
CHARACTER(128) string |
1326 |
string = ' ' |
string = ' ' |
1328 |
print *, string |
print *, string |
1329 |
end |
end |
1330 |
EOF |
EOF |
1331 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1332 |
RETVAL=$? |
RETVAL=$? |
1333 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1334 |
HAVE_FDATE=t |
HAVE_FDATE=t |
1340 |
fi |
fi |
1341 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1342 |
|
|
1343 |
|
printf " Do we have the etime() command using $FC... " |
1344 |
|
cat > genmake_tcomp.$FS <<EOF |
1345 |
|
program hello |
1346 |
|
REAL*4 ACTUAL, TARRAY(2) |
1347 |
|
EXTERNAL ETIME |
1348 |
|
REAL*4 ETIME |
1349 |
|
actual = etime( tarray ) |
1350 |
|
print *, tarray |
1351 |
|
end |
1352 |
|
EOF |
1353 |
|
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1354 |
|
RETVAL=$? |
1355 |
|
if test "x$RETVAL" = x0 ; then |
1356 |
|
HAVE_ETIME=t |
1357 |
|
DEFINES="$DEFINES -DHAVE_ETIME" |
1358 |
|
echo "yes" |
1359 |
|
else |
1360 |
|
HAVE_ETIME= |
1361 |
|
echo "no" |
1362 |
|
fi |
1363 |
|
rm -f genmake_tcomp* |
1364 |
|
|
1365 |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
1366 |
check_HAVE_CLOC |
check_HAVE_CLOC |
1367 |
if test "x$HAVE_CLOC" != x ; then |
if test "x$HAVE_CLOC" != x ; then |
1371 |
fi |
fi |
1372 |
rm -f genmake_t* |
rm -f genmake_t* |
1373 |
|
|
1374 |
|
printf " Can we use stat() through C calls... " |
1375 |
|
check_HAVE_STAT |
1376 |
|
if test "x$HAVE_STAT" != x ; then |
1377 |
|
echo "yes" |
1378 |
|
else |
1379 |
|
echo "no" |
1380 |
|
fi |
1381 |
|
rm -f genmake_t* |
1382 |
|
|
1383 |
printf " Can we create NetCDF-enabled binaries... " |
printf " Can we create NetCDF-enabled binaries... " |
1384 |
check_netcdf_libs |
check_netcdf_libs |
1385 |
if test "x$HAVE_NETCDF" != x ; then |
if test "x$HAVE_NETCDF" != x ; then |
1404 |
done |
done |
1405 |
echo |
echo |
1406 |
|
|
|
if test "x$MAKEFILE" = x ; then |
|
|
MAKEFILE="Makefile" |
|
|
fi |
|
1407 |
if test "x${PLATFORM}" = x ; then |
if test "x${PLATFORM}" = x ; then |
1408 |
PLATFORM=$p_PLATFORM |
PLATFORM=$p_PLATFORM |
1409 |
fi |
fi |
1410 |
|
|
1411 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
1412 |
if test "${PWD##/*/}" = "bin" -a -d ../exe -a $ROOTDIR = .. ; then |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
1413 |
|
if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then |
1414 |
EXEDIR=../exe |
EXEDIR=../exe |
1415 |
else |
else |
1416 |
EXEDIR=. |
EXEDIR=. |
1429 |
exit 1 |
exit 1 |
1430 |
fi |
fi |
1431 |
if test "x$S64" = x ; then |
if test "x$S64" = x ; then |
1432 |
S64='$(TOOLSDIR)/set64bitConst.sh' |
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.sh > /dev/null 2>&1 |
1433 |
|
RETVAL=$? |
1434 |
|
if test "x${RETVAL}" = x0 ; then |
1435 |
|
S64='$(TOOLSDIR)/set64bitConst.sh' |
1436 |
|
else |
1437 |
|
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.csh > /dev/null 2>&1 |
1438 |
|
RETVAL=$? |
1439 |
|
if test "x${RETVAL}" = x0 ; then |
1440 |
|
S64='$(TOOLSDIR)/set64bitConst.csh' |
1441 |
|
else |
1442 |
|
cat <<EOF |
1443 |
|
|
1444 |
|
ERROR: neither of the two default scripts: |
1445 |
|
|
1446 |
|
${TOOLSDIR}/set64bitConst.sh |
1447 |
|
${TOOLSDIR}/set64bitConst.csh |
1448 |
|
|
1449 |
|
are working so please check paths or specify (with \$S64) a |
1450 |
|
working version of this script. |
1451 |
|
|
1452 |
|
EOF |
1453 |
|
exit 1 |
1454 |
|
fi |
1455 |
|
fi |
1456 |
fi |
fi |
1457 |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
1458 |
|
|
1551 |
PACKAGES="$PACKAGES $i" |
PACKAGES="$PACKAGES $i" |
1552 |
done |
done |
1553 |
echo " before group expansion packages are: $PACKAGES" |
echo " before group expansion packages are: $PACKAGES" |
1554 |
while ! expand_pkg_groups; do echo > /dev/null; done |
RET=1 |
1555 |
|
while test $RET = 1 ; do expand_pkg_groups; RET=$?; done |
1556 |
echo " after group expansion packages are: $PACKAGES" |
echo " after group expansion packages are: $PACKAGES" |
1557 |
fi |
fi |
1558 |
fi |
fi |
1597 |
rm -f ./.tmp_pack |
rm -f ./.tmp_pack |
1598 |
echo " packages are: $PACKAGES" |
echo " packages are: $PACKAGES" |
1599 |
|
|
1600 |
|
# Check availability of NetCDF and then either build the MNC template |
1601 |
|
# files or delete mnc from the list of available packages. |
1602 |
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
1603 |
|
RETVAL=$? |
1604 |
|
if test "x$RETVAL" = x0 ; then |
1605 |
|
if test "x$HAVE_NETCDF" != xt ; then |
1606 |
|
cat <<EOF |
1607 |
|
|
1608 |
|
********************************************************************* |
1609 |
|
WARNING: the "mnc" package was enabled but tests failed to compile |
1610 |
|
NetCDF applications. Please check that: |
1611 |
|
|
1612 |
|
1) NetCDF is correctly installed for this compiler and |
1613 |
|
2) the LIBS variable (within the "optfile") specifies the correct |
1614 |
|
NetCDF library to link against. |
1615 |
|
|
1616 |
|
Due to this failure, the "mnc" package is now DISABLED. |
1617 |
|
********************************************************************* |
1618 |
|
|
1619 |
|
EOF |
1620 |
|
PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'` |
1621 |
|
DISABLE="$DISABLE mnc" |
1622 |
|
else |
1623 |
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1 |
1624 |
|
RETVAL=$? |
1625 |
|
if test "x${RETVAL}" = x0 ; then |
1626 |
|
rm -f make_mnc.errors |
1627 |
|
else |
1628 |
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
1629 |
|
cat make_mnc.errors 1>&2 |
1630 |
|
exit 1 |
1631 |
|
fi |
1632 |
|
fi |
1633 |
|
fi |
1634 |
|
|
1635 |
echo " applying package dependency rules" |
echo " applying package dependency rules" |
1636 |
ck= |
ck= |
1637 |
while test "x$ck" != xtt ; do |
while test "x$ck" != xtt ; do |
1696 |
echo " the dependency rules for \"$dname\"" |
echo " the dependency rules for \"$dname\"" |
1697 |
exit 1 |
exit 1 |
1698 |
fi |
fi |
1699 |
i=$(( $i + 1 )) |
i=`echo "$i + 1" | bc -l` |
1700 |
|
#i=$(( $i + 1 )) |
1701 |
done |
done |
1702 |
ck=$ck"t" |
ck=$ck"t" |
1703 |
done |
done |
1716 |
fi |
fi |
1717 |
done |
done |
1718 |
|
|
|
# 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 |
|
|
|
|
1719 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
1720 |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
1721 |
# 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 |
1735 |
fi |
fi |
1736 |
done |
done |
1737 |
if test "x$has_pack" = xf ; then |
if test "x$has_pack" = xf ; then |
1738 |
undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'` |
undef=`echo "ALLOW_$n" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` |
1739 |
DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef" |
DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef" |
1740 |
fi |
fi |
1741 |
fi |
fi |
1742 |
done |
done |
1743 |
ENABLED_PACKAGES= |
ENABLED_PACKAGES= |
1744 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
1745 |
def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'` |
def=`echo "ALLOW_$i" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` |
1746 |
ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def" |
ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def" |
1747 |
#eh3 DEFINES="$DEFINES -D$def" |
#eh3 DEFINES="$DEFINES -D$def" |
1748 |
|
|
1826 |
cat $i/$j >> ad_files |
cat $i/$j >> ad_files |
1827 |
done |
done |
1828 |
done |
done |
1829 |
|
if test ! "x"$FS = "x.f" ; then |
1830 |
|
cat ad_files | sed -e "s/\.f/$FS/g" > ad_files_f |
1831 |
|
mv -f ad_files_f ad_files |
1832 |
|
fi |
1833 |
|
|
1834 |
echo |
echo |
1835 |
echo "=== Creating the Makefile ===" |
echo "=== Creating the Makefile ===" |
1836 |
echo " setting INCLUDES" |
echo " setting INCLUDES" |
1837 |
for i in $INCLUDEDIRS ; do |
for i in $INCLUDEDIRS ; do |
1838 |
if ! test -d $i ; then |
if test ! -d $i ; then |
|
# INCLUDES="$INCLUDES -I$i" |
|
|
# else |
|
1839 |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
1840 |
fi |
fi |
1841 |
done |
done |
1865 |
;; |
;; |
1866 |
./FC_NAMEMANGLE.h) |
./FC_NAMEMANGLE.h) |
1867 |
;; |
;; |
1868 |
|
./BUILD_INFO.h) |
1869 |
|
;; |
1870 |
*) |
*) |
1871 |
touch .links.tmp/$sf |
touch .links.tmp/$sf |
1872 |
deplist="$deplist $sf" |
deplist="$deplist $sf" |
1873 |
;; |
;; |
1874 |
esac |
esac |
1875 |
extn=`echo $sf | $AWK -F '.' '{print $NF}'` |
extn=`echo $sf | $AWK -F. '{print $NF}'` |
1876 |
case $extn in |
case $extn in |
1877 |
F) |
F) |
1878 |
echo " \\" >> srclist.inc |
echo " \\" >> srclist.inc |
1912 |
echo "" >> hlist.inc |
echo "" >> hlist.inc |
1913 |
echo "" >> ad_flow_files.inc |
echo "" >> ad_flow_files.inc |
1914 |
|
|
1915 |
if test -e $MAKEFILE ; then |
if test -f $MAKEFILE ; then |
1916 |
mv -f $MAKEFILE "$MAKEFILE.bak" |
mv -f $MAKEFILE "$MAKEFILE.bak" |
1917 |
fi |
fi |
1918 |
echo " Writing makefile: $MAKEFILE" |
echo " Writing makefile: $MAKEFILE" |
1923 |
echo "# by the command:" >> $MAKEFILE |
echo "# by the command:" >> $MAKEFILE |
1924 |
echo "# $0 $G2ARGS" >> $MAKEFILE |
echo "# $0 $G2ARGS" >> $MAKEFILE |
1925 |
echo "# executed by:" >> $MAKEFILE |
echo "# executed by:" >> $MAKEFILE |
1926 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
echo "# ${THISUSER}@${THISHOST}:${THISCWD}" >> $MAKEFILE |
1927 |
|
|
1928 |
EXE_AD=$EXECUTABLE"_ad" |
EXE_AD=$EXECUTABLE"_ad" |
1929 |
EXE_FTL=$EXECUTABLE"_ftl" |
EXE_FTL=$EXECUTABLE"_ftl" |
1969 |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
1970 |
|
|
1971 |
# These files are created by Makefile |
# These files are created by Makefile |
1972 |
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 |
1973 |
|
|
1974 |
EOF |
EOF |
1975 |
|
|
1988 |
FC = ${FC} |
FC = ${FC} |
1989 |
# Fortran compiler |
# Fortran compiler |
1990 |
F90C = ${F90C} |
F90C = ${F90C} |
1991 |
|
# C compiler |
1992 |
|
CC = ${CC} |
1993 |
# Link editor |
# Link editor |
1994 |
LINK = ${LINK} ${LDADD} |
LINK = ${LINK} ${LDADD} |
1995 |
|
|
2012 |
NOOPTFILES = ${NOOPTFILES} |
NOOPTFILES = ${NOOPTFILES} |
2013 |
NOOPTFLAGS = ${NOOPTFLAGS} |
NOOPTFLAGS = ${NOOPTFLAGS} |
2014 |
# Flags and libraries needed for linking |
# Flags and libraries needed for linking |
2015 |
LIBS = ${LIBS} \$(XLIBS) |
LIBS = ${LIBS} |
2016 |
# Name of the Mekfile |
# Name of the Mekfile |
2017 |
MAKEFILE=${MAKEFILE} |
MAKEFILE=${MAKEFILE} |
2018 |
|
|
2023 |
cat f90srclist.inc >> $MAKEFILE |
cat f90srclist.inc >> $MAKEFILE |
2024 |
cat hlist.inc >> $MAKEFILE |
cat hlist.inc >> $MAKEFILE |
2025 |
cat ad_flow_files.inc >> $MAKEFILE |
cat ad_flow_files.inc >> $MAKEFILE |
2026 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2027 |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> $MAKEFILE |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
2028 |
echo 'F90FILES = $(F90SRCFILES:.F90=.f90)' >> $MAKEFILE |
echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE |
2029 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
2030 |
|
echo >> $MAKEFILE |
2031 |
|
echo '.SUFFIXES:' >> $MAKEFILE |
2032 |
|
echo '.SUFFIXES: .o .'$FS' .p .F .c .'$FS90' .F90' >> $MAKEFILE |
2033 |
rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc |
rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc |
2034 |
rm -f ad_flow_files.inc |
rm -f ad_flow_files.inc |
2035 |
|
|
2036 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2037 |
|
|
|
.SUFFIXES: |
|
|
.SUFFIXES: .o .f .p .F .c .F90 .f90 |
|
|
|
|
2038 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
2039 |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
2040 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2041 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
2042 |
depend: |
depend: |
2043 |
@make links |
@make links |
2044 |
\$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
\$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
2045 |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
2046 |
-rm -f makedepend.out |
-rm -f makedepend.out |
2047 |
|
|
2054 |
@\$(EXECUTABLE) > \$@ |
@\$(EXECUTABLE) > \$@ |
2055 |
|
|
2056 |
clean: |
clean: |
2057 |
-rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} *.template |
-rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template |
2058 |
Clean: |
Clean: |
2059 |
@make clean |
@make clean |
2060 |
@make cleanlinks |
@make cleanlinks |
2065 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
2066 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
2067 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
2068 |
-rm -f \$(EXECUTABLE) output.txt |
-rm -f \$(EXECUTABLE) output.txt STD* |
2069 |
|
|
2070 |
#eh3 Makefile: makefile |
#eh3 Makefile: makefile |
2071 |
makefile: |
makefile: |
2073 |
cleanlinks: |
cleanlinks: |
2074 |
-find . -type l -exec rm {} \; |
-find . -type l -exec rm {} \; |
2075 |
|
|
2076 |
# Special targets ($SPECIAL_FILES) which are create by make |
# Special targets (SPECIAL_FILES) which are create by make |
2077 |
${PACKAGES_DOT_H}: |
${PACKAGES_DOT_H}: |
2078 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2079 |
@$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) > \$@ |
2084 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2085 |
echo "$FC_NAMEMANGLE" > \$@ |
echo "$FC_NAMEMANGLE" > \$@ |
2086 |
|
|
2087 |
# The normal chain of rules is ( .F - .f - .o ) |
BUILD_INFO.h: |
2088 |
.F.f: |
@echo Creating \$@ ... |
2089 |
|
EOF |
2090 |
|
|
2091 |
|
test ! "x$THISVER" = x && echo " -echo \"#define THISVER '$THISVER'\" > \$@" >> $MAKEFILE |
2092 |
|
test ! "x$THISUSER" = x && echo " -echo \"#define THISUSER '$THISUSER'\" >> \$@" >> $MAKEFILE |
2093 |
|
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
2094 |
|
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
2095 |
|
|
2096 |
|
cat >>$MAKEFILE <<EOF |
2097 |
|
|
2098 |
|
# The normal chain of rules is ( .F - .$FS - .o ) |
2099 |
|
|
2100 |
|
## This nullifies any default implicit rules concerning these two file types: |
2101 |
|
## %.o : %.F |
2102 |
|
|
2103 |
|
.F.$FS: |
2104 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2105 |
.f.o: |
.$FS.o: |
2106 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
2107 |
.F90.f90: |
.F90.$FS90: |
2108 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2109 |
.f90.o: |
.$FS90.o: |
2110 |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
2111 |
.c.o: |
.c.o: |
2112 |
\$(CC) \$(CFLAGS) -c \$< |
\$(CC) \$(CFLAGS) -c \$< |
2113 |
|
|
2114 |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
2115 |
.F.p: |
.F.p: |
2116 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2117 |
.p.f: |
.p.$FS: |
2118 |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
2119 |
|
|
2120 |
#========================================= |
#========================================= |
2154 |
|
|
2155 |
# ... AD ... |
# ... AD ... |
2156 |
adall: ad_taf |
adall: ad_taf |
2157 |
adtaf: ad_taf_output.f |
adtaf: ad_taf_output.$FS |
2158 |
adtamc: ad_tamc_output.f |
adtamc: ad_tamc_output.$FS |
2159 |
|
|
2160 |
ad_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2161 |
@$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 |
2162 |
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 |
2163 |
-rm -f ad_config.template |
-rm -f ad_config.template |
2164 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2165 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2166 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS |
2167 |
|
|
2168 |
ad_taf_output.f: ad_input_code.f |
ad_taf_output.$FS: ad_input_code.$FS |
2169 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2170 |
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 |
2171 |
|
|
2172 |
adtafonly: |
adtafonly: |
2173 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2174 |
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 |
2175 |
|
|
2176 |
ad_taf: ad_taf_output.o \$(OBJFILES) |
ad_taf: ad_taf_output.o \$(OBJFILES) |
2177 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
2178 |
|
|
2179 |
ad_tamc_output.f: ad_input_code.f |
ad_tamc_output.$FS: ad_input_code.$FS |
2180 |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS |
2181 |
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 |
2182 |
|
|
2183 |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
2184 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
2185 |
|
|
2186 |
|
adonlyfwd: |
2187 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff |
2188 |
|
|
2189 |
|
adtrick: |
2190 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff |
2191 |
|
|
2192 |
# ... FTL ... |
# ... FTL ... |
2193 |
ftlall: ftl_taf |
ftlall: ftl_taf |
2194 |
ftltaf: ftl_taf_output.f |
ftltaf: ftl_taf_output.$FS |
2195 |
ftltamc: ftl_tamc_output.f |
ftltamc: ftl_tamc_output.$FS |
2196 |
|
|
2197 |
ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2198 |
@$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 |
2199 |
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 |
2200 |
-rm -f ftl_config.template |
-rm -f ftl_config.template |
2201 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2202 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2203 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS |
2204 |
|
|
2205 |
ftl_taf_output.f: ftl_input_code.f |
ftl_taf_output.$FS: ftl_input_code.$FS |
2206 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2207 |
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 |
2208 |
|
|
2209 |
ftltafonly: |
ftltafonly: |
2210 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2211 |
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 |
2212 |
|
|
2213 |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
2214 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
2215 |
|
|
2216 |
ftl_tamc_output.f: ftl_input_code.f |
ftl_tamc_output.$FS: ftl_input_code.$FS |
2217 |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS |
2218 |
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 |
2219 |
|
|
2220 |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
2221 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
2222 |
|
|
2223 |
|
|
2224 |
# ... SVD ... |
# ... SVD ... |
2225 |
svdtaf: ad_taf_output.f ftl_taf_output.f |
svdtaf: ad_taf_output.$FS ftl_taf_output.$FS |
2226 |
svdall: svd_taf |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
2227 |
|
@echo "--->>> Do make svdall afterwards to compile. <<<---" |
2228 |
|
svdall: svd_touch svd_taf |
2229 |
|
|
2230 |
svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES) |
svd_taf: \$(OBJFILES) |
2231 |
\$(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) |
2232 |
|
|
2233 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2234 |
|
@echo "--->>> Assumes you previously <<<---" |
2235 |
|
@echo "--->>> did make svdtaf <<<---" |
2236 |
|
|
2237 |
|
svd_touch: |
2238 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2239 |
|
@echo "--->>> Assumes you previously <<<---" |
2240 |
|
@echo "--->>> did make svdtaf <<<---" |
2241 |
|
touch ad_taf_output.$FS ftl_taf_output.$FS |
2242 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS |
2243 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS |
2244 |
|
@$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 |
2245 |
|
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
2246 |
|
-rm -f ftl_config.template |
2247 |
|
|
2248 |
#========================================= |
#========================================= |
2249 |
|
|
2260 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
2261 |
echo "Error: unable to add file \"$i\" to the exceptions list" |
echo "Error: unable to add file \"$i\" to the exceptions list" |
2262 |
fi |
fi |
2263 |
echo "$base.f: $base.p" >> $MAKEFILE |
echo "$base.$FS: $base.p" >> $MAKEFILE |
2264 |
done |
done |
2265 |
|
|
2266 |
echo " Making list of NOOPTFILES" |
echo " Making list of NOOPTFILES" |
2270 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
2271 |
echo "Error: unable to add file \"$i\" to the exceptions list" |
echo "Error: unable to add file \"$i\" to the exceptions list" |
2272 |
fi |
fi |
2273 |
echo "$base.o: $base.f" >> $MAKEFILE |
echo "$base.o: $base.$FS" >> $MAKEFILE |
2274 |
printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE |
printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE |
2275 |
done |
done |
2276 |
|
|