122 |
stop |
stop |
123 |
end |
end |
124 |
EOF |
EOF |
125 |
test -e Makefile && mv -f Makefile Makefile.bak |
test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" |
126 |
cat <<EOF >> Makefile |
cat <<EOF >> $MAKEFILE |
|
%.$tfs : %.F |
|
127 |
.SUFFIXES: |
.SUFFIXES: |
128 |
genmake_hello.$tfs: genmake_hello.F |
.SUFFIXES: .$tfs .F |
129 |
$LN genmake_hello.F genmake_hello.$tfs |
.F.$tfs: |
130 |
|
$LN \$< \$@ |
131 |
EOF |
EOF |
132 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
133 |
RETVAL=$? |
RETVAL=$? |
134 |
if test "x$RETVAL" != x0 -o ! -e "genmake_hello."$tfs ; then |
if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then |
135 |
if test "x$FS" = x ; then |
if test "x$FS" = x ; then |
136 |
FS='for' |
FS='for' |
137 |
FS90='fr9' |
FS90='fr9' |
148 |
return |
return |
149 |
fi |
fi |
150 |
fi |
fi |
151 |
rm -f genmake_hello.* Makefile |
rm -f genmake_hello.* $MAKEFILE |
152 |
test -e Makefile && mv -f Makefile.bak Makefile |
test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE |
153 |
|
|
154 |
# If we make it here, use the extensions |
# If we make it here, use the extensions |
155 |
FS=$tfs |
FS=$tfs |
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 |
|
|
252 |
|
build_embed_encode() |
253 |
|
{ |
254 |
|
printf " building the embed-encode utility... " |
255 |
|
if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then |
256 |
|
if test ! -d "$ROOTDIR/tools/embed_encode" ; then |
257 |
|
echo |
258 |
|
echo " Error: can't locate \"$ROOTDIR/tools/embed_encode\"" |
259 |
|
echo |
260 |
|
EMBED_SRC=f |
261 |
|
return 1 |
262 |
|
fi |
263 |
|
clist="cc gcc c89 $CC" |
264 |
|
for ic in $clist ; do |
265 |
|
comm="$ic -o encode_files encode_files.c" |
266 |
|
( cd $ROOTDIR/tools/embed_encode && $comm ) > /dev/null 2>&1 |
267 |
|
RETVAL=$? |
268 |
|
if test "x$RETVAL" = x0 ; then |
269 |
|
echo "OK" |
270 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
271 |
|
return 0 |
272 |
|
fi |
273 |
|
done |
274 |
|
echo |
275 |
|
echo " Error: unable to build $ROOTDIR/embed_encode/encode_files" |
276 |
|
echo " so it has been disabled" |
277 |
|
echo |
278 |
|
EMBED_SRC=f |
279 |
|
return 1 |
280 |
|
fi |
281 |
|
echo "OK" |
282 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
# Guess possible config options for this host |
# Guess possible config options for this host |
287 |
find_possible_configs() { |
find_possible_configs() { |
288 |
|
|
313 |
CPP="cpp -traditional -P" |
CPP="cpp -traditional -P" |
314 |
fi |
fi |
315 |
|
|
316 |
# The "original" makedepend is part of the Imake system that is |
look_for_makedepend |
317 |
# most often distributed with XFree86 or with an XFree86 source |
|
318 |
# package. As a result, many machines (eg. generic Linux) do not |
#================================================================ |
319 |
# have a system-default "makedepend" available. For those |
# look for possible C compilers |
320 |
# systems, we have two fall-back options: |
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc" |
321 |
# |
p_CC= |
322 |
# 1) a makedepend implementation shipped with the cyrus-imapd |
for c in $tmp ; do |
323 |
# package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ |
rm -f ./genmake_hello.c ./genmake_hello |
324 |
# |
cat >> genmake_hello.c << EOF |
325 |
# 2) a known-buggy xmakedpend shell script |
#include <stdio.h> |
326 |
# |
int main(int argc, char **argv) { |
327 |
# So the choices are, in order: |
printf("Hello!\n"); |
328 |
# |
return 0; |
329 |
# 1) use the user-specified program |
} |
|
# 2) use a system-wide default |
|
|
# 3) locally build and use the cyrus implementation |
|
|
# 4) fall back to the buggy local xmakedpend script |
|
|
# |
|
|
if test "x${MAKEDEPEND}" = x ; then |
|
|
which makedepend > /dev/null 2>&1 |
|
|
RV0=$? |
|
|
cat <<EOF >> genmake_tc.f |
|
|
program test |
|
|
write(*,*) 'test' |
|
|
stop |
|
|
end |
|
330 |
EOF |
EOF |
331 |
makedepend genmake_tc.f > /dev/null 2>&1 |
$c -o genmake_hello genmake_hello.c > /dev/null 2>&1 |
332 |
RV1=$? |
RETVAL=$? |
333 |
if test ! "x${RV0}${RV1}" = x00 ; then |
if test "x${RETVAL}" = x0 ; then |
334 |
echo " a system-default makedepend was not found." |
p_CC="$p_CC $c" |
335 |
|
fi |
336 |
# Try to build the cyrus impl |
done |
337 |
rm -f ./genmake_cy_md |
rm -f ./genmake_hello.c ./genmake_hello |
338 |
( |
if test "x${p_CC}" = x ; then |
339 |
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
cat 1>&2 <<EOF |
340 |
&& ./configure > /dev/null 2>&1 \ |
|
341 |
&& make > /dev/null 2>&1 |
Error: No C compilers were found in your path. Please specify one using: |
342 |
if test -x ./makedepend.exe ; then |
|
343 |
$LN ./makedepend.exe ./makedepend |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
344 |
fi |
2) the CC or MITGCM_CC environment variables. |
345 |
./makedepend ifparser.c > /dev/null 2>&1 \ |
|
346 |
&& echo "true" |
EOF |
347 |
) > ./genmake_cy_md |
exit 1 |
348 |
grep true ./genmake_cy_md > /dev/null 2>&1 |
else |
349 |
RETVAL=$? |
echo " The possible C compilers found in your path are:" |
350 |
if test "x$RETVAL" = x0 ; then |
echo " "$p_CC |
351 |
MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend' |
if test "x$CC" = x ; then |
352 |
else |
CC=`echo $p_CC | $AWK '{print $1}'` |
353 |
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
echo " Setting C compiler to: "$CC |
354 |
fi |
fi |
|
rm -f ./genmake_cy_md |
|
|
fi |
|
355 |
fi |
fi |
356 |
|
|
357 |
# look for possible fortran compilers |
#================================================================ |
358 |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
# look for possible FORTRAN compilers |
359 |
|
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 gfortran" |
360 |
p_FC= |
p_FC= |
361 |
for c in $tmp ; do |
for c in $tmp ; do |
362 |
rm -f ./hello.f ./hello |
rm -f ./hello.f ./hello |
381 |
|
|
382 |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"), |
383 |
2) a command-line option (eg. "-fc NAME"), or |
2) a command-line option (eg. "-fc NAME"), or |
384 |
3) the MITGCM_FC environment variable. |
3) the FC or MITGCM_FC environment variables. |
385 |
|
|
386 |
EOF |
EOF |
387 |
exit 1 |
exit 1 |
388 |
else |
else |
389 |
echo " The possible FORTRAN compilers found in your path are:" |
echo " The possible FORTRAN compilers found in your path are:" |
390 |
echo " "$p_FC |
echo " "$p_FC |
391 |
if test "x$FC" = x ; then |
fi |
392 |
FC=`echo $p_FC | $AWK '{print $1}'` |
|
393 |
echo " Setting FORTRAN compiler to: "$FC |
# Use the first of the compilers found in the current PATH |
394 |
fi |
# that has a correctly-named optfile |
395 |
|
if test "x$OPTFILE" = x -a "x$FC" = x ; then |
396 |
|
for i in $p_FC ; do |
397 |
|
OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
398 |
|
if test -r $OPTFILE ; then |
399 |
|
echo " Setting OPTFILE to: "$OPTFILE |
400 |
|
break |
401 |
|
fi |
402 |
|
done |
403 |
fi |
fi |
404 |
|
|
405 |
if test "x$OPTFILE" = x ; then |
if test "x$OPTFILE" = x ; then |
491 |
-help | --help | -h | --h |
-help | --help | -h | --h |
492 |
Print this help message and exit. |
Print this help message and exit. |
493 |
|
|
494 |
|
-adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME |
495 |
|
-adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME |
496 |
|
Use "NAME" as the adoptfile. By default, the file at |
497 |
|
"tools/adjoint_options/adjoint_default" will be used. |
498 |
|
|
499 |
-nooptfile | --nooptfile |
-nooptfile | --nooptfile |
500 |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
501 |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
560 |
will search for a working compiler by trying a list of |
will search for a working compiler by trying a list of |
561 |
"usual suspects" such as g77, f77, etc. |
"usual suspects" such as g77, f77, etc. |
562 |
|
|
563 |
|
-cc NAME | --cc NAME | -cc=NAME | --cc=NAME |
564 |
|
Use "NAME" as the C compiler. By default, genmake |
565 |
|
will search for a working compiler by trying a list of |
566 |
|
"usual suspects" such as gcc, c89, cc, etc. |
567 |
|
|
568 |
-[no]ieee | --[no]ieee |
-[no]ieee | --[no]ieee |
569 |
Do or don't use IEEE numerics. Note that this option |
Do or don't use IEEE numerics. Note that this option |
570 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
571 |
is being used. |
is being used. |
572 |
|
|
573 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time |
574 |
|
Ignore all the "wall clock" routines entirely. This will |
575 |
|
not in any way hurt the model results -- it simply means |
576 |
|
that the code that checks how long the model spends in |
577 |
|
various routines will give junk values. |
578 |
|
|
579 |
|
-ts | --ts |
580 |
|
Produce timing information per timestep |
581 |
|
-papis | --papis |
582 |
|
Produce summary MFlop/s with PAPI per timestep |
583 |
|
-foolad | --foolad |
584 |
|
Fool the AD code generator |
585 |
|
-papi | --papi |
586 |
|
Performance analysis with PAPI |
587 |
|
-hpmt | --hpmt |
588 |
|
Performance analysis with the HPM Toolkit |
589 |
|
|
590 |
|
-gsl | --gsl |
591 |
|
Use GSL to control floating point rounding and precision |
592 |
|
|
593 |
-mpi | --mpi |
-mpi | --mpi |
594 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
595 |
-mpi=PATH | --mpi=PATH |
-mpi=PATH | --mpi=PATH |
596 |
Include MPI header files and link to MPI libraries using MPI_ROOT |
Include MPI header files and link to MPI libraries using MPI_ROOT |
597 |
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 |
598 |
from $PATH/lib and use binaries from $PATH/bin. |
from \$PATH/lib and use binaries from \$PATH/bin. |
599 |
|
|
600 |
|
-es | --es | -embed-source | --embed-source |
601 |
|
Embed a tarball containing the full source code |
602 |
|
(including the Makefile, etc.) used to build the |
603 |
|
executable [off by default] |
604 |
|
|
605 |
-bash NAME |
-bash NAME |
606 |
Explicitly specify the Bourne or BASH shell to use |
Explicitly specify the Bourne or BASH shell to use |
625 |
|
|
626 |
# Build a CPP macro to automate calling C routines from FORTRAN |
# Build a CPP macro to automate calling C routines from FORTRAN |
627 |
get_fortran_c_namemangling() { |
get_fortran_c_namemangling() { |
628 |
|
|
629 |
|
#echo "FC_NAMEMANGLE = \"$FC_NAMEMANGLE\"" |
630 |
|
if test ! "x$FC_NAMEMANGLE" = x ; then |
631 |
|
return 0 |
632 |
|
fi |
633 |
|
|
634 |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
635 |
|
|
636 |
cat > genmake_test.c <<EOF |
cat > genmake_test.c <<EOF |
648 |
EOF |
EOF |
649 |
return 1 |
return 1 |
650 |
fi |
fi |
651 |
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` |
652 |
RETVAL=$? |
RETVAL=$? |
653 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
654 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
660 |
EOF |
EOF |
661 |
return 1 |
return 1 |
662 |
fi |
fi |
663 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
664 |
subroutine tcall( string ) |
subroutine tcall( string ) |
665 |
character*(*) string |
character*(*) string |
666 |
call tsub( string ) |
call tsub( string ) |
667 |
end |
end |
668 |
EOF |
EOF |
669 |
$FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1 |
$FC $FFLAGS -c genmake_tcomp.$FS >> genmake_warnings 2>&1 |
670 |
RETVAL=$? |
RETVAL=$? |
671 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
672 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
678 |
EOF |
EOF |
679 |
return 1 |
return 1 |
680 |
fi |
fi |
681 |
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` |
682 |
RETVAL=$? |
RETVAL=$? |
683 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
684 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
732 |
*curtim = *curtim/1.E6; |
*curtim = *curtim/1.E6; |
733 |
} |
} |
734 |
EOF |
EOF |
735 |
make genmake_tc_1.o >> genmake_tc.log 2>&1 |
make genmake_tc_1.o >> genmake_warnings 2>&1 |
736 |
RET_C=$? |
RET_C=$? |
737 |
cat <<EOF > genmake_tc_2.f |
cat <<EOF > genmake_tc_2.$FS |
738 |
program hello |
program hello |
739 |
Real*8 wtime |
REAL*8 wtime |
740 |
external cloc |
external cloc |
741 |
call cloc(wtime) |
call cloc(wtime) |
742 |
print *," HELLO WORLD", wtime |
print *," HELLO WORLD", wtime |
743 |
end program hello |
end |
744 |
EOF |
EOF |
745 |
$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 |
746 |
RET_F=$? |
RET_F=$? |
747 |
test -x ./genmake_tc && ./genmake_tc >> genmake_tc.log 2>&1 |
test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 |
748 |
RETVAL=$? |
RETVAL=$? |
749 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
750 |
HAVE_CLOC=t |
HAVE_CLOC=t |
754 |
} |
} |
755 |
|
|
756 |
|
|
757 |
|
check_HAVE_SIGREG() { |
758 |
|
get_fortran_c_namemangling |
759 |
|
cat <<EOF > genmake_tc_1.c |
760 |
|
$FC_NAMEMANGLE |
761 |
|
#include <stdlib.h> |
762 |
|
#include <stdio.h> |
763 |
|
#include <signal.h> |
764 |
|
#include <errno.h> |
765 |
|
#include <ucontext.h> |
766 |
|
|
767 |
|
int * ip; |
768 |
|
|
769 |
|
static void killhandler( |
770 |
|
unsigned int sn, siginfo_t si, struct ucontext *sc ) |
771 |
|
{ |
772 |
|
*ip = *ip + 1; |
773 |
|
return; |
774 |
|
} |
775 |
|
|
776 |
|
void FC_NAMEMANGLE(sigreg) (int * aip) |
777 |
|
{ |
778 |
|
struct sigaction s; |
779 |
|
ip = aip; |
780 |
|
s.sa_flags = SA_SIGINFO; |
781 |
|
s.sa_sigaction = (void *)killhandler; |
782 |
|
if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) { |
783 |
|
printf("Sigaction returned error = %d\n", errno); |
784 |
|
exit(0); |
785 |
|
} |
786 |
|
return; |
787 |
|
} |
788 |
|
EOF |
789 |
|
make genmake_tc_1.o >> genmake_warnings 2>&1 |
790 |
|
RET_C=$? |
791 |
|
cat <<EOF > genmake_tc_2.$FS |
792 |
|
program hello |
793 |
|
integer anint |
794 |
|
common /iv/ anint |
795 |
|
external sigreg |
796 |
|
call sigreg(anint) |
797 |
|
end |
798 |
|
EOF |
799 |
|
echo >> genmake_warnings |
800 |
|
echo "running: check_HAVE_SIGREG()" >> genmake_warnings |
801 |
|
cat genmake_tc_2.$FS >> genmake_warnings |
802 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
803 |
|
echo $COMM >> genmake_warnings |
804 |
|
$COMM >> genmake_warnings 2>&1 |
805 |
|
RETVAL=$? |
806 |
|
if test "x$RETVAL" = x0 ; then |
807 |
|
HAVE_SIGREG=t |
808 |
|
DEFINES="$DEFINES -DHAVE_SIGREG" |
809 |
|
fi |
810 |
|
rm -f genmake_tc* |
811 |
|
} |
812 |
|
|
813 |
|
|
814 |
|
check_HAVE_SETRLSTK() { |
815 |
|
get_fortran_c_namemangling |
816 |
|
cat <<EOF > genmake_tc_1.c |
817 |
|
$FC_NAMEMANGLE |
818 |
|
#include <sys/time.h> |
819 |
|
#include <sys/resource.h> |
820 |
|
#include <unistd.h> |
821 |
|
void FC_NAMEMANGLE(setrlstk) () |
822 |
|
{ |
823 |
|
struct rlimit rls; |
824 |
|
rls.rlim_cur = RLIM_INFINITY; |
825 |
|
rls.rlim_max = RLIM_INFINITY; |
826 |
|
setrlimit(RLIMIT_STACK, &rls); |
827 |
|
return; |
828 |
|
} |
829 |
|
EOF |
830 |
|
make genmake_tc_1.o >> genmake_warnings 2>&1 |
831 |
|
RET_C=$? |
832 |
|
cat <<EOF > genmake_tc_2.$FS |
833 |
|
program hello |
834 |
|
external setrlstk |
835 |
|
call setrlstk() |
836 |
|
end |
837 |
|
EOF |
838 |
|
echo >> genmake_warnings |
839 |
|
echo "running: check_HAVE_SETRLSTK()" >> genmake_warnings |
840 |
|
cat genmake_tc_2.$FS >> genmake_warnings |
841 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
842 |
|
echo $COMM >> genmake_warnings |
843 |
|
$COMM >> genmake_warnings 2>&1 |
844 |
|
RETVAL=$? |
845 |
|
if test "x$RETVAL" = x0 ; then |
846 |
|
HAVE_SETRLSTK=t |
847 |
|
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
848 |
|
fi |
849 |
|
rm -f genmake_tc* |
850 |
|
} |
851 |
|
|
852 |
|
|
853 |
|
check_HAVE_STAT() { |
854 |
|
get_fortran_c_namemangling |
855 |
|
cat <<EOF > genmake_tc_1.c |
856 |
|
$FC_NAMEMANGLE |
857 |
|
#include <stdio.h> |
858 |
|
#include <stdlib.h> |
859 |
|
#include <unistd.h> |
860 |
|
#include <sys/stat.h> |
861 |
|
#include <sys/types.h> |
862 |
|
void FC_NAMEMANGLE(tfsize) ( int *nbyte ) |
863 |
|
{ |
864 |
|
char name[512]; |
865 |
|
struct stat astat; |
866 |
|
|
867 |
|
name[0] = 'a'; name[1] = '\0'; |
868 |
|
if (! stat(name, &astat)) |
869 |
|
*nbyte = (int)(astat.st_size); |
870 |
|
else |
871 |
|
*nbyte = -1; |
872 |
|
} |
873 |
|
EOF |
874 |
|
make genmake_tc_1.o >> genmake_tc.log 2>&1 |
875 |
|
RET_C=$? |
876 |
|
cat <<EOF > genmake_tc_2.$FS |
877 |
|
program hello |
878 |
|
integer nbyte |
879 |
|
call tfsize(nbyte) |
880 |
|
print *," HELLO WORLD", nbyte |
881 |
|
end |
882 |
|
EOF |
883 |
|
echo >> genmake_warnings |
884 |
|
echo "running: check_HAVE_STAT()" >> genmake_warnings |
885 |
|
cat genmake_tc_2.$FS >> genmake_warnings |
886 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
887 |
|
echo $COMM >> genmake_warnings |
888 |
|
$COMM >> genmake_tc.log 2>&1 |
889 |
|
RETVAL=$? |
890 |
|
if test "x$RETVAL" = x0 ; then |
891 |
|
HAVE_STAT=t |
892 |
|
DEFINES="$DEFINES -DHAVE_STAT" |
893 |
|
fi |
894 |
|
rm -f genmake_tc* |
895 |
|
} |
896 |
|
|
897 |
|
|
898 |
check_netcdf_libs() { |
check_netcdf_libs() { |
899 |
cat <<EOF > genmake_tnc.for |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
900 |
|
return |
901 |
|
fi |
902 |
|
echo >> genmake_warnings |
903 |
|
echo "running: check_netcdf_libs()" >> genmake_warnings |
904 |
|
cat <<EOF > genmake_tnc.F |
905 |
program fgennc |
program fgennc |
906 |
#include "netcdf.inc" |
#include "netcdf.inc" |
907 |
|
EOF |
908 |
|
if test ! "x$MPI" = x ; then |
909 |
|
echo '#include "mpif.h"' >> genmake_tnc.F |
910 |
|
fi |
911 |
|
cat <<EOF >> genmake_tnc.F |
912 |
integer iret, ncid, xid |
integer iret, ncid, xid |
913 |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
914 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
918 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
919 |
end |
end |
920 |
EOF |
EOF |
921 |
$CPP genmake_tnc.for > genmake_tnc.f \ |
echo "=== genmake_tnc.F ===" > genmake_tnc.log |
922 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
cat genmake_tnc.F >> genmake_tnc.log |
923 |
|
echo "=== genmake_tnc.F ===" >> genmake_tnc.log |
924 |
|
RET_CPP=f |
925 |
|
COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F" |
926 |
|
echo "$COMM" >> genmake_tnc.log |
927 |
|
$COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t |
928 |
|
if test "x$RET_CPP" = xf ; then |
929 |
|
echo " WARNING: CPP failed to pre-process the netcdf test." \ |
930 |
|
>> genmake_tnc.log |
931 |
|
echo " Please check that \$INCLUDES is properly set." \ |
932 |
|
>> genmake_tnc.log |
933 |
|
fi |
934 |
|
echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
935 |
|
echo " && $LINK -o genmake_tnc.o $LIBS" >> genmake_tnc.log |
936 |
|
$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
937 |
|
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
938 |
RET_COMPILE=$? |
RET_COMPILE=$? |
939 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
cat genmake_tnc.log >> genmake_warnings |
940 |
RETVAL=$? |
|
941 |
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
#EH3 Remove test program execution for machines that either disallow |
942 |
|
#EH3 execution or cannot support it (eg. cross-compilers) |
943 |
|
#EH3 |
944 |
|
#EH3 test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
945 |
|
#EH3 RETVAL=$? |
946 |
|
#EH3 if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
947 |
|
|
948 |
|
if test "x$RET_COMPILE" = x0 ; then |
949 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
950 |
else |
else |
951 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
952 |
$CPP genmake_tnc.for > genmake_tnc.f \ |
echo "try again with added '-lnetcdf'" > genmake_tnc.log |
953 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
echo "$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS \ " >> genmake_tnc.log |
954 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
955 |
|
echo " && $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log |
956 |
|
$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ |
957 |
|
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
958 |
|
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
959 |
RET_COMPILE=$? |
RET_COMPILE=$? |
960 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
cat genmake_tnc.log >> genmake_warnings |
961 |
RETVAL=$? |
if test "x$RET_COMPILE" = x0 ; then |
|
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
|
962 |
LIBS="$LIBS -lnetcdf" |
LIBS="$LIBS -lnetcdf" |
963 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
|
else |
|
|
cat genmake_tnc.log >> genmake_warnings |
|
964 |
fi |
fi |
965 |
fi |
fi |
966 |
rm -f genmake_tnc* |
rm -f genmake_tnc* |
979 |
LN= |
LN= |
980 |
S64= |
S64= |
981 |
KPP= |
KPP= |
982 |
FC= |
#FC= |
983 |
CPP= |
#CC=gcc |
984 |
|
#CPP= |
985 |
LINK= |
LINK= |
986 |
DEFINES= |
DEFINES= |
987 |
PACKAGES= |
PACKAGES= |
988 |
ENABLE= |
ENABLE= |
989 |
DISABLE= |
DISABLE= |
990 |
MAKEFILE= |
# MAKEFILE= |
991 |
MAKEDEPEND= |
# MAKEDEPEND= |
992 |
PDEPEND= |
PDEPEND= |
993 |
DUMPSTATE=t |
DUMPSTATE=t |
994 |
PDEFAULT= |
PDEFAULT= |
995 |
OPTFILE= |
OPTFILE= |
996 |
INCLUDES="-I." |
INCLUDES="-I. $INCLUDES" |
997 |
FFLAGS= |
FFLAGS= |
998 |
FOPTIM= |
FOPTIM= |
999 |
CFLAGS= |
CFLAGS= |
1006 |
NOOPTFLAGS= |
NOOPTFLAGS= |
1007 |
MPI= |
MPI= |
1008 |
MPIPATH= |
MPIPATH= |
1009 |
|
TS= |
1010 |
|
PAPIS= |
1011 |
|
FOOLAD= |
1012 |
|
PAPI= |
1013 |
|
HPMT= |
1014 |
|
GSL= |
1015 |
|
HAVE_TEST_L= |
1016 |
|
|
1017 |
# DEFINES checked by test compilation |
# DEFINES checked by test compilation or command-line |
1018 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
1019 |
HAVE_FDATE= |
HAVE_FDATE= |
1020 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
1021 |
HAVE_CLOC= |
HAVE_CLOC= |
1022 |
|
HAVE_SETRLSTK= |
1023 |
|
HAVE_STAT= |
1024 |
HAVE_NETCDF= |
HAVE_NETCDF= |
1025 |
|
HAVE_ETIME= |
1026 |
|
IGNORE_TIME= |
1027 |
|
|
1028 |
MODS= |
MODS= |
1029 |
TOOLSDIR= |
TOOLSDIR= |
1034 |
G2ARGS= |
G2ARGS= |
1035 |
BASH= |
BASH= |
1036 |
PWD=`pwd` |
PWD=`pwd` |
1037 |
MAKE=make |
test "x$MAKE" = x && MAKE=make |
1038 |
AWK=awk |
test "x$AWK" = x && AWK=awk |
1039 |
THISHOSTNAME=`hostname` |
EMBED_SRC= |
1040 |
|
THISHOST=`hostname` |
1041 |
THISCWD=`pwd` |
THISCWD=`pwd` |
1042 |
THISDATE=`date` |
THISDATE=`date` |
1043 |
|
THISUSER=`echo $USER` |
1044 |
|
THISVER= |
1045 |
MACHINE=`uname -a` |
MACHINE=`uname -a` |
1046 |
EXECUTABLE= |
EXECUTABLE= |
1047 |
EXEHOOK= |
EXEHOOK= |
1070 |
|
|
1071 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
1072 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
1073 |
gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
gm_s2="FC CPP IEEE TS PAPIS PAPI HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS" |
1074 |
|
|
1075 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
1076 |
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 " |
1077 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
1078 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE" |
1079 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
1080 |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE" |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
1081 |
|
|
1082 |
# The following are all related to adjoint/tangent-linear stuff |
# The following are all related to adjoint/tangent-linear stuff |
1083 |
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" |
1107 |
fi |
fi |
1108 |
done |
done |
1109 |
printf " getting local config information: " |
printf " getting local config information: " |
1110 |
if test -e $gm_local ; then |
if test -f $gm_local ; then |
1111 |
echo "using $gm_local" |
echo "using $gm_local" |
1112 |
. $gm_local |
. $gm_local |
1113 |
# echo "DISABLE=$DISABLE" |
# echo "DISABLE=$DISABLE" |
1116 |
echo "none found" |
echo "none found" |
1117 |
fi |
fi |
1118 |
|
|
1119 |
# echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
#echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
1120 |
#OPTIONS= |
#OPTIONS= |
1121 |
#n=0 |
#n=0 |
1122 |
#for i ; do |
#for i ; do |
1128 |
#done |
#done |
1129 |
#parse_options |
#parse_options |
1130 |
ac_prev= |
ac_prev= |
1131 |
for ac_option ; do |
for ac_option in "$@" ; do |
1132 |
|
|
1133 |
G2ARGS="$G2ARGS \"$ac_option\"" |
G2ARGS="$G2ARGS \"$ac_option\"" |
1134 |
|
|
1224 |
# ac_prev=cpp ;; |
# ac_prev=cpp ;; |
1225 |
# -cpp=* | --cpp=*) |
# -cpp=* | --cpp=*) |
1226 |
# CPP=$ac_optarg ;; |
# CPP=$ac_optarg ;; |
1227 |
|
|
1228 |
|
-cc | --cc) |
1229 |
|
ac_prev=CC ;; |
1230 |
|
-cc=* | --cc=*) |
1231 |
|
CC=$ac_optarg ;; |
1232 |
|
|
1233 |
-fortran | --fortran | -fc | --fc) |
-fortran | --fortran | -fc | --fc) |
1234 |
ac_prev=FC ;; |
ac_prev=FC ;; |
1235 |
-fc=* | --fc=*) |
-fc=* | --fc=*) |
1250 |
-noieee | --noieee) |
-noieee | --noieee) |
1251 |
IEEE= ;; |
IEEE= ;; |
1252 |
|
|
1253 |
|
-ts | --ts) |
1254 |
|
TS=true ;; |
1255 |
|
-papis | --papis) |
1256 |
|
PAPIS=true ;; |
1257 |
|
-foolad | --foolad) |
1258 |
|
FOOLAD=true ;; |
1259 |
|
-papi | --papi) |
1260 |
|
PAPI=true ;; |
1261 |
|
-hpmt | --hpmt) |
1262 |
|
HPMT=true ;; |
1263 |
|
|
1264 |
|
-gsl | --gsl) |
1265 |
|
GSL=true ;; |
1266 |
|
|
1267 |
-mpi | --mpi) |
-mpi | --mpi) |
1268 |
MPI=true ;; |
MPI=true ;; |
1269 |
-mpi=* | --mpi=*) |
-mpi=* | --mpi=*) |
1287 |
ac_prev=TAMC_EXTRA ;; |
ac_prev=TAMC_EXTRA ;; |
1288 |
-tamc_extra=* | --tamc_extra=*) |
-tamc_extra=* | --tamc_extra=*) |
1289 |
TAMC_EXTRA=$ac_optarg ;; |
TAMC_EXTRA=$ac_optarg ;; |
1290 |
|
|
1291 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
1292 |
|
IGNORE_TIME="-DIGNORE_TIME" ;; |
1293 |
|
|
1294 |
|
-es | --es | -embed-source | --embed-source) |
1295 |
|
EMBED_SRC=t ;; |
1296 |
|
|
1297 |
-*) |
-*) |
1298 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
1308 |
|
|
1309 |
done |
done |
1310 |
|
|
1311 |
|
|
1312 |
if test -f ./.genmakerc ; then |
if test -f ./.genmakerc ; then |
1313 |
echo |
echo |
1314 |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
1321 |
echo |
echo |
1322 |
fi |
fi |
1323 |
|
|
1324 |
|
# Find the MITgcm ${ROOTDIR} |
1325 |
if test "x${ROOTDIR}" = x ; then |
if test "x${ROOTDIR}" = x ; then |
1326 |
if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
1327 |
|
if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then |
1328 |
ROOTDIR=".." |
ROOTDIR=".." |
1329 |
else |
else |
1330 |
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
1348 |
exit 1 |
exit 1 |
1349 |
fi |
fi |
1350 |
|
|
1351 |
|
# Find the MITgcm ${THISVER} |
1352 |
|
if test -f "${ROOTDIR}/doc/tag-index" ; then |
1353 |
|
THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1` |
1354 |
|
fi |
1355 |
|
|
1356 |
|
if test "x$MAKEFILE" = x ; then |
1357 |
|
MAKEFILE="Makefile" |
1358 |
|
fi |
1359 |
|
|
1360 |
echo " getting OPTFILE information: " |
echo " getting OPTFILE information: " |
1361 |
if test "x${OPTFILE}" = x ; then |
if test "x${OPTFILE}" = x ; then |
1362 |
if test "x$MITGCM_OF" = x ; then |
if test "x$MITGCM_OF" = x ; then |
1386 |
fi |
fi |
1387 |
fi |
fi |
1388 |
|
|
|
# Check for broken systems that cannot correctly distinguish *.F and *.f files |
|
|
# check_for_broken_Ff |
|
|
|
|
1389 |
echo " getting AD_OPTFILE information: " |
echo " getting AD_OPTFILE information: " |
1390 |
if test "x${AD_OPTFILE}" = x ; then |
if test "x${AD_OPTFILE}" = x ; then |
1391 |
if test "x$MITGCM_AD_OF" = x ; then |
if test "x$MITGCM_AD_OF" = x ; then |
1413 |
fi |
fi |
1414 |
fi |
fi |
1415 |
|
|
1416 |
# Check that FC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
#==================================================================== |
1417 |
|
# Set default values if not set by the optfile |
1418 |
|
# |
1419 |
|
# Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
1420 |
# either set defaults or complain and abort! |
# either set defaults or complain and abort! |
1421 |
if test ! "x$BASH" = x ; then |
if test ! "x$BASH" = x ; then |
1422 |
# 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) |
1432 |
EOF |
EOF |
1433 |
exit 1 |
exit 1 |
1434 |
fi |
fi |
1435 |
|
if test "x$CC" = x ; then |
1436 |
|
CC=cc |
1437 |
|
# cat <<EOF 1>&2 |
1438 |
|
# Error: no C compiler: please specify using one of the following: |
1439 |
|
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
1440 |
|
# 2) the "-cc=XXX" command-line option |
1441 |
|
# 3) the "./genmake_local" file |
1442 |
|
# EOF |
1443 |
|
# exit 1 |
1444 |
|
fi |
1445 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1446 |
LINK=$FC |
LINK=$FC |
1447 |
fi |
fi |
1476 |
else |
else |
1477 |
rm -f test_cpp |
rm -f test_cpp |
1478 |
fi |
fi |
1479 |
if test "x$MAKEDEPEND" = x ; then |
look_for_makedepend |
|
MAKEDEPEND=makedepend |
|
|
fi |
|
1480 |
if test "x$LN" = x ; then |
if test "x$LN" = x ; then |
1481 |
LN="ln -s" |
LN="ln -s" |
1482 |
fi |
fi |
1492 |
EOF |
EOF |
1493 |
exit 1 |
exit 1 |
1494 |
fi |
fi |
1495 |
|
test -L genmake_tlink > /dev/null 2>&1 |
1496 |
|
RETVAL=$? |
1497 |
|
if test "x$RETVAL" = x0 ; then |
1498 |
|
HAVE_TEST_L=t |
1499 |
|
fi |
1500 |
rm -f genmake_test_ln genmake_tlink |
rm -f genmake_test_ln genmake_tlink |
1501 |
|
|
1502 |
# Check for broken *.F/*.f handling and fix if possible |
# Check for broken *.F/*.f handling and fix if possible |
1507 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
1508 |
fi |
fi |
1509 |
|
|
1510 |
|
if test ! "x$TS" = x ; then |
1511 |
|
echo " Turning on timing per timestep" |
1512 |
|
if test ! "x$FOOLAD" = x ; then |
1513 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP" |
1514 |
|
else |
1515 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP" |
1516 |
|
fi |
1517 |
|
fi |
1518 |
|
if test ! "x$PAPIS" = x ; then |
1519 |
|
echo " Turning on PAPI flop summary per timestep" |
1520 |
|
echo " Please make sure PAPIINC, PAPILIB are defined" |
1521 |
|
if test ! "x$FOOLAD" = x ; then |
1522 |
|
DEFINES="$DEFINES -DUSE_PAPI_FLOPS_SFP" |
1523 |
|
else |
1524 |
|
DEFINES="$DEFINES -DUSE_PAPI_FLOPS" |
1525 |
|
fi |
1526 |
|
INCLUDES="$INCLUDES $PAPIINC" |
1527 |
|
LIBS="$LIBS $PAPILIB" |
1528 |
|
fi |
1529 |
|
if test ! "x$PAPI" = x ; then |
1530 |
|
if test ! "x$PAPIS" = x ; then |
1531 |
|
echo " PAPI performance analysis and flop summary per timestep cannot co-exist!" |
1532 |
|
echo " Sticking with PAPI flop summary per timestep!" |
1533 |
|
else |
1534 |
|
echo " Turning on performance analysis with PAPI" |
1535 |
|
echo " Please make sure PAPIINC, PAPILIB are defined" |
1536 |
|
DEFINES="$DEFINES -DUSE_PAPI" |
1537 |
|
INCLUDES="$INCLUDES $PAPIINC" |
1538 |
|
LIBS="$LIBS $PAPILIB" |
1539 |
|
fi |
1540 |
|
fi |
1541 |
|
if test ! "x$HPMT" = x ; then |
1542 |
|
if test ! "x$PAPI" = x ; then |
1543 |
|
echo " PAPI and the HPM Toolkit cannot co-exist!" |
1544 |
|
echo " Sticking with PAPI!" |
1545 |
|
else |
1546 |
|
echo " Turning on performance analysis with the HPM Toolkit" |
1547 |
|
echo " Please make sure HPMTINC, HPMTLIB are defined" |
1548 |
|
DEFINES="$DEFINES -DUSE_LIBHPM" |
1549 |
|
INCLUDES="$INCLUDES $HPMTINC" |
1550 |
|
LIBS="$LIBS $HPMTLIB" |
1551 |
|
fi |
1552 |
|
fi |
1553 |
|
if test ! "x$GSL" = x ; then |
1554 |
|
echo " Turning on use of GSL to control floating point calculations" |
1555 |
|
echo " Please make sure GSLINC, GSLLIB are defined" |
1556 |
|
DEFINES="$DEFINES -DUSE_GSL_IEEE" |
1557 |
|
INCLUDES="$INCLUDES $GSLINC" |
1558 |
|
LIBS="$LIBS $GSLLIB" |
1559 |
|
fi |
1560 |
|
|
1561 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
1562 |
printf " Do we have the system() command using $FC... " |
printf " Do we have the system() command using $FC... " |
1563 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1564 |
program hello |
program hello |
1565 |
call system('echo hi') |
call system('echo hi') |
1566 |
end |
end |
1567 |
EOF |
EOF |
1568 |
$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 |
1569 |
RETVAL=$? |
RETVAL=$? |
1570 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1571 |
HAVE_SYSTEM=t |
HAVE_SYSTEM=t |
1578 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1579 |
|
|
1580 |
printf " Do we have the fdate() command using $FC... " |
printf " Do we have the fdate() command using $FC... " |
1581 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1582 |
program hello |
program hello |
1583 |
CHARACTER(128) string |
CHARACTER*(128) string |
1584 |
string = ' ' |
string = ' ' |
1585 |
call fdate( string ) |
call fdate( string ) |
1586 |
print *, string |
print *, string |
1587 |
end |
end |
1588 |
EOF |
EOF |
1589 |
$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 |
1590 |
RETVAL=$? |
RETVAL=$? |
1591 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1592 |
HAVE_FDATE=t |
HAVE_FDATE=t |
1598 |
fi |
fi |
1599 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1600 |
|
|
1601 |
|
printf " Do we have the etime() command using $FC... " |
1602 |
|
cat > genmake_tcomp.$FS <<EOF |
1603 |
|
program hello |
1604 |
|
REAL*4 ACTUAL, TARRAY(2) |
1605 |
|
EXTERNAL ETIME |
1606 |
|
REAL*4 ETIME |
1607 |
|
actual = etime( tarray ) |
1608 |
|
print *, tarray |
1609 |
|
end |
1610 |
|
EOF |
1611 |
|
$FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1612 |
|
RETVAL=$? |
1613 |
|
if test "x$RETVAL" = x0 ; then |
1614 |
|
HAVE_ETIME=t |
1615 |
|
DEFINES="$DEFINES -DHAVE_ETIME" |
1616 |
|
echo "yes" |
1617 |
|
else |
1618 |
|
HAVE_ETIME= |
1619 |
|
echo "no" |
1620 |
|
fi |
1621 |
|
rm -f genmake_tcomp* |
1622 |
|
|
1623 |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
1624 |
check_HAVE_CLOC |
check_HAVE_CLOC |
1625 |
if test "x$HAVE_CLOC" != x ; then |
if test "x$HAVE_CLOC" != x ; then |
1626 |
echo "yes" |
echo "yes" |
1627 |
else |
else |
1628 |
echo "no" |
echo "no" |
1629 |
|
if test "x$EMBED_SRC" = xt ; then |
1630 |
|
echo " WARNING: you requested file embedding but it has" |
1631 |
|
echo " been disabled since C code cannot be called" |
1632 |
|
EMBED_SRC= |
1633 |
|
fi |
1634 |
|
fi |
1635 |
|
rm -f genmake_t* |
1636 |
|
|
1637 |
|
printf " Can we unlimit the stack size using $FC... " |
1638 |
|
check_HAVE_SETRLSTK |
1639 |
|
if test "x$HAVE_SETRLSTK" != x ; then |
1640 |
|
echo "yes" |
1641 |
|
else |
1642 |
|
echo "no" |
1643 |
|
fi |
1644 |
|
rm -f genmake_t* |
1645 |
|
|
1646 |
|
printf " Can we register a signal handler using $FC... " |
1647 |
|
check_HAVE_SIGREG |
1648 |
|
if test "x$HAVE_SIGREG" != x ; then |
1649 |
|
echo "yes" |
1650 |
|
else |
1651 |
|
echo "no" |
1652 |
|
fi |
1653 |
|
rm -f genmake_t* |
1654 |
|
|
1655 |
|
printf " Can we use stat() through C calls... " |
1656 |
|
check_HAVE_STAT |
1657 |
|
if test "x$HAVE_STAT" != x ; then |
1658 |
|
echo "yes" |
1659 |
|
else |
1660 |
|
echo "no" |
1661 |
fi |
fi |
1662 |
rm -f genmake_t* |
rm -f genmake_t* |
1663 |
|
|
1668 |
else |
else |
1669 |
echo "no" |
echo "no" |
1670 |
fi |
fi |
1671 |
|
DEFINES="$DEFINES $IGNORE_TIME" |
1672 |
|
|
1673 |
|
if test "x$EMBED_SRC" = xt ; then |
1674 |
|
build_embed_encode |
1675 |
|
fi |
1676 |
|
if test "x$EMBED_SRC" = xt ; then |
1677 |
|
ENABLE="$ENABLE embed_files" |
1678 |
|
fi |
1679 |
|
|
1680 |
|
|
1681 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1693 |
done |
done |
1694 |
echo |
echo |
1695 |
|
|
|
if test "x$MAKEFILE" = x ; then |
|
|
MAKEFILE="Makefile" |
|
|
fi |
|
1696 |
if test "x${PLATFORM}" = x ; then |
if test "x${PLATFORM}" = x ; then |
1697 |
PLATFORM=$p_PLATFORM |
PLATFORM=$p_PLATFORM |
1698 |
fi |
fi |
1699 |
|
|
1700 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
1701 |
if test "${PWD##/*/}" = "bin" -a -d ../exe -a $ROOTDIR = .. ; then |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
1702 |
|
if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then |
1703 |
EXEDIR=../exe |
EXEDIR=../exe |
1704 |
else |
else |
1705 |
EXEDIR=. |
EXEDIR=. |
1718 |
exit 1 |
exit 1 |
1719 |
fi |
fi |
1720 |
if test "x$S64" = x ; then |
if test "x$S64" = x ; then |
1721 |
S64='$(TOOLSDIR)/set64bitConst.sh' |
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.sh > /dev/null 2>&1 |
1722 |
|
RETVAL=$? |
1723 |
|
if test "x${RETVAL}" = x0 ; then |
1724 |
|
S64='$(TOOLSDIR)/set64bitConst.sh' |
1725 |
|
else |
1726 |
|
echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.csh > /dev/null 2>&1 |
1727 |
|
RETVAL=$? |
1728 |
|
if test "x${RETVAL}" = x0 ; then |
1729 |
|
S64='$(TOOLSDIR)/set64bitConst.csh' |
1730 |
|
else |
1731 |
|
cat <<EOF |
1732 |
|
|
1733 |
|
ERROR: neither of the two default scripts: |
1734 |
|
|
1735 |
|
${TOOLSDIR}/set64bitConst.sh |
1736 |
|
${TOOLSDIR}/set64bitConst.csh |
1737 |
|
|
1738 |
|
are working so please check paths or specify (with \$S64) a |
1739 |
|
working version of this script. |
1740 |
|
|
1741 |
|
EOF |
1742 |
|
exit 1 |
1743 |
|
fi |
1744 |
|
fi |
1745 |
fi |
fi |
1746 |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'` |
1747 |
|
|
1840 |
PACKAGES="$PACKAGES $i" |
PACKAGES="$PACKAGES $i" |
1841 |
done |
done |
1842 |
echo " before group expansion packages are: $PACKAGES" |
echo " before group expansion packages are: $PACKAGES" |
1843 |
while ! expand_pkg_groups; do echo > /dev/null; done |
RET=1 |
1844 |
|
while test $RET = 1 ; do expand_pkg_groups; RET=$?; done |
1845 |
echo " after group expansion packages are: $PACKAGES" |
echo " after group expansion packages are: $PACKAGES" |
1846 |
fi |
fi |
1847 |
fi |
fi |
1886 |
rm -f ./.tmp_pack |
rm -f ./.tmp_pack |
1887 |
echo " packages are: $PACKAGES" |
echo " packages are: $PACKAGES" |
1888 |
|
|
1889 |
|
# Check availability of NetCDF and then either build the MNC template |
1890 |
|
# files or delete mnc from the list of available packages. |
1891 |
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
1892 |
|
RETVAL=$? |
1893 |
|
if test "x$RETVAL" = x0 ; then |
1894 |
|
if test "x$HAVE_NETCDF" != xt ; then |
1895 |
|
cat <<EOF |
1896 |
|
|
1897 |
|
********************************************************************* |
1898 |
|
WARNING: the "mnc" package was enabled but tests failed to compile |
1899 |
|
NetCDF applications. Please check that: |
1900 |
|
|
1901 |
|
1) NetCDF is correctly installed for this compiler and |
1902 |
|
2) the LIBS variable (within the "optfile") specifies the correct |
1903 |
|
NetCDF library to link against. |
1904 |
|
|
1905 |
|
Due to this failure, the "mnc" package is now DISABLED. |
1906 |
|
********************************************************************* |
1907 |
|
|
1908 |
|
EOF |
1909 |
|
PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'` |
1910 |
|
DISABLE="$DISABLE mnc" |
1911 |
|
else |
1912 |
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1 |
1913 |
|
RETVAL=$? |
1914 |
|
if test "x${RETVAL}" = x0 ; then |
1915 |
|
rm -f make_mnc.errors |
1916 |
|
else |
1917 |
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
1918 |
|
cat make_mnc.errors 1>&2 |
1919 |
|
exit 1 |
1920 |
|
fi |
1921 |
|
fi |
1922 |
|
fi |
1923 |
|
|
1924 |
echo " applying package dependency rules" |
echo " applying package dependency rules" |
1925 |
ck= |
ck= |
1926 |
while test "x$ck" != xtt ; do |
while test "x$ck" != xtt ; do |
1985 |
echo " the dependency rules for \"$dname\"" |
echo " the dependency rules for \"$dname\"" |
1986 |
exit 1 |
exit 1 |
1987 |
fi |
fi |
1988 |
i=$(( $i + 1 )) |
i=`echo "$i + 1" | bc -l` |
1989 |
|
#i=$(( $i + 1 )) |
1990 |
done |
done |
1991 |
ck=$ck"t" |
ck=$ck"t" |
1992 |
done |
done |
2005 |
fi |
fi |
2006 |
done |
done |
2007 |
|
|
|
# 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 |
|
|
|
|
2008 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
2009 |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
2010 |
# 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 |
2024 |
fi |
fi |
2025 |
done |
done |
2026 |
if test "x$has_pack" = xf ; then |
if test "x$has_pack" = xf ; then |
2027 |
undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'` |
undef=`echo "ALLOW_$n" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` |
2028 |
DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef" |
DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef" |
2029 |
fi |
fi |
2030 |
fi |
fi |
2031 |
done |
done |
2032 |
ENABLED_PACKAGES= |
ENABLED_PACKAGES= |
2033 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
2034 |
def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'` |
def=`echo "ALLOW_$i" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` |
2035 |
ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def" |
ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def" |
2036 |
#eh3 DEFINES="$DEFINES -D$def" |
#eh3 DEFINES="$DEFINES -D$def" |
2037 |
|
|
2115 |
cat $i/$j >> ad_files |
cat $i/$j >> ad_files |
2116 |
done |
done |
2117 |
done |
done |
2118 |
|
if test ! "x"$FS = "x.f" ; then |
2119 |
|
cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f |
2120 |
|
mv -f ad_files_f ad_files |
2121 |
|
fi |
2122 |
|
|
2123 |
echo |
echo |
2124 |
echo "=== Creating the Makefile ===" |
echo "=== Creating the Makefile ===" |
2125 |
echo " setting INCLUDES" |
echo " setting INCLUDES" |
2126 |
for i in $INCLUDEDIRS ; do |
for i in $INCLUDEDIRS ; do |
2127 |
if ! test -d $i ; then |
if test ! -d $i ; then |
|
# INCLUDES="$INCLUDES -I$i" |
|
|
# else |
|
2128 |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
echo "Warning: can't find INCLUDEDIRS=\"$i\"" |
2129 |
fi |
fi |
2130 |
done |
done |
2131 |
|
|
2132 |
|
if test ! "x$DIVA" = x ; then |
2133 |
|
echo " Creating the pseudo-MPI include directory" |
2134 |
|
INCLUDES="-I./mpi_headers $INCLUDES" |
2135 |
|
rm -rf ./mpi_headers |
2136 |
|
mkdir -p ./mpi_headers |
2137 |
|
|
2138 |
|
if test "x$MPIINCLUDEDIR" = x ; then |
2139 |
|
if test "x$MPIHOME" = x ; then |
2140 |
|
MPIHOME='/usr' |
2141 |
|
fi |
2142 |
|
MPIINCLUDEDIR='$MPIHOME/include' |
2143 |
|
fi |
2144 |
|
|
2145 |
|
if test -r $MPIINCLUDEDIR/mpif.h ; then |
2146 |
|
for i in $MPI_HEADER_FILES; do |
2147 |
|
cp -p $MPIINCLUDEDIR/$i ./mpi_headers |
2148 |
|
done |
2149 |
|
|
2150 |
|
perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h |
2151 |
|
else |
2152 |
|
echo " We cannot create a copy of mpif.h!" |
2153 |
|
exit -1 |
2154 |
|
fi |
2155 |
|
fi |
2156 |
|
|
2157 |
echo " Determining the list of source and include files" |
echo " Determining the list of source and include files" |
2158 |
rm -rf .links.tmp |
rm -rf .links.tmp |
2159 |
mkdir .links.tmp |
mkdir .links.tmp |
2160 |
|
touch .links.tmp/foo |
2161 |
|
if test ! -r ".links.tmp/foo" ; then |
2162 |
|
echo |
2163 |
|
echo "ERROR : something is wrong with your directory permissions or" |
2164 |
|
echo " your user file-creation mask (\"umask\") since creating a" |
2165 |
|
echo " sub-dir, touch-ing a file within it, and then reading it is" |
2166 |
|
echo " not working. Please try setting your umask to something" |
2167 |
|
echo " sane such as:" |
2168 |
|
echo |
2169 |
|
echo " umask 0002" |
2170 |
|
echo |
2171 |
|
echo " and please verify that you have the proper permissions for" |
2172 |
|
echo " creating sub-directories and then reading files created" |
2173 |
|
echo " within them." |
2174 |
|
echo |
2175 |
|
exit 1 |
2176 |
|
fi |
2177 |
|
rm -f .links.tmp/foo |
2178 |
echo "# This section creates symbolic links" > srclinks.tmp |
echo "# This section creates symbolic links" > srclinks.tmp |
2179 |
echo "" >> srclinks.tmp |
echo "" >> srclinks.tmp |
2180 |
printf 'SRCFILES = ' > srclist.inc |
printf 'SRCFILES = ' > srclist.inc |
2190 |
for sf in $sfiles ; do |
for sf in $sfiles ; do |
2191 |
if test ! -r ".links.tmp/$sf" ; then |
if test ! -r ".links.tmp/$sf" ; then |
2192 |
if test -f "$d/$sf" ; then |
if test -f "$d/$sf" ; then |
2193 |
|
ignore_f=f |
2194 |
case $d/$sf in |
case $d/$sf in |
2195 |
./$PACKAGES_DOT_H) |
./$PACKAGES_DOT_H) |
2196 |
|
ignore_f=t |
2197 |
;; |
;; |
2198 |
./AD_CONFIG.h) |
./AD_CONFIG.h) |
2199 |
|
ignore_f=t |
2200 |
;; |
;; |
2201 |
./FC_NAMEMANGLE.h) |
./FC_NAMEMANGLE.h) |
2202 |
|
ignore_f=t |
2203 |
;; |
;; |
2204 |
*) |
./BUILD_INFO.h) |
2205 |
touch .links.tmp/$sf |
ignore_f=t |
|
deplist="$deplist $sf" |
|
2206 |
;; |
;; |
2207 |
esac |
./EMBEDDED_FILES.h) |
2208 |
extn=`echo $sf | $AWK -F '.' '{print $NF}'` |
ignore_f=t |
|
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 |
|
2209 |
;; |
;; |
2210 |
h) |
*) |
2211 |
echo " \\" >> hlist.inc |
# For the local directory *ONLY*, |
2212 |
printf " $sf" >> hlist.inc |
# ignore all soft-links |
2213 |
;; |
if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then |
2214 |
flow) |
ignore_f=t |
2215 |
echo " \\" >> ad_flow_files.inc |
else |
2216 |
printf " $sf" >> ad_flow_files.inc |
touch .links.tmp/$sf |
2217 |
|
deplist="$deplist $sf" |
2218 |
|
fi |
2219 |
;; |
;; |
2220 |
esac |
esac |
2221 |
|
if test "x$ignore_f" = xf ; then |
2222 |
|
extn=`echo $sf | $AWK -F. '{print $NF}'` |
2223 |
|
case $extn in |
2224 |
|
F) |
2225 |
|
echo " \\" >> srclist.inc |
2226 |
|
printf " $sf" >> srclist.inc |
2227 |
|
;; |
2228 |
|
F90) |
2229 |
|
echo " \\" >> f90srclist.inc |
2230 |
|
printf " $sf" >> f90srclist.inc |
2231 |
|
;; |
2232 |
|
c) |
2233 |
|
echo " \\" >> csrclist.inc |
2234 |
|
printf " $sf" >> csrclist.inc |
2235 |
|
;; |
2236 |
|
h) |
2237 |
|
echo " \\" >> hlist.inc |
2238 |
|
printf " $sf" >> hlist.inc |
2239 |
|
;; |
2240 |
|
flow) |
2241 |
|
echo " \\" >> ad_flow_files.inc |
2242 |
|
printf " $sf" >> ad_flow_files.inc |
2243 |
|
;; |
2244 |
|
esac |
2245 |
|
fi |
2246 |
fi |
fi |
2247 |
fi |
fi |
2248 |
done |
done |
2260 |
echo "" >> hlist.inc |
echo "" >> hlist.inc |
2261 |
echo "" >> ad_flow_files.inc |
echo "" >> ad_flow_files.inc |
2262 |
|
|
2263 |
if test -e $MAKEFILE ; then |
if test -f $MAKEFILE ; then |
2264 |
mv -f $MAKEFILE "$MAKEFILE.bak" |
mv -f $MAKEFILE "$MAKEFILE.bak" |
2265 |
fi |
fi |
2266 |
echo " Writing makefile: $MAKEFILE" |
echo " Writing makefile: $MAKEFILE" |
2271 |
echo "# by the command:" >> $MAKEFILE |
echo "# by the command:" >> $MAKEFILE |
2272 |
echo "# $0 $G2ARGS" >> $MAKEFILE |
echo "# $0 $G2ARGS" >> $MAKEFILE |
2273 |
echo "# executed by:" >> $MAKEFILE |
echo "# executed by:" >> $MAKEFILE |
2274 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
echo "# ${THISUSER}@${THISHOST}:${THISCWD}" >> $MAKEFILE |
2275 |
|
|
2276 |
EXE_AD=$EXECUTABLE"_ad" |
EXE_AD=$EXECUTABLE"_ad" |
2277 |
EXE_FTL=$EXECUTABLE"_ftl" |
EXE_FTL=$EXECUTABLE"_ftl" |
2317 |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
2318 |
|
|
2319 |
# These files are created by Makefile |
# These files are created by Makefile |
2320 |
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 |
|
|
|
2321 |
EOF |
EOF |
2322 |
|
|
2323 |
# Note: figure out some way to add Hyades JAM libraries here |
if test "x$EMBED_SRC" = xt ; then |
2324 |
|
echo "EMBEDDED_FILES = EMBEDDED_FILES.h" >>$MAKEFILE |
2325 |
|
else |
2326 |
|
echo "EMBEDDED_FILES = " >>$MAKEFILE |
2327 |
|
fi |
2328 |
|
|
2329 |
|
# Note: figure out some way to add Hyades JAM libraries here |
2330 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2331 |
# Unix ln (link) |
# Unix ln (link) |
2332 |
LN = ${LN} |
LN = ${LN} |
2340 |
FC = ${FC} |
FC = ${FC} |
2341 |
# Fortran compiler |
# Fortran compiler |
2342 |
F90C = ${F90C} |
F90C = ${F90C} |
2343 |
|
# C compiler |
2344 |
|
CC = ${CC} |
2345 |
# Link editor |
# Link editor |
2346 |
LINK = ${LINK} ${LDADD} |
LINK = ${LINK} ${LDADD} |
2347 |
|
|
2364 |
NOOPTFILES = ${NOOPTFILES} |
NOOPTFILES = ${NOOPTFILES} |
2365 |
NOOPTFLAGS = ${NOOPTFLAGS} |
NOOPTFLAGS = ${NOOPTFLAGS} |
2366 |
# Flags and libraries needed for linking |
# Flags and libraries needed for linking |
2367 |
LIBS = ${LIBS} \$(XLIBS) |
LIBS = ${LIBS} |
2368 |
# Name of the Mekfile |
# Name of the Mekfile |
2369 |
MAKEFILE=${MAKEFILE} |
MAKEFILE=${MAKEFILE} |
2370 |
|
|
2377 |
cat ad_flow_files.inc >> $MAKEFILE |
cat ad_flow_files.inc >> $MAKEFILE |
2378 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2379 |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
2380 |
echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE |
echo 'F90FILES = $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE |
2381 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
2382 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2383 |
echo '.SUFFIXES:' >> $MAKEFILE |
echo '.SUFFIXES:' >> $MAKEFILE |
2384 |
echo '.SUFFIXES: .o .F .p .'$FS' .c .F90 .'$FS90 >> $MAKEFILE |
echo '.SUFFIXES: .o .'$FS' .p .F .c .'$FS90' .F90' >> $MAKEFILE |
2385 |
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 |
2386 |
rm -f ad_flow_files.inc |
rm -f ad_flow_files.inc |
2387 |
|
|
2388 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2389 |
|
|
2390 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
2391 |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) \$(EMBEDDED_FILES) |
2392 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2393 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
2394 |
depend: |
depend: |
2397 |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
2398 |
-rm -f makedepend.out |
-rm -f makedepend.out |
2399 |
|
|
2400 |
|
lib: libmitgcmuv.a |
2401 |
|
|
2402 |
|
libmitgcmuv.a: \$(OBJFILES) |
2403 |
|
ar rcv libmitgcmuv.a \$(OBJFILES) |
2404 |
|
|
2405 |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) |
2406 |
|
|
2407 |
small_f: \$(F77FILES) \$(F90FILES) |
small_f: \$(F77FILES) \$(F90FILES) |
2422 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
2423 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
2424 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
2425 |
-rm -f \$(EXECUTABLE) output.txt |
-rm -f \$(EXECUTABLE) *.txt STD* *diagnostics.log datetime |
2426 |
|
-rm -rf mnc_test_* |
2427 |
|
|
2428 |
#eh3 Makefile: makefile |
#eh3 Makefile: makefile |
2429 |
makefile: |
makefile: |
2431 |
cleanlinks: |
cleanlinks: |
2432 |
-find . -type l -exec rm {} \; |
-find . -type l -exec rm {} \; |
2433 |
|
|
2434 |
# Special targets ($SPECIAL_FILES) which are create by make |
# Special targets (SPECIAL_FILES) which are create by make |
2435 |
${PACKAGES_DOT_H}: |
${PACKAGES_DOT_H}: |
2436 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2437 |
@$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) > \$@ |
2442 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2443 |
echo "$FC_NAMEMANGLE" > \$@ |
echo "$FC_NAMEMANGLE" > \$@ |
2444 |
|
|
2445 |
|
BUILD_INFO.h: |
2446 |
|
@echo Creating \$@ ... |
2447 |
|
EOF |
2448 |
|
|
2449 |
|
test ! "x$THISVER" = x && echo " -echo \"#define THISVER '$THISVER'\" > \$@" >> $MAKEFILE |
2450 |
|
test ! "x$THISUSER" = x && echo " -echo \"#define THISUSER '$THISUSER'\" >> \$@" >> $MAKEFILE |
2451 |
|
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
2452 |
|
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
2453 |
|
|
2454 |
|
if test "x$EMBED_SRC" = xt ; then |
2455 |
|
cat >>$MAKEFILE <<EOF |
2456 |
|
|
2457 |
|
decode_files.o : EMBEDDED_FILES.h |
2458 |
|
|
2459 |
|
## \$(F77FILES) |
2460 |
|
all_fF.tar.gz : \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2461 |
|
@echo Creating \$@ ... |
2462 |
|
-tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2463 |
|
-rm -f all_fF.tar.gz |
2464 |
|
-gzip all_fF.tar |
2465 |
|
|
2466 |
|
EMBEDDED_FILES.h : all_fF.tar.gz |
2467 |
|
@echo Creating \$@ ... |
2468 |
|
-\${ROOTDIR}/tools/embed_encode/encode_files EMBEDDED_FILES.h all_fF.tar.gz |
2469 |
|
|
2470 |
|
EOF |
2471 |
|
fi |
2472 |
|
|
2473 |
|
cat >>$MAKEFILE <<EOF |
2474 |
|
|
2475 |
# The normal chain of rules is ( .F - .$FS - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |
2476 |
|
|
2477 |
%.o : %.F |
## This nullifies any default implicit rules concerning these two file types: |
2478 |
|
## %.o : %.F |
2479 |
|
|
2480 |
.F.$FS: |
.F.$FS: |
2481 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2486 |
.$FS90.o: |
.$FS90.o: |
2487 |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
2488 |
.c.o: |
.c.o: |
2489 |
\$(CC) \$(CFLAGS) -c \$< |
\$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$< |
2490 |
|
|
2491 |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
2492 |
.F.p: |
.F.p: |
2531 |
|
|
2532 |
# ... AD ... |
# ... AD ... |
2533 |
adall: ad_taf |
adall: ad_taf |
2534 |
adtaf: ad_taf_output.f |
adtaf: ad_taf_output.$FS |
2535 |
adtamc: ad_tamc_output.f |
adtamc: ad_tamc_output.$FS |
2536 |
|
|
2537 |
ad_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2538 |
@$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 |
2539 |
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 |
2540 |
-rm -f ad_config.template |
-rm -f ad_config.template |
2541 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2542 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2543 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS |
2544 |
|
|
2545 |
ad_taf_output.f: ad_input_code.f |
ad_taf_output.$FS: ad_input_code.$FS |
2546 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2547 |
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 |
2548 |
|
|
2549 |
adtafonly: |
adtafonly: |
2550 |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f |
\$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS |
2551 |
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 |
2552 |
|
|
2553 |
ad_taf: ad_taf_output.o \$(OBJFILES) |
ad_taf: ad_taf_output.o \$(OBJFILES) |
2554 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
2555 |
|
|
2556 |
ad_tamc_output.f: ad_input_code.f |
ad_tamc_output.$FS: ad_input_code.$FS |
2557 |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f |
\$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS |
2558 |
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 |
2559 |
|
|
2560 |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
ad_tamc: ad_tamc_output.o \$(OBJFILES) |
2561 |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS) |
2562 |
|
|
2563 |
|
adonlyfwd: |
2564 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff |
2565 |
|
|
2566 |
|
adtrick: |
2567 |
|
patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff |
2568 |
|
|
2569 |
# ... FTL ... |
# ... FTL ... |
2570 |
ftlall: ftl_taf |
ftlall: ftl_taf |
2571 |
ftltaf: ftl_taf_output.f |
ftltaf: ftl_taf_output.$FS |
2572 |
ftltamc: ftl_tamc_output.f |
ftltamc: ftl_tamc_output.$FS |
2573 |
|
|
2574 |
ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) |
2575 |
@$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 |
2576 |
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 |
2577 |
-rm -f ftl_config.template |
-rm -f ftl_config.template |
2578 |
@make \$(F77FILES) |
@make \$(F77FILES) |
2579 |
@make \$(AD_FLOW_FILES) |
@make \$(AD_FLOW_FILES) |
2580 |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f |
cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS |
2581 |
|
|
2582 |
ftl_taf_output.f: ftl_input_code.f |
ftl_taf_output.$FS: ftl_input_code.$FS |
2583 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2584 |
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 |
2585 |
|
|
2586 |
ftltafonly: |
ftltafonly: |
2587 |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f |
\$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS |
2588 |
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 |
2589 |
|
|
2590 |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
ftl_taf: ftl_taf_output.o \$(OBJFILES) |
2591 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
2592 |
|
|
2593 |
ftl_tamc_output.f: ftl_input_code.f |
ftl_tamc_output.$FS: ftl_input_code.$FS |
2594 |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f |
\$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS |
2595 |
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 |
2596 |
|
|
2597 |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
2598 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
2599 |
|
|
2600 |
|
|
2601 |
# ... SVD ... |
# ... SVD ... |
2602 |
svdtaf: ad_taf_output.f ftl_taf_output.f |
svdtaf: ad_taf_output.$FS ftl_taf_output.$FS |
2603 |
svdall: svd_taf |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
2604 |
|
@echo "--->>> Do make svdall afterwards to compile. <<<---" |
2605 |
|
svdall: svd_touch svd_taf |
2606 |
|
|
2607 |
svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES) |
svd_taf: \$(OBJFILES) |
2608 |
\$(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) |
2609 |
|
|
2610 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2611 |
|
@echo "--->>> Assumes you previously <<<---" |
2612 |
|
@echo "--->>> did make svdtaf <<<---" |
2613 |
|
|
2614 |
|
svd_touch: |
2615 |
|
@echo "--->>> Only COMPILE svd code! <<<---" |
2616 |
|
@echo "--->>> Assumes you previously <<<---" |
2617 |
|
@echo "--->>> did make svdtaf <<<---" |
2618 |
|
touch ad_taf_output.$FS ftl_taf_output.$FS |
2619 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS |
2620 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS |
2621 |
|
@$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 |
2622 |
|
cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h |
2623 |
|
-rm -f ftl_config.template |
2624 |
|
|
2625 |
#========================================= |
#========================================= |
2626 |
|
|