1 |
#! /usr/bin/env bash |
#! /usr/bin/env bash |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
|
# $Name$ |
5 |
# |
# |
6 |
# Makefile generator for MITgcm UV codes |
# Makefile generator for MITgcm UV codes |
7 |
# created by cnh 03/98 |
# created by cnh 03/98 |
9 |
# modified by aja 01/00 |
# modified by aja 01/00 |
10 |
# rewritten in bash by eh3 08/03 |
# rewritten in bash by eh3 08/03 |
11 |
|
|
12 |
|
# Explain usage |
13 |
|
usage() { |
14 |
|
cat <<EOF |
15 |
|
|
16 |
|
Usage: "$0" [OPTIONS] |
17 |
|
where [OPTIONS] can be: |
18 |
|
|
19 |
|
-help | --help | -h | --h |
20 |
|
Print this help message and exit. |
21 |
|
|
22 |
|
-adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME |
23 |
|
-adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME |
24 |
|
Use "NAME" as the adoptfile. By default, the file at |
25 |
|
"tools/adjoint_options/adjoint_default" will be used. |
26 |
|
|
27 |
|
-nooptfile | --nooptfile |
28 |
|
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
29 |
|
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
30 |
|
Use "NAME" as the optfile. By default, an attempt will be |
31 |
|
made to find an appropriate "standard" optfile in the |
32 |
|
tools/build_options/ directory. |
33 |
|
|
34 |
|
-pdepend NAME | --pdepend NAME |
35 |
|
-pdepend=NAME | --pdepend=NAME |
36 |
|
Get package dependency information from "NAME". |
37 |
|
|
38 |
|
-pgroups NAME | --pgroups NAME |
39 |
|
-pgroups=NAME | --pgroups=NAME |
40 |
|
Get the package groups information from "NAME". |
41 |
|
|
42 |
|
-bash NAME |
43 |
|
Explicitly specify the Bourne or BASH shell to use |
44 |
|
|
45 |
|
-make NAME | -m NAME |
46 |
|
--make=NAME | -m=NAME |
47 |
|
Use "NAME" for the MAKE program. The default is "make" but |
48 |
|
many platforms, "gmake" is the preferred choice. |
49 |
|
|
50 |
|
-makefile NAME | -mf NAME |
51 |
|
--makefile=NAME | -mf=NAME |
52 |
|
Call the makefile "NAME". The default is "Makefile". |
53 |
|
|
54 |
|
-makedepend NAME | -md NAME |
55 |
|
--makedepend=NAME | -md=NAME |
56 |
|
Use "NAME" for the MAKEDEPEND program. |
57 |
|
|
58 |
|
-rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME |
59 |
|
-rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME |
60 |
|
Specify the location of the MITgcm ROOTDIR as "NAME". |
61 |
|
By default, genamke will try to find the location by |
62 |
|
looking in parent directories (up to the 5th parent). |
63 |
|
|
64 |
|
-mods NAME | --mods NAME | -mo NAME | --mo NAME |
65 |
|
-mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME |
66 |
|
Here, "NAME" specifies a list of directories that are |
67 |
|
used for additional source code. Files found in the |
68 |
|
"mods list" are given preference over files of the same |
69 |
|
name found elsewhere. |
70 |
|
|
71 |
|
-disable NAME | --disable NAME |
72 |
|
-disable=NAME | --disable=NAME |
73 |
|
Here "NAME" specifies a list of packages that we don't |
74 |
|
want to use. If this violates package dependencies, |
75 |
|
genamke will exit with an error message. |
76 |
|
|
77 |
|
-enable NAME | --enable NAME |
78 |
|
-enable=NAME | --enable=NAME |
79 |
|
Here "NAME" specifies a list of packages that we wish |
80 |
|
to specifically enable. If this violates package |
81 |
|
dependencies, genamke will exit with an error message. |
82 |
|
|
83 |
|
-standarddirs NAME | --standarddirs NAME |
84 |
|
-standarddirs=NAME | --standarddirs=NAME |
85 |
|
Here, "NAME" specifies a list of directories to be |
86 |
|
used as the "standard" code. |
87 |
|
|
88 |
|
-fortran NAME | --fortran NAME | -fc NAME | --fc NAME |
89 |
|
-fc=NAME | --fc=NAME |
90 |
|
Use "NAME" as the fortran compiler. By default, genmake |
91 |
|
will search for a working compiler by trying a list of |
92 |
|
"usual suspects" such as g77, f77, etc. |
93 |
|
|
94 |
|
-cc NAME | --cc NAME | -cc=NAME | --cc=NAME |
95 |
|
Use "NAME" as the C compiler. By default, genmake |
96 |
|
will search for a working compiler by trying a list of |
97 |
|
"usual suspects" such as gcc, c89, cc, etc. |
98 |
|
|
99 |
|
-[no]ieee | --[no]ieee |
100 |
|
Do or don't use IEEE numerics. Note that this option |
101 |
|
*only* works if it is supported by the OPTFILE that |
102 |
|
is being used. |
103 |
|
|
104 |
|
-use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 |
105 |
|
Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW) |
106 |
|
*only* works if CPP_EEOPTIONS.h allows this. |
107 |
|
|
108 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time |
109 |
|
Ignore all the "wall clock" routines entirely. This will |
110 |
|
not in any way hurt the model results -- it simply means |
111 |
|
that the code that checks how long the model spends in |
112 |
|
various routines will give junk values. |
113 |
|
|
114 |
|
-ts | --ts |
115 |
|
Produce timing information per timestep |
116 |
|
-papis | --papis |
117 |
|
Produce summary MFlop/s (and IPC) with PAPI per timestep |
118 |
|
-pcls | --pcls |
119 |
|
Produce summary MFlop/s etc. with PCL per timestep |
120 |
|
-foolad | --foolad |
121 |
|
Fool the AD code generator |
122 |
|
-papi | --papi |
123 |
|
Performance analysis with PAPI |
124 |
|
-pcl | --pcl |
125 |
|
Performance analysis with PCL |
126 |
|
-hpmt | --hpmt |
127 |
|
Performance analysis with the HPM Toolkit |
128 |
|
|
129 |
|
-gsl | --gsl |
130 |
|
Use GSL to control floating point rounding and precision |
131 |
|
-devel | --devel |
132 |
|
Add additional warning and debugging flags for development |
133 |
|
|
134 |
|
-mpi | --mpi |
135 |
|
Include MPI header files and link to MPI libraries |
136 |
|
-mpi=PATH | --mpi=PATH |
137 |
|
Include MPI header files and link to MPI libraries using MPI_ROOT |
138 |
|
set to PATH. i.e. Include files from \$PATH/include, link to libraries |
139 |
|
from \$PATH/lib and use binaries from \$PATH/bin. |
140 |
|
|
141 |
|
-omp | --omp |
142 |
|
Activate OpenMP code + use Compiler option OMPFLAG |
143 |
|
-omp=OMPFLAG | --omp=OMPFLAG |
144 |
|
Activate OpenMP code + use Compiler option OMPFLAG |
145 |
|
|
146 |
|
-es | --es | -embed-source | --embed-source |
147 |
|
Embed a tarball containing the full source code |
148 |
|
(including the Makefile, etc.) used to build the |
149 |
|
executable [off by default] |
150 |
|
|
151 |
|
-ds | --ds |
152 |
|
Report genmake internal variables status (DUMPSTATE) |
153 |
|
to file "genmake_state" (for debug purpose) |
154 |
|
|
155 |
|
While it is most often a single word, the "NAME" variables specified |
156 |
|
above can in many cases be a space-delimited string such as: |
157 |
|
|
158 |
|
--enable pkg1 --enable 'pkg1 pkg2' --enable 'pkg1 pkg2 pkg3' |
159 |
|
-mods=dir1 -mods='dir1' -mods='dir1 dir2 dir3' |
160 |
|
-foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32' |
161 |
|
|
162 |
|
which, depending upon your shell, may need to be single-quoted. |
163 |
|
|
164 |
|
For more detailed genmake documentation, please see: |
165 |
|
|
166 |
|
http://mitgcm.org/public/devel_HOWTO/ |
167 |
|
|
168 |
|
EOF |
169 |
|
|
170 |
|
exit 1 |
171 |
|
} |
172 |
|
|
173 |
# Search for particular CPP #cmds associated with packages |
# Search for particular CPP #cmds associated with packages |
174 |
# usage: test_for_package_in_cpp_options CPP_file package_name |
# usage: test_for_package_in_cpp_options CPP_file package_name |
175 |
test_for_package_in_cpp_options() { |
test_for_package_in_cpp_options() { |
326 |
return |
return |
327 |
} |
} |
328 |
|
|
|
|
|
329 |
look_for_makedepend() { |
look_for_makedepend() { |
330 |
|
|
331 |
# The "original" makedepend is part of the Imake system that is |
# The "original" makedepend is part of the Imake system that is |
372 |
MAKEDEPEND=makedepend |
MAKEDEPEND=makedepend |
373 |
else |
else |
374 |
echo " a system-default makedepend was not found." |
echo " a system-default makedepend was not found." |
|
|
|
375 |
# Try to build the cyrus implementation |
# Try to build the cyrus implementation |
376 |
build_cyrus_makedepend |
build_cyrus_makedepend |
377 |
RETVAL=$? |
RETVAL=$? |
390 |
fi |
fi |
391 |
} |
} |
392 |
|
|
|
|
|
393 |
build_cyrus_makedepend() { |
build_cyrus_makedepend() { |
394 |
rm -f ./genmake_cy_md |
rm -f ./genmake_cy_md |
395 |
( |
( |
414 |
fi |
fi |
415 |
} |
} |
416 |
|
|
|
|
|
417 |
build_embed_encode() |
build_embed_encode() |
418 |
{ |
{ |
419 |
printf " building the embed-encode utility... " |
printf " building the embed-encode utility... " |
447 |
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
448 |
} |
} |
449 |
|
|
|
|
|
450 |
# look for possible C compilers |
# look for possible C compilers |
451 |
look_for_C_compilers() { |
look_for_C_compilers() { |
452 |
echo >> $LOGFILE |
echo >> $LOGFILE |
495 |
# Guess possible config options for this host |
# Guess possible config options for this host |
496 |
find_possible_optfile() { |
find_possible_optfile() { |
497 |
|
|
498 |
|
echo >> $LOGFILE |
499 |
|
echo "running: find_possible_optfile()" >> $LOGFILE |
500 |
tmp1=`uname`"_"`uname -m` |
tmp1=`uname`"_"`uname -m` |
501 |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
502 |
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
506 |
PLATFORM=$tmp3 |
PLATFORM=$tmp3 |
507 |
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
508 |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
509 |
echo " The platform appears to be: $PLATFORM" |
echo " The platform appears to be: $PLATFORM" | tee -a $LOGFILE |
|
|
|
|
# echo "test" > test |
|
|
# ln -s ./test link |
|
|
# RETVAL=$? |
|
|
# if test "x${RETVAL}" = x0 ; then |
|
|
# LN="ln -s" |
|
|
# else |
|
|
# echo "Error: \"ln -s\" does not appear to work on this system!" |
|
|
# echo " For help, please contact <MITgcm-support@mitgcm.org>." |
|
|
# exit 1 |
|
|
# fi |
|
|
# rm -f test link |
|
|
# |
|
|
# if test "x$CPP" = x ; then |
|
|
# CPP="cpp -traditional -P" |
|
|
# fi |
|
|
# |
|
|
# look_for_makedepend |
|
|
# |
|
|
# look_for_C_compilers |
|
510 |
|
|
511 |
#================================================================ |
#================================================================ |
512 |
# look for possible FORTRAN compilers |
# look for possible FORTRAN compilers |
513 |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 gfortran g95" |
echo " look for possible FORTRAN compilers" >> $LOGFILE |
514 |
|
tmp="$MITGCM_FC $FC efc gfortran g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 g95" |
515 |
p_FC= |
p_FC= |
516 |
for c in $tmp ; do |
rm -f ./genmake_hello.f |
517 |
rm -f ./hello.f ./hello |
cat >> genmake_hello.f <<EOF |
|
cat >> hello.f <<EOF |
|
518 |
program hello |
program hello |
519 |
do i=1,3 |
do i=1,3 |
520 |
print *, 'hello world : ', i |
print *, 'hello world : ', i |
521 |
enddo |
enddo |
522 |
end |
end |
523 |
EOF |
EOF |
524 |
$c -o hello hello.f > /dev/null 2>&1 |
for f in $tmp ; do |
525 |
|
COMM="$f -o genmake_hello genmake_hello.f" |
526 |
|
echo $COMM >> $LOGFILE |
527 |
|
$COMM >> $LOGFILE 2>&1 |
528 |
RETVAL=$? |
RETVAL=$? |
529 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
530 |
p_FC="$p_FC $c" |
echo " $f test successful" >> $LOGFILE |
531 |
|
p_FC="$p_FC $f" |
532 |
fi |
fi |
533 |
done |
done |
534 |
rm -f ./hello.f ./hello |
rm -f ./genmake_hello.f ./genmake_hello |
535 |
if test "x${p_FC}" = x ; then |
if test "x${p_FC}" = x ; then |
536 |
cat 1>&2 <<EOF |
cat 1>&2 <<EOF |
537 |
|
|
544 |
EOF |
EOF |
545 |
exit 1 |
exit 1 |
546 |
else |
else |
547 |
echo " The possible FORTRAN compilers found in your path are:" |
echo " The possible FORTRAN compilers found in your path are: $p_FC" | tee -a $LOGFILE |
|
echo " "$p_FC |
|
548 |
fi |
fi |
549 |
|
|
550 |
# Use the first of the compilers found in the current PATH |
# Use the first of the compilers found in the current PATH |
553 |
for i in $p_FC ; do |
for i in $p_FC ; do |
554 |
OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
555 |
if test -r $OPTFILE ; then |
if test -r $OPTFILE ; then |
556 |
echo " Setting OPTFILE to: "$OPTFILE |
echo " Setting OPTFILE to: "$OPTFILE | tee -a $LOGFILE |
557 |
break |
break |
558 |
fi |
fi |
559 |
done |
done |
610 |
# fi |
# fi |
611 |
# rm -f test.f out |
# rm -f test.f out |
612 |
# fi |
# fi |
|
|
|
613 |
} |
} |
614 |
|
|
615 |
# Parse the package dependency information |
# Parse the package dependency information |
627 |
fi |
fi |
628 |
. ./.pd_tmp |
. ./.pd_tmp |
629 |
rm -f ./.pd_tmp |
rm -f ./.pd_tmp |
|
|
|
|
} |
|
|
|
|
|
|
|
|
# Explain usage |
|
|
usage() { |
|
|
cat <<EOF |
|
|
|
|
|
Usage: "$0" [OPTIONS] |
|
|
where [OPTIONS] can be: |
|
|
|
|
|
-help | --help | -h | --h |
|
|
Print this help message and exit. |
|
|
|
|
|
-adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME |
|
|
-adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME |
|
|
Use "NAME" as the adoptfile. By default, the file at |
|
|
"tools/adjoint_options/adjoint_default" will be used. |
|
|
|
|
|
-nooptfile | --nooptfile |
|
|
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
|
|
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
|
|
Use "NAME" as the optfile. By default, an attempt will be |
|
|
made to find an appropriate "standard" optfile in the |
|
|
tools/build_options/ directory. |
|
|
|
|
|
-pdepend NAME | --pdepend NAME |
|
|
-pdepend=NAME | --pdepend=NAME |
|
|
Get package dependency information from "NAME". |
|
|
|
|
|
-pgroups NAME | --pgroups NAME |
|
|
-pgroups=NAME | --pgroups=NAME |
|
|
Get the package groups information from "NAME". |
|
|
|
|
|
-bash NAME |
|
|
Explicitly specify the Bourne or BASH shell to use |
|
|
|
|
|
-make NAME | -m NAME |
|
|
--make=NAME | -m=NAME |
|
|
Use "NAME" for the MAKE program. The default is "make" but |
|
|
many platforms, "gmake" is the preferred choice. |
|
|
|
|
|
-makefile NAME | -mf NAME |
|
|
--makefile=NAME | -mf=NAME |
|
|
Call the makefile "NAME". The default is "Makefile". |
|
|
|
|
|
-makedepend NAME | -md NAME |
|
|
--makedepend=NAME | -md=NAME |
|
|
Use "NAME" for the MAKEDEPEND program. |
|
|
|
|
|
-rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME |
|
|
-rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME |
|
|
Specify the location of the MITgcm ROOTDIR as "NAME". |
|
|
By default, genamke will try to find the location by |
|
|
looking in parent directories (up to the 5th parent). |
|
|
|
|
|
-mods NAME | --mods NAME | -mo NAME | --mo NAME |
|
|
-mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME |
|
|
Here, "NAME" specifies a list of directories that are |
|
|
used for additional source code. Files found in the |
|
|
"mods list" are given preference over files of the same |
|
|
name found elsewhere. |
|
|
|
|
|
-disable NAME | --disable NAME |
|
|
-disable=NAME | --disable=NAME |
|
|
Here "NAME" specifies a list of packages that we don't |
|
|
want to use. If this violates package dependencies, |
|
|
genamke will exit with an error message. |
|
|
|
|
|
-enable NAME | --enable NAME |
|
|
-enable=NAME | --enable=NAME |
|
|
Here "NAME" specifies a list of packages that we wish |
|
|
to specifically enable. If this violates package |
|
|
dependencies, genamke will exit with an error message. |
|
|
|
|
|
-standarddirs NAME | --standarddirs NAME |
|
|
-standarddirs=NAME | --standarddirs=NAME |
|
|
Here, "NAME" specifies a list of directories to be |
|
|
used as the "standard" code. |
|
|
|
|
|
-fortran NAME | --fortran NAME | -fc NAME | --fc NAME |
|
|
-fc=NAME | --fc=NAME |
|
|
Use "NAME" as the fortran compiler. By default, genmake |
|
|
will search for a working compiler by trying a list of |
|
|
"usual suspects" such as g77, f77, etc. |
|
|
|
|
|
-cc NAME | --cc NAME | -cc=NAME | --cc=NAME |
|
|
Use "NAME" as the C compiler. By default, genmake |
|
|
will search for a working compiler by trying a list of |
|
|
"usual suspects" such as gcc, c89, cc, etc. |
|
|
|
|
|
-[no]ieee | --[no]ieee |
|
|
Do or don't use IEEE numerics. Note that this option |
|
|
*only* works if it is supported by the OPTFILE that |
|
|
is being used. |
|
|
|
|
|
-use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 |
|
|
Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW) |
|
|
*only* works if CPP_EEOPTIONS.h allows this. |
|
|
|
|
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time |
|
|
Ignore all the "wall clock" routines entirely. This will |
|
|
not in any way hurt the model results -- it simply means |
|
|
that the code that checks how long the model spends in |
|
|
various routines will give junk values. |
|
|
|
|
|
-ts | --ts |
|
|
Produce timing information per timestep |
|
|
-papis | --papis |
|
|
Produce summary MFlop/s (and IPC) with PAPI per timestep |
|
|
-pcls | --pcls |
|
|
Produce summary MFlop/s etc. with PCL per timestep |
|
|
-foolad | --foolad |
|
|
Fool the AD code generator |
|
|
-papi | --papi |
|
|
Performance analysis with PAPI |
|
|
-pcl | --pcl |
|
|
Performance analysis with PCL |
|
|
-hpmt | --hpmt |
|
|
Performance analysis with the HPM Toolkit |
|
|
|
|
|
-gsl | --gsl |
|
|
Use GSL to control floating point rounding and precision |
|
|
-devel | --devel |
|
|
Add additional warning and debugging flags for development |
|
|
|
|
|
-mpi | --mpi |
|
|
Include MPI header files and link to MPI libraries |
|
|
-mpi=PATH | --mpi=PATH |
|
|
Include MPI header files and link to MPI libraries using MPI_ROOT |
|
|
set to PATH. i.e. Include files from \$PATH/include, link to libraries |
|
|
from \$PATH/lib and use binaries from \$PATH/bin. |
|
|
|
|
|
-omp | --omp |
|
|
Activate OpenMP code + use Compiler option OMPFLAG |
|
|
-omp=OMPFLAG | --omp=OMPFLAG |
|
|
Activate OpenMP code + use Compiler option OMPFLAG |
|
|
|
|
|
-es | --es | -embed-source | --embed-source |
|
|
Embed a tarball containing the full source code |
|
|
(including the Makefile, etc.) used to build the |
|
|
executable [off by default] |
|
|
|
|
|
While it is most often a single word, the "NAME" variables specified |
|
|
above can in many cases be a space-delimited string such as: |
|
|
|
|
|
--enable pkg1 --enable 'pkg1 pkg2' --enable 'pkg1 pkg2 pkg3' |
|
|
-mods=dir1 -mods='dir1' -mods='dir1 dir2 dir3' |
|
|
-foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32' |
|
|
|
|
|
which, depending upon your shell, may need to be single-quoted. |
|
|
|
|
|
For more detailed genmake documentation, please see: |
|
|
|
|
|
http://mitgcm.org/public/devel_HOWTO/ |
|
|
|
|
|
EOF |
|
|
|
|
|
exit 1 |
|
630 |
} |
} |
631 |
|
|
632 |
# Build a CPP macro to automate calling C routines from FORTRAN |
# Build a CPP macro to automate calling C routines from FORTRAN |
643 |
cat > genmake_test.c <<EOF |
cat > genmake_test.c <<EOF |
644 |
void tcall( char * string ) { tsub( string ); } |
void tcall( char * string ) { tsub( string ); } |
645 |
EOF |
EOF |
|
# $MAKE genmake_test.o >> $LOGFILE 2>&1 |
|
646 |
COMM="$CC $CFLAGS -c genmake_test.c" |
COMM="$CC $CFLAGS -c genmake_test.c" |
647 |
echo ' '$COMM >> $LOGFILE |
echo ' '$COMM >> $LOGFILE |
648 |
$COMM >> $LOGFILE 2>&1 |
$COMM >> $LOGFILE 2>&1 |
727 |
echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE |
echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE |
728 |
} |
} |
729 |
|
|
|
|
|
730 |
check_HAVE_CLOC() { |
check_HAVE_CLOC() { |
731 |
echo >> $LOGFILE |
echo >> $LOGFILE |
732 |
echo "running: check_HAVE_CLOC()" >> $LOGFILE |
echo "running: check_HAVE_CLOC()" >> $LOGFILE |
772 |
echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE |
echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE |
773 |
} |
} |
774 |
|
|
|
|
|
775 |
check_HAVE_SIGREG() { |
check_HAVE_SIGREG() { |
776 |
if test ! "x$HAVE_SIGREG" = x ; then |
if test ! "x$HAVE_SIGREG" = x ; then |
777 |
return |
return |
834 |
echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE |
echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE |
835 |
} |
} |
836 |
|
|
|
|
|
837 |
check_HAVE_SETRLSTK() { |
check_HAVE_SETRLSTK() { |
838 |
if test "x$HAVE_SETRLSTK" = xt ; then |
if test "x$HAVE_SETRLSTK" = xt ; then |
839 |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
882 |
echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE |
echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE |
883 |
} |
} |
884 |
|
|
|
|
|
885 |
check_HAVE_STAT() { |
check_HAVE_STAT() { |
886 |
echo >> $LOGFILE |
echo >> $LOGFILE |
887 |
echo "running: check_HAVE_STAT()" >> $LOGFILE |
echo "running: check_HAVE_STAT()" >> $LOGFILE |
929 |
echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE |
echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE |
930 |
} |
} |
931 |
|
|
|
|
|
932 |
check_netcdf_libs() { |
check_netcdf_libs() { |
933 |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
934 |
return |
return |
1022 |
} |
} |
1023 |
|
|
1024 |
|
|
|
|
|
1025 |
############################################################################### |
############################################################################### |
1026 |
# Sequential part of script starts here |
# Sequential part of script starts here |
1027 |
############################################################################### |
############################################################################### |
1132 |
|
|
1133 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
1134 |
gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS MAKEFILE MAKEDEPEND PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS MAKEFILE MAKEDEPEND PLATFORM ROOTDIR MODS DISABLE ENABLE" |
1135 |
gm_s2="FC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS" |
gm_s2="FC CC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS" |
1136 |
|
|
1137 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
1138 |
gm_s3="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM FEXTRAFLAGS" |
gm_s3="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM FEXTRAFLAGS" |
1370 |
|
|
1371 |
done |
done |
1372 |
|
|
|
|
|
1373 |
if test -f ./.genmakerc ; then |
if test -f ./.genmakerc ; then |
1374 |
echo |
echo |
1375 |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" |
1501 |
|
|
1502 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
1503 |
look_for_C_compilers |
look_for_C_compilers |
|
# CC=cc |
|
|
# cat <<EOF 1>&2 |
|
|
# Error: no C compiler: please specify using one of the following: |
|
|
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
|
|
# 2) the "-cc=XXX" command-line option |
|
|
# 3) the "./genmake_local" file |
|
|
# EOF |
|
|
# exit 1 |
|
1504 |
fi |
fi |
1505 |
|
|
1506 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1787 |
ENABLE="$ENABLE embed_files" |
ENABLE="$ENABLE embed_files" |
1788 |
fi |
fi |
1789 |
|
|
|
|
|
1790 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1791 |
printf " Adding MODS directories: " |
printf " Adding MODS directories: " |
1792 |
for d in $MODS ; do |
for d in $MODS ; do |
2690 |
Clean: |
Clean: |
2691 |
@make clean |
@make clean |
2692 |
@make cleanlinks |
@make cleanlinks |
2693 |
-rm -f \$(SPECIAL_FILES) f90mkdepend.log |
-rm -f \$(SPECIAL_FILES) f90mkdepend.log $MAKEFILE.old |
2694 |
-rm -f taf_command taf_output taf_ad.log taf_ad_flow.log |
-rm -f taf_command taf_output taf_ad.log taf_ad_flow.log |
2695 |
-rm -f genmake_warnings genmake_errors make.log |
-rm -f genmake_warnings genmake_errors make.log |
2696 |
|
|
2698 |
# and output from a run (plus log files from testreport) |
# and output from a run (plus log files from testreport) |
2699 |
CLEAN: |
CLEAN: |
2700 |
@make Clean |
@make Clean |
2701 |
-rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak $MAKEFILE.old |
-rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak |
2702 |
-rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log |
-rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log |
2703 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
2704 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
2762 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2763 |
.$FS.o: |
.$FS.o: |
2764 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
2765 |
|
.F.o: |
2766 |
|
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
2767 |
.F90.$FS90: |
.F90.$FS90: |
2768 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
2769 |
.FF90.f$FS90: |
.FF90.f$FS90: |
2898 |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
ftl_tamc: ftl_tamc_output.o \$(OBJFILES) |
2899 |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
\$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) |
2900 |
|
|
|
|
|
2901 |
# ... SVD ... |
# ... SVD ... |
2902 |
svdtaf: ad_taf_output.$FS ftl_taf_output.$FS |
svdtaf: ad_taf_output.$FS ftl_taf_output.$FS |
2903 |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
@echo "--->>> Only ran TAF to generate SVD code! <<<---" |
3221 |
$BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h |
$BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h |
3222 |
fi |
fi |
3223 |
|
|
|
|
|
3224 |
# Write the "state" for future records |
# Write the "state" for future records |
3225 |
if test "x$DUMPSTATE" = xt ; then |
if test "x$DUMPSTATE" = xt ; then |
3226 |
printf "" > genmake_state |
printf "" > genmake_state |