1 |
#! /usr/bin/env bash |
#! /usr/bin/env sh |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
# |
# |
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 |
74 |
} |
} |
75 |
|
|
76 |
# Guess possible config options for this host |
# Check for broken environments (eg. cygwin, MacOSX w/HFS+) that |
77 |
find_possible_configs() { |
# cannot distinguish [*.F/*.F90] from [*.f/*.f90] files. |
78 |
|
check_for_broken_Ff() { |
79 |
|
# Do we have defaults for $FS and/or $FS90 ? |
80 |
|
tfs=f |
81 |
|
tfs9=f90 |
82 |
|
if test "x$FS" != x ; then |
83 |
|
tfs="$FS" |
84 |
|
fi |
85 |
|
if test "x$FS90" != x ; then |
86 |
|
tfs9="$FS90" |
87 |
|
fi |
88 |
|
|
89 |
tmp1=`uname`"_"`uname -m` |
# First check the ability to create a *.F/.f pair. |
90 |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
cat <<EOF >> genmake_hello.F |
91 |
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
program hello |
92 |
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
write(*,*) 'hi' |
93 |
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
stop |
94 |
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
end |
95 |
PLATFORM=$tmp3 |
EOF |
96 |
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
cp genmake_hello.F "genmake_hello."$tfs > /dev/null 2>&1 |
|
echo " The platform appears to be: $PLATFORM" |
|
|
|
|
|
echo "test" > test |
|
|
ln -s ./test link |
|
97 |
RETVAL=$? |
RETVAL=$? |
98 |
if test "x${RETVAL}" = x0 ; then |
if test "x$RETVAL" != x0 ; then |
99 |
LN="ln -s" |
if test "x$FS" = x ; then |
100 |
else |
FS='for' |
101 |
echo "Error: \"ln -s\" does not appear to work on this system!" |
FS90='fr9' |
102 |
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
check_for_broken_Ff |
103 |
exit 1 |
else |
104 |
|
cat <<EOF 2>&1 |
105 |
|
ERROR: Your file system cannot distinguish between *.F and *.f files |
106 |
|
(fails the "cp" test) and this program cannot find a suitable |
107 |
|
replacement extension. Please try a different build environment or |
108 |
|
contact the <MITgcm-support@mitgcm.org> list for help. |
109 |
|
|
110 |
|
EOF |
111 |
|
exit -1 |
112 |
|
fi |
113 |
|
return |
114 |
fi |
fi |
115 |
rm -f test link |
rm -f genmake_hello.* |
116 |
|
|
117 |
if test "x$CPP" = x ; then |
# Check the ability of ${MAKE} and ${LN} to use the current set |
118 |
CPP="cpp -traditional -P" |
# of extensions. |
119 |
|
cat <<EOF >> genmake_hello.F |
120 |
|
program hello |
121 |
|
write(*,*) 'hi' |
122 |
|
stop |
123 |
|
end |
124 |
|
EOF |
125 |
|
test -e Makefile && mv -f Makefile Makefile.bak |
126 |
|
cat <<EOF >> Makefile |
127 |
|
%.$tfs : %.F |
128 |
|
.SUFFIXES: |
129 |
|
genmake_hello.$tfs: genmake_hello.F |
130 |
|
$LN genmake_hello.F genmake_hello.$tfs |
131 |
|
EOF |
132 |
|
$MAKE "genmake_hello."$tfs > /dev/null 2>&1 |
133 |
|
RETVAL=$? |
134 |
|
if test "x$RETVAL" != x0 -o ! -e "genmake_hello."$tfs ; then |
135 |
|
if test "x$FS" = x ; then |
136 |
|
FS='for' |
137 |
|
FS90='fr9' |
138 |
|
check_for_broken_Ff |
139 |
|
else |
140 |
|
cat <<EOF 2>&1 |
141 |
|
ERROR: Your file system cannot distinguish between *.F and *.f files |
142 |
|
(fails the "make/ln" test) and this program cannot find a suitable |
143 |
|
replacement extension. Please try a different build environment or |
144 |
|
contact the <MITgcm-support@mitgcm.org> list for help. |
145 |
|
|
146 |
|
EOF |
147 |
|
exit -1 |
148 |
|
return |
149 |
|
fi |
150 |
fi |
fi |
151 |
|
rm -f genmake_hello.* Makefile |
152 |
|
test -e Makefile && mv -f Makefile.bak Makefile |
153 |
|
|
154 |
|
# If we make it here, use the extensions |
155 |
|
FS=$tfs |
156 |
|
FS90=$tfs9 |
157 |
|
return |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
look_for_makedepend() { |
162 |
|
|
163 |
# The "original" makedepend is part of the Imake system that is |
# The "original" makedepend is part of the Imake system that is |
164 |
# most often distributed with XFree86 or with an XFree86 source |
# most often distributed with XFree86 or with an XFree86 source |
180 |
# |
# |
181 |
if test "x${MAKEDEPEND}" = x ; then |
if test "x${MAKEDEPEND}" = x ; then |
182 |
which makedepend > /dev/null 2>&1 |
which makedepend > /dev/null 2>&1 |
183 |
RETVAL=$? |
RV0=$? |
184 |
if test ! "x${RETVAL}" = x0 ; then |
cat <<EOF >> genmake_tc.f |
185 |
|
program test |
186 |
|
write(*,*) 'test' |
187 |
|
stop |
188 |
|
end |
189 |
|
EOF |
190 |
|
makedepend genmake_tc.f > /dev/null 2>&1 |
191 |
|
RV1=$? |
192 |
|
if test ! "x${RV0}${RV1}" = x00 ; then |
193 |
echo " a system-default makedepend was not found." |
echo " a system-default makedepend was not found." |
194 |
|
|
195 |
# Try to build the cyrus impl |
# Try to build the cyrus impl |
197 |
( |
( |
198 |
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
cd $ROOTDIR/tools/cyrus-imapd-makedepend \ |
199 |
&& ./configure > /dev/null 2>&1 \ |
&& ./configure > /dev/null 2>&1 \ |
200 |
&& make > /dev/null 2>&1 \ |
&& make > /dev/null 2>&1 |
201 |
&& ./makedepend ifparser.c > /dev/null 2>&1 \ |
if test -x ./makedepend.exe ; then |
202 |
|
$LN ./makedepend.exe ./makedepend |
203 |
|
fi |
204 |
|
./makedepend ifparser.c > /dev/null 2>&1 \ |
205 |
&& echo "true" |
&& echo "true" |
206 |
) > ./genmake_cy_md |
) > ./genmake_cy_md |
207 |
grep true ./genmake_cy_md > /dev/null 2>&1 |
grep true ./genmake_cy_md > /dev/null 2>&1 |
214 |
rm -f ./genmake_cy_md |
rm -f ./genmake_cy_md |
215 |
fi |
fi |
216 |
fi |
fi |
217 |
|
} |
218 |
|
|
219 |
|
|
220 |
|
# Guess possible config options for this host |
221 |
|
find_possible_configs() { |
222 |
|
|
223 |
|
tmp1=`uname`"_"`uname -m` |
224 |
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
225 |
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
226 |
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
227 |
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
228 |
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
229 |
|
PLATFORM=$tmp3 |
230 |
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
231 |
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
232 |
|
echo " The platform appears to be: $PLATFORM" |
233 |
|
|
234 |
|
echo "test" > test |
235 |
|
ln -s ./test link |
236 |
|
RETVAL=$? |
237 |
|
if test "x${RETVAL}" = x0 ; then |
238 |
|
LN="ln -s" |
239 |
|
else |
240 |
|
echo "Error: \"ln -s\" does not appear to work on this system!" |
241 |
|
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
242 |
|
exit 1 |
243 |
|
fi |
244 |
|
rm -f test link |
245 |
|
|
246 |
|
if test "x$CPP" = x ; then |
247 |
|
CPP="cpp -traditional -P" |
248 |
|
fi |
249 |
|
|
250 |
|
look_for_makedepend |
251 |
|
|
252 |
# look for possible fortran compilers |
# look for possible fortran compilers |
253 |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
377 |
-help | --help | -h | --h |
-help | --help | -h | --h |
378 |
Print this help message and exit. |
Print this help message and exit. |
379 |
|
|
380 |
|
-adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME |
381 |
|
-adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME |
382 |
|
Use "NAME" as the adoptfile. By default, the file at |
383 |
|
"tools/adjoint_options/adjoint_default" will be used. |
384 |
|
|
385 |
-nooptfile | --nooptfile |
-nooptfile | --nooptfile |
386 |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
-optfile NAME | --optfile NAME | -of NAME | --of NAME |
387 |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
-optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME |
605 |
|
|
606 |
|
|
607 |
check_netcdf_libs() { |
check_netcdf_libs() { |
608 |
cat <<EOF > genmake_tnc.F |
cat <<EOF > genmake_tnc.for |
609 |
program fgennc |
program fgennc |
610 |
#include "netcdf.inc" |
#include "netcdf.inc" |
611 |
integer iret, ncid, xid |
integer iret, ncid, xid |
617 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
618 |
end |
end |
619 |
EOF |
EOF |
620 |
$CPP genmake_tnc.F > genmake_tnc.f \ |
$CPP genmake_tnc.for > genmake_tnc.f \ |
621 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1 |
622 |
RET_COMPILE=$? |
RET_COMPILE=$? |
623 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
test -x ./genmake_tnc && ./genmake_tnc >> genmake_tnc.log 2>&1 |
626 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
627 |
else |
else |
628 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
629 |
$CPP genmake_tnc.F > genmake_tnc.f \ |
$CPP genmake_tnc.for > genmake_tnc.f \ |
630 |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
&& $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \ |
631 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
$LIBS -lnetcdf >> genmake_tnc_2.log 2>&1 |
632 |
RET_COMPILE=$? |
RET_COMPILE=$? |
688 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
689 |
HAVE_CLOC= |
HAVE_CLOC= |
690 |
HAVE_NETCDF= |
HAVE_NETCDF= |
691 |
|
HAVE_ETIME= |
692 |
|
|
693 |
MODS= |
MODS= |
694 |
TOOLSDIR= |
TOOLSDIR= |
713 |
if test "x$MITGCM_IEEE" != x ; then |
if test "x$MITGCM_IEEE" != x ; then |
714 |
IEEE=$MITGCM_IEEE |
IEEE=$MITGCM_IEEE |
715 |
fi |
fi |
716 |
|
FS= |
717 |
|
FS90= |
718 |
|
|
719 |
AUTODIFF_PKG_USED=f |
AUTODIFF_PKG_USED=f |
720 |
AD_OPTFILE= |
AD_OPTFILE= |
739 |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" |
740 |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" |
741 |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" |
742 |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE" |
gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" |
743 |
|
|
744 |
# The following are all related to adjoint/tangent-linear stuff |
# The following are all related to adjoint/tangent-linear stuff |
745 |
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" |
892 |
-fc=* | --fc=*) |
-fc=* | --fc=*) |
893 |
FC=$ac_optarg ;; |
FC=$ac_optarg ;; |
894 |
|
|
895 |
|
-fs | --fs) |
896 |
|
ac_prev=FS ;; |
897 |
|
-fs=* | --fs=*) |
898 |
|
FS=$ac_optarg ;; |
899 |
|
|
900 |
|
-fs90 | --fs90) |
901 |
|
ac_prev=FS90 ;; |
902 |
|
-fs90=* | --fs90=*) |
903 |
|
FS90=$ac_optarg ;; |
904 |
|
|
905 |
-ieee | --ieee) |
-ieee | --ieee) |
906 |
IEEE=true ;; |
IEEE=true ;; |
907 |
-noieee | --noieee) |
-noieee | --noieee) |
1011 |
fi |
fi |
1012 |
fi |
fi |
1013 |
|
|
1014 |
|
# Check for broken systems that cannot correctly distinguish *.F and *.f files |
1015 |
|
# check_for_broken_Ff |
1016 |
|
|
1017 |
echo " getting AD_OPTFILE information: " |
echo " getting AD_OPTFILE information: " |
1018 |
if test "x${AD_OPTFILE}" = x ; then |
if test "x${AD_OPTFILE}" = x ; then |
1019 |
if test "x$MITGCM_AD_OF" = x ; then |
if test "x$MITGCM_AD_OF" = x ; then |
1067 |
CPP=cpp |
CPP=cpp |
1068 |
fi |
fi |
1069 |
#EH3 === UGLY === |
#EH3 === UGLY === |
1070 |
# The following an ugly little hack to check for $CPP in /lib/ and it |
# The following is an ugly little hack to check for $CPP in /lib/ and |
1071 |
# should eventually be replaced with a more general function that |
# it should eventually be replaced with a more general function that |
1072 |
# searches a combo of the user's path and a list of "usual suspects" |
# searches a combo of the user's path and a list of "usual suspects" |
1073 |
# to find the correct location for binaries such as $CPP. |
# to find the correct location for binaries such as $CPP. |
1074 |
for i in " " "/lib/" ; do |
for i in " " "/lib/" ; do |
1091 |
else |
else |
1092 |
rm -f test_cpp |
rm -f test_cpp |
1093 |
fi |
fi |
1094 |
if test "x$MAKEDEPEND" = x ; then |
look_for_makedepend |
|
MAKEDEPEND=makedepend |
|
|
fi |
|
1095 |
if test "x$LN" = x ; then |
if test "x$LN" = x ; then |
1096 |
LN="ln -s" |
LN="ln -s" |
1097 |
fi |
fi |
1109 |
fi |
fi |
1110 |
rm -f genmake_test_ln genmake_tlink |
rm -f genmake_test_ln genmake_tlink |
1111 |
|
|
1112 |
|
# Check for broken *.F/*.f handling and fix if possible |
1113 |
|
check_for_broken_Ff |
1114 |
|
|
1115 |
if test ! "x$MPI" = x ; then |
if test ! "x$MPI" = x ; then |
1116 |
echo " Turning on MPI cpp macros" |
echo " Turning on MPI cpp macros" |
1117 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
1157 |
fi |
fi |
1158 |
rm -f genmake_tcomp* |
rm -f genmake_tcomp* |
1159 |
|
|
1160 |
|
printf " Do we have the etime() command using $FC... " |
1161 |
|
cat > genmake_tcomp.f <<EOF |
1162 |
|
program hello |
1163 |
|
REAL*4 ACTUAL, TARRAY(2) |
1164 |
|
EXTERNAL ETIME |
1165 |
|
REAL*4 ETIME |
1166 |
|
actual = etime( tarray ) |
1167 |
|
print *, tarray |
1168 |
|
end |
1169 |
|
EOF |
1170 |
|
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1 |
1171 |
|
RETVAL=$? |
1172 |
|
if test "x$RETVAL" = x0 ; then |
1173 |
|
HAVE_ETIME=t |
1174 |
|
DEFINES="$DEFINES -DHAVE_ETIME" |
1175 |
|
echo "yes" |
1176 |
|
else |
1177 |
|
HAVE_ETIME= |
1178 |
|
echo "no" |
1179 |
|
fi |
1180 |
|
rm -f genmake_tcomp* |
1181 |
|
|
1182 |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
printf " Can we call simple C routines (here, \"cloc()\") using $FC... " |
1183 |
check_HAVE_CLOC |
check_HAVE_CLOC |
1184 |
if test "x$HAVE_CLOC" != x ; then |
if test "x$HAVE_CLOC" != x ; then |
1338 |
PACKAGES="$PACKAGES $i" |
PACKAGES="$PACKAGES $i" |
1339 |
done |
done |
1340 |
echo " before group expansion packages are: $PACKAGES" |
echo " before group expansion packages are: $PACKAGES" |
1341 |
expand_pkg_groups |
while ! expand_pkg_groups; do echo > /dev/null; done |
1342 |
echo " after group expansion packages are: $PACKAGES" |
echo " after group expansion packages are: $PACKAGES" |
1343 |
fi |
fi |
1344 |
fi |
fi |
1345 |
|
|
1346 |
echo " applying DISABLE settings" |
echo " applying DISABLE settings" |
1347 |
|
for i in $PACKAGES ; do |
1348 |
|
echo $i >> ./.tmp_pack |
1349 |
|
done |
1350 |
|
for i in `grep "-" ./.tmp_pack` ; do |
1351 |
|
j=`echo $i | sed 's/[-]//'` |
1352 |
|
DISABLE="$DISABLE $j" |
1353 |
|
done |
1354 |
pack= |
pack= |
1355 |
for p in $PACKAGES ; do |
for p in $PACKAGES ; do |
1356 |
addit="t" |
addit="t" |
1367 |
echo " applying ENABLE settings" |
echo " applying ENABLE settings" |
1368 |
echo "" > ./.tmp_pack |
echo "" > ./.tmp_pack |
1369 |
PACKAGES="$PACKAGES $ENABLE" |
PACKAGES="$PACKAGES $ENABLE" |
1370 |
|
# Test if each explicitly referenced package exists |
1371 |
for i in $PACKAGES ; do |
for i in $PACKAGES ; do |
1372 |
if test ! -d "$ROOTDIR/pkg/$i" ; then |
j=`echo $i | sed 's/[-+]//'` |
1373 |
|
if test ! -d "$ROOTDIR/pkg/$j" ; then |
1374 |
echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\"" |
echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\"" |
1375 |
exit 1 |
exit 1 |
1376 |
fi |
fi |
1377 |
echo $i >> ./.tmp_pack |
echo $i >> ./.tmp_pack |
1378 |
done |
done |
|
pack=`cat ./.tmp_pack | sort | uniq` |
|
|
rm -f ./.tmp_pack |
|
1379 |
PACKAGES= |
PACKAGES= |
1380 |
for i in $pack ; do |
for i in `grep -v "-" ./.tmp_pack | sort | uniq` ; do |
1381 |
PACKAGES="$PACKAGES $i" |
PACKAGES="$PACKAGES $i" |
1382 |
done |
done |
1383 |
|
rm -f ./.tmp_pack |
1384 |
echo " packages are: $PACKAGES" |
echo " packages are: $PACKAGES" |
1385 |
|
|
1386 |
echo " applying package dependency rules" |
echo " applying package dependency rules" |
1795 |
cat f90srclist.inc >> $MAKEFILE |
cat f90srclist.inc >> $MAKEFILE |
1796 |
cat hlist.inc >> $MAKEFILE |
cat hlist.inc >> $MAKEFILE |
1797 |
cat ad_flow_files.inc >> $MAKEFILE |
cat ad_flow_files.inc >> $MAKEFILE |
1798 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
1799 |
echo 'F77FILES = $(SRCFILES:.F=.f)' >> $MAKEFILE |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
1800 |
echo 'F90FILES = $(F90SRCFILES:.F90=.f90)' >> $MAKEFILE |
echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE |
1801 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
1802 |
|
echo >> $MAKEFILE |
1803 |
|
echo '.SUFFIXES:' >> $MAKEFILE |
1804 |
|
echo '.SUFFIXES: .o .'$FS' .p .F .c .'$FS90' .F90' >> $MAKEFILE |
1805 |
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 |
1806 |
rm -f ad_flow_files.inc |
rm -f ad_flow_files.inc |
1807 |
|
|
1808 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
1809 |
|
|
|
.SUFFIXES: |
|
|
.SUFFIXES: .o .f .p .F .c .F90 .f90 |
|
|
|
|
1810 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
1811 |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
1812 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
1813 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
1814 |
depend: |
depend: |
1815 |
@make links |
@make links |
1816 |
\$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
\$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(SRCFILES) |
1817 |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
1818 |
-rm -f makedepend.out |
-rm -f makedepend.out |
1819 |
|
|
1826 |
@\$(EXECUTABLE) > \$@ |
@\$(EXECUTABLE) > \$@ |
1827 |
|
|
1828 |
clean: |
clean: |
1829 |
-rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} *.template |
-rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template |
1830 |
Clean: |
Clean: |
1831 |
@make clean |
@make clean |
1832 |
@make cleanlinks |
@make cleanlinks |
1837 |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
-find \$(EXEDIR) -name "*.meta" -exec rm {} \; |
1838 |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
-find \$(EXEDIR) -name "*.data" -exec rm {} \; |
1839 |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
-find \$(EXEDIR) -name "fort.*" -exec rm {} \; |
1840 |
-rm -f \$(EXECUTABLE) output.txt |
-rm -f \$(EXECUTABLE) output.txt STD* |
1841 |
|
|
1842 |
#eh3 Makefile: makefile |
#eh3 Makefile: makefile |
1843 |
makefile: |
makefile: |
1856 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
1857 |
echo "$FC_NAMEMANGLE" > \$@ |
echo "$FC_NAMEMANGLE" > \$@ |
1858 |
|
|
1859 |
# The normal chain of rules is ( .F - .f - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |
1860 |
.F.f: |
|
1861 |
|
%.o : %.F |
1862 |
|
|
1863 |
|
.F.$FS: |
1864 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
1865 |
.f.o: |
.$FS.o: |
1866 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
1867 |
.F90.f90: |
.F90.$FS90: |
1868 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
1869 |
.f90.o: |
.$FS90.o: |
1870 |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
1871 |
.c.o: |
.c.o: |
1872 |
\$(CC) \$(CFLAGS) -c \$< |
\$(CC) \$(CFLAGS) -c \$< |
1873 |
|
|
1874 |
# Special exceptions that use the ( .F - .p - .f - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
1875 |
.F.p: |
.F.p: |
1876 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
1877 |
.p.f: |
.p.$FS: |
1878 |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
1879 |
|
|
1880 |
#========================================= |
#========================================= |
1999 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
2000 |
echo "Error: unable to add file \"$i\" to the exceptions list" |
echo "Error: unable to add file \"$i\" to the exceptions list" |
2001 |
fi |
fi |
2002 |
echo "$base.f: $base.p" >> $MAKEFILE |
echo "$base.$FS: $base.p" >> $MAKEFILE |
2003 |
done |
done |
2004 |
|
|
2005 |
echo " Making list of NOOPTFILES" |
echo " Making list of NOOPTFILES" |
2009 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
2010 |
echo "Error: unable to add file \"$i\" to the exceptions list" |
echo "Error: unable to add file \"$i\" to the exceptions list" |
2011 |
fi |
fi |
2012 |
echo "$base.o: $base.f" >> $MAKEFILE |
echo "$base.o: $base.$FS" >> $MAKEFILE |
2013 |
printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE |
printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE |
2014 |
done |
done |
2015 |
|
|