1 |
#!/bin/sh |
#! /usr/bin/env bash |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
# |
# |
13 |
test_for_package_in_cpp_options() { |
test_for_package_in_cpp_options() { |
14 |
cpp_options=$1 |
cpp_options=$1 |
15 |
pkg=$2 |
pkg=$2 |
16 |
grep -i "#define.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg" || exit 99 |
17 |
RETVAL=$? |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg" || exit 99 |
18 |
if test "x${RETVAL}" = x0 ; then |
test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg" || exit 99 |
19 |
echo "Error: In $cpp_options there is an illegal line: #define ALLOW_$pkg" |
test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg" || exit 99 |
20 |
exit 99 |
} |
21 |
fi |
|
22 |
grep -i "#undef.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1 |
# Search for particular CPP #cmds associated with MPI |
23 |
RETVAL=$? |
# usage: test_for_mpi_in_cpp_eeoptions CPP_file |
24 |
if test "x${RETVAL}" = x0 ; then |
test_for_mpi_in_cpp_eeoptions() { |
25 |
echo "Error: In $cpp_options there is an illegal line: #undef ALLOW_$pkg" |
cpp_options=$1 |
26 |
exit 99 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI" || exit 99 |
27 |
fi |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI" || exit 99 |
28 |
grep -i "#define.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI" || exit 99 |
29 |
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI" || exit 99 |
30 |
|
} |
31 |
|
|
32 |
|
# Search for particular string in a file. Return 1 if detected, 0 if not |
33 |
|
# usage: test_for_string_in_file file string |
34 |
|
test_for_string_in_file() { |
35 |
|
file=$1 |
36 |
|
strng=$2 |
37 |
|
grep -i "$strng" $file > /dev/null 2>&1 |
38 |
RETVAL=$? |
RETVAL=$? |
39 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
40 |
echo "Error: In $cpp_options there is an illegal line: #define DISABLE_$pkg" |
printf "Error: In $file there is an illegal line: " |
41 |
exit 99 |
grep -i "$strng" $file |
42 |
|
return 1 |
43 |
fi |
fi |
44 |
grep -i "#undef.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1 |
return 0 |
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
echo "Error: In $cpp_options there is an illegal line: #undef DISABLE_$pkg" |
|
|
exit 99 |
|
|
fi |
|
45 |
} |
} |
46 |
|
|
47 |
# Read the $ROOTDIR/pkg/pkg_groups file and expand any references to |
# Read the $ROOTDIR/pkg/pkg_groups file and expand any references to |
67 |
done |
done |
68 |
PACKAGES=$new_packages |
PACKAGES=$new_packages |
69 |
rm -f ./p[1,2].tmp |
rm -f ./p[1,2].tmp |
70 |
|
return $matched |
71 |
else |
else |
72 |
echo "Warning: can't read package groups definition file: $PKG_GROUPS" |
echo "Warning: can't read package groups definition file: $PKG_GROUPS" |
73 |
fi |
fi |
79 |
tmp1=`uname`"_"`uname -m` |
tmp1=`uname`"_"`uname -m` |
80 |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
81 |
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
82 |
PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
83 |
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
84 |
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
85 |
|
PLATFORM=$tmp3 |
86 |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
87 |
echo " The platform appears to be: $PLATFORM" |
echo " The platform appears to be: $PLATFORM" |
88 |
|
|
102 |
CPP="cpp -traditional -P" |
CPP="cpp -traditional -P" |
103 |
fi |
fi |
104 |
|
|
105 |
# makedepend is not always available |
# The "original" makedepend is part of the Imake system that is |
106 |
|
# most often distributed with XFree86 or with an XFree86 source |
107 |
|
# package. As a result, many machines (eg. generic Linux) do not |
108 |
|
# have a system-default "makedepend" available. For those |
109 |
|
# systems, we have two fall-back options: |
110 |
|
# |
111 |
|
# 1) a makedepend implementation shipped with the cyrus-imapd |
112 |
|
# package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ |
113 |
|
# |
114 |
|
# 2) a known-buggy xmakedpend shell script |
115 |
|
# |
116 |
|
# So the choices are, in order: |
117 |
|
# |
118 |
|
# 1) use the user-specified program |
119 |
|
# 2) use a system-wide default |
120 |
|
# 3) locally build and use the cyrus implementation |
121 |
|
# 4) fall back to the buggy local xmakedpend script |
122 |
|
# |
123 |
if test "x${MAKEDEPEND}" = x ; then |
if test "x${MAKEDEPEND}" = x ; then |
124 |
which makedepend >& /dev/null |
which makedepend > /dev/null 2>&1 |
125 |
RETVAL=$? |
RETVAL=$? |
126 |
if test "x${RETVAL}" = x1 ; then |
if test ! "x${RETVAL}" = x0 ; then |
127 |
echo " makedepend was not found. Using xmakedpend instead." |
echo " a system-default makedepend was not found." |
128 |
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
|
129 |
|
# Try to build the cyrus impl |
130 |
|
rm -f ./genmake_cy_md |
131 |
|
( |
132 |
|
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
133 |
|
&& ./configure > /dev/null 2>&1 \ |
134 |
|
&& make > /dev/null 2>&1 \ |
135 |
|
&& ./makedepend ifparser.c > /dev/null 2>&1 \ |
136 |
|
&& echo "true" |
137 |
|
) > ./genmake_cy_md |
138 |
|
grep true ./genmake_cy_md > /dev/null 2>&1 |
139 |
|
RETVAL=$? |
140 |
|
if test "x$RETVAL" = x0 ; then |
141 |
|
MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend' |
142 |
|
else |
143 |
|
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
144 |
|
fi |
145 |
|
rm -f ./genmake_cy_md |
146 |
fi |
fi |
147 |
fi |
fi |
148 |
|
|
181 |
echo " "$p_FC |
echo " "$p_FC |
182 |
if test "x$FC" = x ; then |
if test "x$FC" = x ; then |
183 |
FC=`echo $p_FC | $AWK '{print $1}'` |
FC=`echo $p_FC | $AWK '{print $1}'` |
184 |
|
echo " Setting FORTRAN compiler to: "$FC |
185 |
fi |
fi |
186 |
fi |
fi |
187 |
|
|
188 |
for i in $p_FC ; do |
if test "x$OPTFILE" = x ; then |
189 |
p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC |
190 |
if test -r $p_OF ; then |
if test ! -r $OPTFILE ; then |
191 |
OPTFILE=$p_OF |
echo " I looked for the file "$OPTFILE" but did not find it" |
192 |
echo " The options file: $p_OF" |
fi |
193 |
echo " appears to match so we'll use it." |
fi |
194 |
break |
# echo " The options file: $p_OF" |
195 |
fi |
# echo " appears to match so we'll use it." |
196 |
done |
# for i in $p_FC ; do |
197 |
|
#p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
198 |
|
#if test -r $p_OF ; then |
199 |
|
# OPTFILE=$p_OF |
200 |
|
# echo " The options file: $p_OF" |
201 |
|
# echo " appears to match so we'll use it." |
202 |
|
# break |
203 |
|
#fi |
204 |
|
# done |
205 |
if test "x$OPTFILE" = x ; then |
if test "x$OPTFILE" = x ; then |
206 |
cat 1>&2 <<EOF |
cat 1>&2 <<EOF |
207 |
|
|
260 |
. ./.pd_tmp |
. ./.pd_tmp |
261 |
rm -f ./.pd_tmp |
rm -f ./.pd_tmp |
262 |
|
|
263 |
echo -n "PNAME = "${} |
printf "PNAME = "${} |
264 |
} |
} |
265 |
|
|
266 |
|
|
298 |
--makefile=NAME | -mf=NAME |
--makefile=NAME | -mf=NAME |
299 |
Call the makefile "NAME". The default is "Makefile". |
Call the makefile "NAME". The default is "Makefile". |
300 |
|
|
301 |
|
-makedepend NAME | -md NAME |
302 |
|
--makedepend=NAME | -md=NAME |
303 |
|
Use "NAME" for the MAKEDEPEND program. |
304 |
|
|
305 |
-rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME |
-rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME |
306 |
-rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME |
-rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME |
307 |
Specify the location of the MITgcm ROOTDIR as "NAME". |
Specify the location of the MITgcm ROOTDIR as "NAME". |
343 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
344 |
is being used. |
is being used. |
345 |
|
|
346 |
|
-mpi | --mpi |
347 |
|
Include MPI header files and link to MPI libraries |
348 |
|
-mpi=PATH | --mpi=PATH |
349 |
|
Include MPI header files and link to MPI libraries using MPI_ROOT |
350 |
|
set to PATH. i.e. Include files from $PATH/include, link to libraries |
351 |
|
from $PATH/lib and use binaries from $PATH/bin. |
352 |
|
|
353 |
|
-bash NAME |
354 |
|
Explicitly specify the Bourne or BASH shell to use |
355 |
|
|
356 |
While it is most often a single word, the "NAME" variables specified |
While it is most often a single word, the "NAME" variables specified |
357 |
above can in many cases be a space-delimited string such as: |
above can in many cases be a space-delimited string such as: |
358 |
|
|
496 |
} |
} |
497 |
|
|
498 |
|
|
499 |
|
check_netcdf_libs() { |
500 |
|
cat <<EOF > genmake_tnc.F |
501 |
|
program fgennc |
502 |
|
#include "netcdf.inc" |
503 |
|
integer iret, ncid, xid |
504 |
|
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
505 |
|
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
506 |
|
iret = nf_def_dim(ncid, 'X', 11, xid) |
507 |
|
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
508 |
|
iret = nf_close(ncid) |
509 |
|
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
510 |
|
end |
511 |
|
EOF |
512 |
|
$CPP genmake_tnc.F > genmake_tnc.f \ |
513 |
|
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
514 |
|
RET_COMPILE=$? |
515 |
|
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
516 |
|
RETVAL=$? |
517 |
|
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
518 |
|
HAVE_NETCDF=t |
519 |
|
else |
520 |
|
# try again with "-lnetcdf" added to the libs |
521 |
|
$CPP genmake_tnc.F > genmake_tnc.f \ |
522 |
|
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
523 |
|
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
524 |
|
RET_COMPILE=$? |
525 |
|
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
526 |
|
RETVAL=$? |
527 |
|
if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then |
528 |
|
LIBS="$LIBS -lnetcdf" |
529 |
|
HAVE_NETCDF=t |
530 |
|
else |
531 |
|
cat genmake_tnc.log >> genmake_warnings |
532 |
|
fi |
533 |
|
fi |
534 |
|
rm -f genmake_tnc* |
535 |
|
} |
536 |
|
|
537 |
|
|
538 |
|
|
539 |
|
############################################################################### |
540 |
|
# Sequential part of script starts here |
541 |
|
############################################################################### |
542 |
|
|
543 |
# Set defaults here |
# Set defaults here |
544 |
COMMANDL="$0 $@" |
COMMANDL="$0 $@" |
545 |
|
|
548 |
S64= |
S64= |
549 |
KPP= |
KPP= |
550 |
FC= |
FC= |
551 |
|
CPP= |
552 |
LINK= |
LINK= |
|
# DEFINES="-DWORDLENGTH=4" |
|
553 |
DEFINES= |
DEFINES= |
554 |
PACKAGES= |
PACKAGES= |
555 |
ENABLE= |
ENABLE= |
566 |
CFLAGS= |
CFLAGS= |
567 |
KFLAGS1= |
KFLAGS1= |
568 |
KFLAGS2= |
KFLAGS2= |
569 |
|
#LDADD= |
570 |
LIBS= |
LIBS= |
571 |
KPPFILES= |
KPPFILES= |
572 |
NOOPTFILES= |
NOOPTFILES= |
573 |
NOOPTFLAGS= |
NOOPTFLAGS= |
574 |
|
MPI= |
575 |
|
MPIPATH= |
576 |
|
|
577 |
# DEFINES checked by test compilation |
# DEFINES checked by test compilation |
578 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
579 |
HAVE_FDATE= |
HAVE_FDATE= |
580 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
581 |
HAVE_CLOC= |
HAVE_CLOC= |
582 |
|
HAVE_NETCDF= |
583 |
|
|
584 |
MODS= |
MODS= |
585 |
TOOLSDIR= |
TOOLSDIR= |
586 |
SOURCEDIRS= |
SOURCEDIRS= |
587 |
INCLUDEDIRS= |
INCLUDEDIRS= |
588 |
STANDARDDIRS= |
STANDARDDIRS="USE_THE_DEFAULT" |
589 |
|
|
590 |
|
G2ARGS= |
591 |
|
BASH= |
592 |
PWD=`pwd` |
PWD=`pwd` |
593 |
MAKE=make |
MAKE=make |
594 |
AWK=awk |
AWK=awk |
621 |
|
|
622 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
623 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
624 |
gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
625 |
|
|
626 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
627 |
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 " |
657 |
break |
break |
658 |
fi |
fi |
659 |
done |
done |
660 |
echo -n " getting local config information: " |
printf " getting local config information: " |
661 |
if test -e $gm_local ; then |
if test -e $gm_local ; then |
662 |
echo "using $gm_local" |
echo "using $gm_local" |
663 |
. $gm_local |
. $gm_local |
681 |
ac_prev= |
ac_prev= |
682 |
for ac_option ; do |
for ac_option ; do |
683 |
|
|
684 |
|
G2ARGS="$G2ARGS \"$ac_option\"" |
685 |
|
|
686 |
# If the previous option needs an argument, assign it. |
# If the previous option needs an argument, assign it. |
687 |
if test -n "$ac_prev"; then |
if test -n "$ac_prev"; then |
688 |
eval "$ac_prev=\$ac_option" |
eval "$ac_prev=\$ac_option" |
704 |
-optfile=* | --optfile=* | -of=* | --of=*) |
-optfile=* | --optfile=* | -of=* | --of=*) |
705 |
OPTFILE=$ac_optarg ;; |
OPTFILE=$ac_optarg ;; |
706 |
|
|
707 |
-adoptfile | --adoptfile | -ad | --ad) |
-adoptfile | --adoptfile | -adof | --adof) |
708 |
ac_prev=AD_OPTFILE ;; |
ac_prev=AD_OPTFILE ;; |
709 |
-adoptfile=* | --adoptfile=* | -adof=* | --adof=*) |
-adoptfile=* | --adoptfile=* | -adof=* | --adof=*) |
710 |
AD_OPTFILE=$ac_optarg ;; |
AD_OPTFILE=$ac_optarg ;; |
724 |
-make=* | --make=* | -m=* | --m=*) |
-make=* | --make=* | -m=* | --m=*) |
725 |
MAKE=$ac_optarg ;; |
MAKE=$ac_optarg ;; |
726 |
|
|
727 |
|
-bash | --bash) |
728 |
|
ac_prev=BASH ;; |
729 |
|
-bash=* | --bash=*) |
730 |
|
BASH=$ac_optarg ;; |
731 |
|
|
732 |
|
-makedepend | --makedepend | -md | --md) |
733 |
|
ac_prev=MAKEDEPEND ;; |
734 |
|
-makedepend=* | --makedepend=* | -md=* | --md=*) |
735 |
|
MAKEDEPEND=$ac_optarg ;; |
736 |
|
|
737 |
-makefile | --makefile | -ma | --ma) |
-makefile | --makefile | -ma | --ma) |
738 |
ac_prev=MAKEFILE ;; |
ac_prev=MAKEFILE ;; |
739 |
-makefile=* | --makefile=* | -ma=* | --ma=*) |
-makefile=* | --makefile=* | -ma=* | --ma=*) |
785 |
IEEE=true ;; |
IEEE=true ;; |
786 |
-noieee | --noieee) |
-noieee | --noieee) |
787 |
IEEE= ;; |
IEEE= ;; |
788 |
|
|
789 |
|
-mpi | --mpi) |
790 |
|
MPI=true ;; |
791 |
|
-mpi=* | --mpi=*) |
792 |
|
MPIPATH=$ac_optarg |
793 |
|
MPI=true ;; |
794 |
|
|
795 |
# -jam | --jam) |
# -jam | --jam) |
796 |
# JAM=1 ;; |
# JAM=1 ;; |
843 |
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do |
844 |
if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then |
if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then |
845 |
ROOTDIR=$d |
ROOTDIR=$d |
846 |
echo -n "Warning: ROOTDIR was not specified but there appears to be" |
printf "Warning: ROOTDIR was not specified but there appears to be" |
847 |
echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it." |
echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it." |
848 |
break |
break |
849 |
fi |
fi |
877 |
. "$OPTFILE" |
. "$OPTFILE" |
878 |
RETVAL=$? |
RETVAL=$? |
879 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
880 |
echo -n "Error: failed to source OPTFILE \"$OPTFILE\"" |
printf "Error: failed to source OPTFILE \"$OPTFILE\"" |
881 |
echo "--please check that variable syntax is bash-compatible" |
echo "--please check that variable syntax is bash-compatible" |
882 |
exit 1 |
exit 1 |
883 |
fi |
fi |
904 |
. "$AD_OPTFILE" |
. "$AD_OPTFILE" |
905 |
RETVAL=$? |
RETVAL=$? |
906 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
907 |
echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\"" |
printf "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\"" |
908 |
echo "--please check that variable syntax is bash-compatible" |
echo "--please check that variable syntax is bash-compatible" |
909 |
exit 1 |
exit 1 |
910 |
fi |
fi |
919 |
|
|
920 |
# Check that FC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
# Check that FC, LINK, CPP, S64, LN, and MAKE are defined. If not, |
921 |
# either set defaults or complain and abort! |
# either set defaults or complain and abort! |
922 |
|
if test ! "x$BASH" = x ; then |
923 |
|
# add a trailing space so that it works within the Makefile syntax (see below) |
924 |
|
BASH="$BASH " |
925 |
|
fi |
926 |
if test "x$FC" = x ; then |
if test "x$FC" = x ; then |
927 |
cat <<EOF 1>&2 |
cat <<EOF 1>&2 |
928 |
|
|
936 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
937 |
LINK=$FC |
LINK=$FC |
938 |
fi |
fi |
|
if test "x$CPP" = x ; then |
|
|
CPP="cpp" |
|
|
fi |
|
939 |
if test "x$MAKE" = x ; then |
if test "x$MAKE" = x ; then |
940 |
MAKE="make" |
MAKE="make" |
941 |
fi |
fi |
942 |
|
if test "x$CPP" = x ; then |
943 |
|
CPP=cpp |
944 |
|
fi |
945 |
|
#EH3 === UGLY === |
946 |
|
# The following an ugly little hack to check for $CPP in /lib/ and it |
947 |
|
# should eventually be replaced with a more general function that |
948 |
|
# searches a combo of the user's path and a list of "usual suspects" |
949 |
|
# to find the correct location for binaries such as $CPP. |
950 |
|
for i in " " "/lib/" ; do |
951 |
|
echo "#define A a" | $i$CPP > test_cpp 2>&1 && CPP=$i$CPP |
952 |
|
done |
953 |
|
#EH3 === UGLY === |
954 |
echo "#define A a" | $CPP > test_cpp 2>&1 |
echo "#define A a" | $CPP > test_cpp 2>&1 |
955 |
RETVAL=$? |
RETVAL=$? |
956 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
987 |
fi |
fi |
988 |
rm -f genmake_test_ln genmake_tlink |
rm -f genmake_test_ln genmake_tlink |
989 |
|
|
990 |
|
if test ! "x$MPI" = x ; then |
991 |
|
echo " Turning on MPI cpp macros" |
992 |
|
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
993 |
|
fi |
994 |
|
|
995 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
996 |
echo -n " Do we have the system() command using $FC... " |
printf " Do we have the system() command using $FC... " |
997 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.f <<EOF |
998 |
program hello |
program hello |
999 |
call system('echo hi') |
call system('echo hi') |
1011 |
fi |
fi |
1012 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1013 |
|
|
1014 |
echo -n " Do we have the fdate() command using $FC... " |
printf " Do we have the fdate() command using $FC... " |
1015 |
cat > genmake_tcomp.f <<EOF |
cat > genmake_tcomp.f <<EOF |
1016 |
program hello |
program hello |
1017 |
CHARACTER(128) string |
CHARACTER(128) string |
1032 |
fi |
fi |
1033 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1034 |
|
|
1035 |
echo -n " Can we call simple C routines (here, \"cloc()\") using $FC... " |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
1036 |
check_HAVE_CLOC |
check_HAVE_CLOC |
1037 |
if test "x$HAVE_CLOC" != x ; then |
if test "x$HAVE_CLOC" != x ; then |
1038 |
echo "yes" |
echo "yes" |
1039 |
else |
else |
1040 |
echo "no" |
echo "no" |
1041 |
fi |
fi |
|
echo "$FC_NAMEMANGLE" > FC_NAMEMANGLE.h.template |
|
|
cmp FC_NAMEMANGLE.h FC_NAMEMANGLE.h.template > /dev/null 2>&1 |
|
|
RETVAL=$? |
|
|
if test "x$RETVAL" != x0 ; then |
|
|
mv -f FC_NAMEMANGLE.h.template FC_NAMEMANGLE.h |
|
|
fi |
|
1042 |
rm -f genmake_t* |
rm -f genmake_t* |
1043 |
|
|
1044 |
|
printf " Can we create NetCDF-enabled binaries... " |
1045 |
|
check_netcdf_libs |
1046 |
|
if test "x$HAVE_NETCDF" != x ; then |
1047 |
|
echo "yes" |
1048 |
|
else |
1049 |
|
echo "no" |
1050 |
|
fi |
1051 |
|
|
1052 |
|
|
1053 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1054 |
echo -n " Adding MODS directories: " |
printf " Adding MODS directories: " |
1055 |
for d in $MODS ; do |
for d in $MODS ; do |
1056 |
if test ! -d $d ; then |
if test ! -d $d ; then |
1057 |
echo |
echo |
1058 |
echo "Error: MODS directory \"$d\" not found!" |
echo "Error: MODS directory \"$d\" not found!" |
1059 |
exit 1 |
exit 1 |
1060 |
else |
else |
1061 |
echo -n " $d" |
printf " $d" |
1062 |
SOURCEDIRS="$SOURCEDIRS $d" |
SOURCEDIRS="$SOURCEDIRS $d" |
1063 |
INCLUDEDIRS="$INCLUDEDIRS $d" |
INCLUDEDIRS="$INCLUDEDIRS $d" |
1064 |
fi |
fi |
1088 |
TOOLSDIR="$ROOTDIR/tools" |
TOOLSDIR="$ROOTDIR/tools" |
1089 |
fi |
fi |
1090 |
if test ! -d ${TOOLSDIR} ; then |
if test ! -d ${TOOLSDIR} ; then |
1091 |
echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
echo "Error: the specified TOOLSDIR (\"$TOOLSDIR\") does not exist!" |
1092 |
exit 1 |
exit 1 |
1093 |
fi |
fi |
1094 |
if test "x$S64" = x ; then |
if test "x$S64" = x ; then |
1109 |
rm -f make_eesupp.errors |
rm -f make_eesupp.errors |
1110 |
else |
else |
1111 |
echo "Error: problem encountered while building source files in eesupp:" |
echo "Error: problem encountered while building source files in eesupp:" |
1112 |
cat make_eesupp.errors |
cat make_eesupp.errors 1>&2 |
1113 |
exit 1 |
exit 1 |
1114 |
fi |
fi |
1115 |
fi |
fi |
1116 |
|
|
1117 |
|
#same for exch2 |
1118 |
|
if test -r $ROOTDIR"/pkg/exch2/Makefile" ; then |
1119 |
|
echo " Making source files in exch2 from templates" |
1120 |
|
( cd $ROOTDIR"/pkg/exch2/" && $MAKE ) > make_exch2.errors 2>&1 |
1121 |
|
RETVAL=$? |
1122 |
|
if test "x${RETVAL}" = x0 ; then |
1123 |
|
rm -f make_exch2.errors |
1124 |
|
else |
1125 |
|
echo "Error: problem encountered while building source files in exch2:" |
1126 |
|
cat make_exch2.errors 1>&2 |
1127 |
|
exit 1 |
1128 |
|
fi |
1129 |
|
fi |
1130 |
|
|
1131 |
printf "\n=== Determining package settings ===\n" |
printf "\n=== Determining package settings ===\n" |
1132 |
if test "x${PDEPEND}" = x ; then |
if test "x${PDEPEND}" = x ; then |
1133 |
tmp=$ROOTDIR"/pkg/pkg_depend" |
tmp=$ROOTDIR"/pkg/pkg_depend" |
1183 |
def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'` |
def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'` |
1184 |
RETVAL=$? |
RETVAL=$? |
1185 |
if test "x${RETVAL}" != x0 ; then |
if test "x${RETVAL}" != x0 ; then |
1186 |
echo -n "Error: can't parse default package list " |
printf "Error: can't parse default package list " |
1187 |
echo "-- please check PDEFAULT=\"$PDEFAULT\"" |
echo "-- please check PDEFAULT=\"$PDEFAULT\"" |
1188 |
exit 1 |
exit 1 |
1189 |
fi |
fi |
1191 |
PACKAGES="$PACKAGES $i" |
PACKAGES="$PACKAGES $i" |
1192 |
done |
done |
1193 |
echo " before group expansion packages are: $PACKAGES" |
echo " before group expansion packages are: $PACKAGES" |
1194 |
expand_pkg_groups |
while ! expand_pkg_groups; do echo > /dev/null; done |
1195 |
echo " after group expansion packages are: $PACKAGES" |
echo " after group expansion packages are: $PACKAGES" |
1196 |
fi |
fi |
1197 |
fi |
fi |
1198 |
|
|
1199 |
echo " applying DISABLE settings" |
echo " applying DISABLE settings" |
1200 |
|
for i in $PACKAGES ; do |
1201 |
|
echo $i >> ./.tmp_pack |
1202 |
|
done |
1203 |
|
for i in `grep "-" ./.tmp_pack` ; do |
1204 |
|
j=`echo $i | sed 's/[-]//'` |
1205 |
|
DISABLE="$DISABLE $j" |
1206 |
|
done |
1207 |
pack= |
pack= |
1208 |
for p in $PACKAGES ; do |
for p in $PACKAGES ; do |
1209 |
addit="t" |
addit="t" |
1220 |
echo " applying ENABLE settings" |
echo " applying ENABLE settings" |
1221 |
echo "" > ./.tmp_pack |
echo "" > ./.tmp_pack |
1222 |
PACKAGES="$PACKAGES $ENABLE" |
PACKAGES="$PACKAGES $ENABLE" |
1223 |
|
# Test if each explicitly referenced package exists |
1224 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
1225 |
if test ! -d "$ROOTDIR/pkg/$i" ; then |
j=`echo $i | sed 's/[-+]//'` |
1226 |
|
if test ! -d "$ROOTDIR/pkg/$j" ; then |
1227 |
echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\"" |
echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\"" |
1228 |
exit 1 |
exit 1 |
1229 |
fi |
fi |
1230 |
echo $i >> ./.tmp_pack |
echo $i >> ./.tmp_pack |
1231 |
done |
done |
|
pack=`cat ./.tmp_pack | sort | uniq` |
|
|
rm -f ./.tmp_pack |
|
1232 |
PACKAGES= |
PACKAGES= |
1233 |
for i in $pack ; do |
for i in `grep -v "-" ./.tmp_pack | sort | uniq` ; do |
1234 |
PACKAGES="$PACKAGES $i" |
PACKAGES="$PACKAGES $i" |
1235 |
done |
done |
1236 |
|
rm -f ./.tmp_pack |
1237 |
echo " packages are: $PACKAGES" |
echo " packages are: $PACKAGES" |
1238 |
|
|
1239 |
echo " applying package dependency rules" |
echo " applying package dependency rules" |
1319 |
fi |
fi |
1320 |
done |
done |
1321 |
|
|
1322 |
|
# Build MNC templates and check for ability to build and use NetCDF |
1323 |
|
echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 |
1324 |
|
RETVAL=$? |
1325 |
|
if test "x$RETVAL" = x0 ; then |
1326 |
|
( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1 |
1327 |
|
RETVAL=$? |
1328 |
|
if test "x${RETVAL}" = x0 ; then |
1329 |
|
rm -f make_mnc.errors |
1330 |
|
else |
1331 |
|
echo "Error: problem encountered while building source files in pkg/mnc:" |
1332 |
|
cat make_mnc.errors 1>&2 |
1333 |
|
exit 1 |
1334 |
|
fi |
1335 |
|
if test "x$HAVE_NETCDF" != xt ; then |
1336 |
|
cat <<EOF |
1337 |
|
|
1338 |
|
WARNING: the "mnc" package has been enabled but tests failed to |
1339 |
|
compile and/or execute NetCDF applications. Please check that: |
1340 |
|
|
1341 |
|
1) NetCDF is installed for your compiler and |
1342 |
|
2) the LIBS variable (within the 'optfile") specifies the correct |
1343 |
|
NetCDF library to link against. |
1344 |
|
|
1345 |
|
EOF |
1346 |
|
fi |
1347 |
|
fi |
1348 |
|
|
1349 |
# Create a list of #define and #undef to enable/disable packages |
# Create a list of #define and #undef to enable/disable packages |
1350 |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
PACKAGES_DOT_H=PACKAGES_CONFIG.h |
1379 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
1380 |
case $i in |
case $i in |
1381 |
aim_v23) |
aim_v23) |
|
DEFINES="$DEFINES -DALLOW_AIM" |
|
1382 |
ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM" |
ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM" |
1383 |
echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)" |
echo "Warning: ALLOW_AIM is set to enable aim_v23." |
1384 |
;; |
;; |
1385 |
esac |
esac |
1386 |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
#EH3 WARNING : This is an UGLY HACK that needs to be removed!!! |
1389 |
|
|
1390 |
echo " Adding STANDARDDIRS" |
echo " Adding STANDARDDIRS" |
1391 |
BUILDDIR=${BUILDDIR:-.} |
BUILDDIR=${BUILDDIR:-.} |
1392 |
if test "x$STANDARDDIRS" = x ; then |
if test "x$STANDARDDIRS" = xUSE_THE_DEFAULT ; then |
1393 |
STANDARDDIRS="eesupp model" |
STANDARDDIRS="eesupp model" |
1394 |
fi |
fi |
1395 |
for d in $STANDARDDIRS ; do |
if test "x$STANDARDDIRS" != x ; then |
1396 |
adr="$ROOTDIR/$d/src" |
for d in $STANDARDDIRS ; do |
1397 |
if test ! -d $adr ; then |
adr="$ROOTDIR/$d/src" |
1398 |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
if test ! -d $adr ; then |
1399 |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
1400 |
exit 1 |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
1401 |
else |
exit 1 |
1402 |
SOURCEDIRS="$SOURCEDIRS $adr" |
else |
1403 |
fi |
SOURCEDIRS="$SOURCEDIRS $adr" |
1404 |
adr="$ROOTDIR/$d/inc" |
fi |
1405 |
if test ! -d $adr ; then |
adr="$ROOTDIR/$d/inc" |
1406 |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
if test ! -d $adr ; then |
1407 |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\"" |
1408 |
exit 1 |
echo " is correct and that you correctly specified the STANDARDDIRS option" |
1409 |
else |
exit 1 |
1410 |
INCLUDEDIRS="$INCLUDEDIRS $adr" |
else |
1411 |
fi |
INCLUDEDIRS="$INCLUDEDIRS $adr" |
1412 |
done |
fi |
1413 |
|
done |
1414 |
|
fi |
1415 |
|
|
1416 |
echo " Searching for CPP_OPTIONS.h in order to warn about the presence" |
echo " Searching for *OPTIONS.h files in order to warn about the presence" |
1417 |
echo " of \"#define ALLOW_PKGNAME\"-type statements:" |
echo " of \"#define \"-type statements that are no longer allowed:" |
1418 |
CPP_OPTIONS= |
CPP_OPTIONS= |
1419 |
|
CPP_EEOPTIONS= |
1420 |
spaths=". $INCLUDEDIRS" |
spaths=". $INCLUDEDIRS" |
1421 |
|
names=`ls -1 "$ROOTDIR/pkg"` |
1422 |
for i in $spaths ; do |
for i in $spaths ; do |
1423 |
try="$i/CPP_OPTIONS.h" |
try="$i/CPP_OPTIONS.h" |
1424 |
# echo -n " trying $try : " |
if test -f $try -a -r $try -a "x$CPP_OPTIONS" = x ; then |
|
if test -f $try -a -r $try ; then |
|
1425 |
echo " found CPP_OPTIONS=\"$try\"" |
echo " found CPP_OPTIONS=\"$try\"" |
1426 |
CPP_OPTIONS="$try" |
CPP_OPTIONS="$try" |
1427 |
break |
# New safety test: make sure packages are not mentioned in CPP_OPTIONS.h |
1428 |
|
for n in $names ; do |
1429 |
|
test_for_package_in_cpp_options $CPP_OPTIONS $n |
1430 |
|
done |
1431 |
|
fi |
1432 |
|
try="$i/CPP_EEOPTIONS.h" |
1433 |
|
if test -f $try -a -r $try -a "x$CPP_EEOPTIONS" = x ; then |
1434 |
|
echo " found CPP_EEOPTIONS=\"$try\"" |
1435 |
|
# New safety test: make sure MPI is not determined by CPP_EEOPTIONS.h |
1436 |
|
#**** not yet enabled **** |
1437 |
|
# test_for_mpi_in_cpp_eeoptions $try |
1438 |
|
#**** not yet enabled **** |
1439 |
|
CPP_EEOPTIONS="$try" |
1440 |
fi |
fi |
1441 |
done |
done |
1442 |
if test "x$CPP_OPTIONS" = x ; then |
if test "x$CPP_OPTIONS" = x ; then |
1443 |
echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths" |
echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths" |
1444 |
exit 1 |
exit 1 |
1445 |
fi |
fi |
|
# New safety test: make sure packages are not mentioned in CPP_OPTIONS.h |
|
|
names=`ls -1 "$ROOTDIR/pkg"` |
|
|
for n in $names ; do |
|
|
test_for_package_in_cpp_options $CPP_OPTIONS $n |
|
|
done |
|
|
|
|
1446 |
|
|
1447 |
# Here, we build the list of files to be "run through" the adjoint |
# Here, we build the list of files to be "run through" the adjoint |
1448 |
# compiler. |
# compiler. |
1457 |
done |
done |
1458 |
done |
done |
1459 |
|
|
1460 |
|
|
1461 |
echo |
echo |
1462 |
echo "=== Creating the Makefile ===" |
echo "=== Creating the Makefile ===" |
1463 |
echo " setting INCLUDES" |
echo " setting INCLUDES" |
1474 |
mkdir .links.tmp |
mkdir .links.tmp |
1475 |
echo "# This section creates symbolic links" > srclinks.tmp |
echo "# This section creates symbolic links" > srclinks.tmp |
1476 |
echo "" >> srclinks.tmp |
echo "" >> srclinks.tmp |
1477 |
echo -n 'SRCFILES = ' > srclist.inc |
printf 'SRCFILES = ' > srclist.inc |
1478 |
echo -n 'CSRCFILES = ' > csrclist.inc |
printf 'CSRCFILES = ' > csrclist.inc |
1479 |
echo -n 'F90SRCFILES = ' > f90srclist.inc |
printf 'F90SRCFILES = ' > f90srclist.inc |
1480 |
echo -n 'HEADERFILES = ' > hlist.inc |
printf 'HEADERFILES = ' > hlist.inc |
1481 |
echo -n 'AD_FLOW_FILES = ' > ad_flow_files.inc |
printf 'AD_FLOW_FILES = ' > ad_flow_files.inc |
1482 |
alldirs="$SOURCEDIRS $INCLUDEDIRS ." |
alldirs="$SOURCEDIRS $INCLUDEDIRS ." |
1483 |
for d in $alldirs ; do |
for d in $alldirs ; do |
1484 |
deplist= |
deplist= |
1503 |
case $extn in |
case $extn in |
1504 |
F) |
F) |
1505 |
echo " \\" >> srclist.inc |
echo " \\" >> srclist.inc |
1506 |
echo -n " $sf" >> srclist.inc |
printf " $sf" >> srclist.inc |
1507 |
;; |
;; |
1508 |
F90) |
F90) |
1509 |
echo " \\" >> f90srclist.inc |
echo " \\" >> f90srclist.inc |
1510 |
echo -n " $sf" >> f90srclist.inc |
printf " $sf" >> f90srclist.inc |
1511 |
;; |
;; |
1512 |
c) |
c) |
1513 |
echo " \\" >> csrclist.inc |
echo " \\" >> csrclist.inc |
1514 |
echo -n " $sf" >> csrclist.inc |
printf " $sf" >> csrclist.inc |
1515 |
;; |
;; |
1516 |
h) |
h) |
1517 |
echo " \\" >> hlist.inc |
echo " \\" >> hlist.inc |
1518 |
echo -n " $sf" >> hlist.inc |
printf " $sf" >> hlist.inc |
1519 |
;; |
;; |
1520 |
flow) |
flow) |
1521 |
echo " \\" >> ad_flow_files.inc |
echo " \\" >> ad_flow_files.inc |
1522 |
echo -n " $sf" >> ad_flow_files.inc |
printf " $sf" >> ad_flow_files.inc |
1523 |
;; |
;; |
1524 |
esac |
esac |
1525 |
fi |
fi |
1548 |
echo "# This makefile was generated automatically on" >> $MAKEFILE |
echo "# This makefile was generated automatically on" >> $MAKEFILE |
1549 |
echo "# $THISDATE" >> $MAKEFILE |
echo "# $THISDATE" >> $MAKEFILE |
1550 |
echo "# by the command:" >> $MAKEFILE |
echo "# by the command:" >> $MAKEFILE |
1551 |
echo "# $0 $@" >> $MAKEFILE |
echo "# $0 $G2ARGS" >> $MAKEFILE |
1552 |
echo "# executed by:" >> $MAKEFILE |
echo "# executed by:" >> $MAKEFILE |
1553 |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE |
1554 |
|
|
1557 |
EXE_SVD=$EXECUTABLE"_svd" |
EXE_SVD=$EXECUTABLE"_svd" |
1558 |
|
|
1559 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
1560 |
|
# |
1561 |
|
# OPTFILE="$OPTFILE" |
1562 |
# |
# |
1563 |
# BUILDDIR : Directory where object files are written |
# BUILDDIR : Directory where object files are written |
1564 |
# SOURCEDIRS : Directories containing the source (.F) files |
# SOURCEDIRS : Directories containing the source (.F) files |
1595 |
ENABLED_PACKAGES = ${ENABLED_PACKAGES} |
ENABLED_PACKAGES = ${ENABLED_PACKAGES} |
1596 |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
DISABLED_PACKAGES = ${DISABLED_PACKAGES} |
1597 |
|
|
1598 |
|
# These files are created by Makefile |
1599 |
|
SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h |
1600 |
|
|
1601 |
EOF |
EOF |
1602 |
|
|
1603 |
# Note: figure out some way to add Hyades JAM libraries here |
# Note: figure out some way to add Hyades JAM libraries here |
1616 |
# Fortran compiler |
# Fortran compiler |
1617 |
F90C = ${F90C} |
F90C = ${F90C} |
1618 |
# Link editor |
# Link editor |
1619 |
LINK = ${LINK} |
LINK = ${LINK} ${LDADD} |
1620 |
|
|
1621 |
# Defines for CPP |
# Defines for CPP |
1622 |
DEFINES = ${DEFINES} |
DEFINES = ${DEFINES} |
1662 |
.SUFFIXES: .o .f .p .F .c .F90 .f90 |
.SUFFIXES: .o .f .p .F .c .F90 .f90 |
1663 |
|
|
1664 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
1665 |
\$(EXECUTABLE): links \$(OBJFILES) |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
1666 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
1667 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
1668 |
depend: |
depend: |
1669 |
@make links |
@make links |
1670 |
\$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
\$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
1671 |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
1672 |
|
-rm -f makedepend.out |
1673 |
|
|
1674 |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) ${PACKAGES_DOT_H} AD_CONFIG.h |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) |
1675 |
|
|
1676 |
small_f: \$(F77FILES) \$(F90FILES) |
small_f: \$(F77FILES) \$(F90FILES) |
1677 |
|
|
1684 |
Clean: |
Clean: |
1685 |
@make clean |
@make clean |
1686 |
@make cleanlinks |
@make cleanlinks |
1687 |
-rm -f ${PACKAGES_DOT_H} AD_CONFIG.h |
-rm -f \$(SPECIAL_FILES) |
1688 |
-rm -f Makefile.bak genmake_state genmake_*optfile genmake_warnings make.log |
-rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak |
1689 |
CLEAN: |
CLEAN: |
1690 |
@make Clean |
@make Clean |
1691 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1695 |
|
|
1696 |
#eh3 Makefile: makefile |
#eh3 Makefile: makefile |
1697 |
makefile: |
makefile: |
1698 |
$THIS_SCRIPT $@ |
$THIS_SCRIPT $G2ARGS |
1699 |
cleanlinks: |
cleanlinks: |
1700 |
-find . -type l -exec rm {} \; |
-find . -type l -exec rm {} \; |
1701 |
|
|
1702 |
# Special targets |
# Special targets ($SPECIAL_FILES) which are create by make |
1703 |
${PACKAGES_DOT_H}: |
${PACKAGES_DOT_H}: |
1704 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
1705 |
@\$(TOOLSDIR)/convert_cpp_cmd2defines "Warngin - 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) > \$@ |
1706 |
AD_CONFIG.h: |
AD_CONFIG.h: |
1707 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
1708 |
@\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@ |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@ |
1709 |
|
FC_NAMEMANGLE.h: |
1710 |
|
@echo Creating \$@ ... |
1711 |
|
echo "$FC_NAMEMANGLE" > \$@ |
1712 |
|
|
1713 |
# The normal chain of rules is ( .F - .f - .o ) |
# The normal chain of rules is ( .F - .f - .o ) |
1714 |
.F.f: |
.F.f: |
1752 |
|
|
1753 |
echo " Add the source list for AD code generation" |
echo " Add the source list for AD code generation" |
1754 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
1755 |
echo -n "AD_FILES = " >> $MAKEFILE |
printf "AD_FILES = " >> $MAKEFILE |
1756 |
AD_FILES=`cat ad_files` |
AD_FILES=`cat ad_files` |
1757 |
for i in $AD_FILES ; do |
for i in $AD_FILES ; do |
1758 |
echo " \\" >> $MAKEFILE |
echo " \\" >> $MAKEFILE |
1759 |
echo -n " $i" >> $MAKEFILE |
printf " $i" >> $MAKEFILE |
1760 |
done |
done |
1761 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
1762 |
rm -f ad_files |
rm -f ad_files |
1768 |
adtaf: ad_taf_output.f |
adtaf: ad_taf_output.f |
1769 |
adtamc: ad_tamc_output.f |
adtamc: ad_tamc_output.f |
1770 |
|
|
1771 |
ad_input_code.f: links \$(AD_FILES) \$(HEADERFILES) |
ad_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
1772 |
@\$(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 |
1773 |
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 |
1774 |
-rm -f ad_config.template |
-rm -f ad_config.template |
1775 |
@make \$(F77FILES) |
@make \$(F77FILES) |
1800 |
ftltaf: ftl_taf_output.f |
ftltaf: ftl_taf_output.f |
1801 |
ftltamc: ftl_tamc_output.f |
ftltamc: ftl_tamc_output.f |
1802 |
|
|
1803 |
ftl_input_code.f: links \$(AD_FILES) \$(HEADERFILES) |
ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) |
1804 |
@\$(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 |
1805 |
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 |
1806 |
-rm -f ftl_config.template |
-rm -f ftl_config.template |
1807 |
@make \$(F77FILES) |
@make \$(F77FILES) |
1873 |
|
|
1874 |
printf "\n=== Done ===\n" |
printf "\n=== Done ===\n" |
1875 |
|
|
1876 |
|
# Create special header files |
1877 |
|
$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 > $PACKAGES_DOT_H".tmp" |
1878 |
|
if test ! -f $PACKAGES_DOT_H ; then |
1879 |
|
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
1880 |
|
else |
1881 |
|
cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H > /dev/null 2>&1 |
1882 |
|
RETVAL=$? |
1883 |
|
if test "x$RETVAL" = x0 ; then |
1884 |
|
rm -f $PACKAGES_DOT_H".tmp" |
1885 |
|
else |
1886 |
|
mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak" |
1887 |
|
mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H |
1888 |
|
fi |
1889 |
|
fi |
1890 |
|
if test ! -f AD_CONFIG.h ; then |
1891 |
|
$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 |
1892 |
|
fi |
1893 |
|
|
1894 |
|
|
1895 |
# Write the "state" for future records |
# Write the "state" for future records |
1896 |
if test "x$DUMPSTATE" != xf ; then |
if test "x$DUMPSTATE" != xf ; then |
1897 |
echo -n "" > genmake_state |
printf "" > genmake_state |
1898 |
for i in $gm_state ; do |
for i in $gm_state ; do |
1899 |
t1="t2=\$$i" |
t1="t2=\$$i" |
1900 |
eval $t1 |
eval $t1 |