174 |
test_for_package_in_cpp_options() { |
test_for_package_in_cpp_options() { |
175 |
cpp_options=$1 |
cpp_options=$1 |
176 |
pkg=$2 |
pkg=$2 |
177 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg[ ]" |
test_for_string_in_file $cpp_options "^ *# *define *\<ALLOW_$pkg\>" |
178 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg[ ]" |
test_for_string_in_file $cpp_options "^ *# *undef *\<ALLOW_$pkg\>" |
179 |
test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg[ ]" |
test_for_string_in_file $cpp_options "^ *# *define *\<DISABLE_$pkg\>" |
180 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg[ ]" |
test_for_string_in_file $cpp_options "^ *# *undef *\<DISABLE_$pkg\>" |
|
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg$" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg$" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg$" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg$" |
|
181 |
} |
} |
182 |
|
|
183 |
# Search for particular CPP #cmds associated with MPI |
# Search for particular CPP #cmds associated with MPI |
184 |
# usage: test_for_mpi_in_cpp_eeoptions CPP_file |
# usage: test_for_mpi_in_cpp_eeoptions CPP_file |
185 |
test_for_mpi_in_cpp_eeoptions() { |
test_for_mpi_in_cpp_eeoptions() { |
186 |
cpp_options=$1 |
cpp_options=$1 |
187 |
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI[ ]" |
test_for_string_in_file $cpp_options "^ *# *define *\<ALLOW_USE_MPI\>" |
188 |
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI[ ]" |
test_for_string_in_file $cpp_options "^ *# *undef *\<ALLOW_USE_MPI\>" |
|
test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI[ ]" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI[ ]" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI$" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI$" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI$" |
|
|
test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI$" |
|
189 |
} |
} |
190 |
|
|
191 |
# Search for particular string in a file. Return 1 if detected, 0 if not |
# Search for particular string in a file. Return 1 if detected, 0 if not |
193 |
test_for_string_in_file() { |
test_for_string_in_file() { |
194 |
file=$1 |
file=$1 |
195 |
strng=$2 |
strng=$2 |
196 |
grep -i "$strng" $file > /dev/null 2>&1 |
grep "$strng" $file > /dev/null 2>&1 |
197 |
RETVAL=$? |
RETVAL=$? |
198 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
199 |
printf "Error: In $file there is an illegal line: " |
printf "Error: In $file there is an illegal line: " |
324 |
# |
# |
325 |
# 1) a makedepend implementation shipped with the cyrus-imapd |
# 1) a makedepend implementation shipped with the cyrus-imapd |
326 |
# package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ |
# package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ |
327 |
# |
# 2) a local tools/xmakedepend shell script |
|
# 2) a known-buggy xmakedpend shell script |
|
328 |
# |
# |
329 |
# So the choices are, in order: |
# So the choices are, in order: |
|
# |
|
330 |
# 1) use the user-specified program |
# 1) use the user-specified program |
331 |
# 2) use a system-wide default |
# 2) use the local xmakedepend script (get all dependencies, but slower) |
332 |
# 3) locally build and use the cyrus implementation |
# 3) use a system-wide default |
333 |
# 4) fall back to the buggy local xmakedpend script |
# 4) locally build and use the cyrus makedepend |
334 |
|
# (faster, but can miss some dependencies) |
335 |
# |
# |
336 |
echo >> $LOGFILE |
echo >> $LOGFILE |
337 |
echo "running: look_for_makedepend()" >> $LOGFILE |
echo "running: look_for_makedepend()" >> $LOGFILE |
342 |
build_cyrus_makedepend |
build_cyrus_makedepend |
343 |
RETVAL=$? |
RETVAL=$? |
344 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
345 |
echo "WARNING: unable to build cyrus-makedepend. Try 'makedepend'" |
echo "WARNING: unable to build cyrus-makedepend. Try other 'makedepend'" |
346 |
MAKEDEPEND= |
MAKEDEPEND= |
347 |
fi |
fi |
348 |
else |
else |
355 |
fi |
fi |
356 |
fi |
fi |
357 |
if test "x${MAKEDEPEND}" = x ; then |
if test "x${MAKEDEPEND}" = x ; then |
|
which makedepend > /dev/null 2>&1 |
|
|
RV0=$? |
|
358 |
test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" |
test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" |
359 |
# echo 'MAKEFILE="'$MAKEFILE'"' |
# echo 'MAKEFILE="'$MAKEFILE'"' |
360 |
cat <<EOF >> $MAKEFILE |
cat <<EOF >> $MAKEFILE |
370 |
stop |
stop |
371 |
end |
end |
372 |
EOF |
EOF |
373 |
makedepend -f $MAKEFILE genmake_tc.f > /dev/null 2>&1 |
$ROOTDIR/tools/xmakedepend -f $MAKEFILE genmake_tc.f > /dev/null 2>&1 |
374 |
RV1=$? |
RV1=$? |
375 |
|
which makedepend > /dev/null 2>&1 |
376 |
|
RV2=$? |
377 |
|
if test "x${RV2}" = x0 ; then |
378 |
|
makedepend -f $MAKEFILE genmake_tc.f > /dev/null 2>&1 |
379 |
|
RV3=$? ; loc_msg='not working.' |
380 |
|
else RV3=$RV2 ; loc_msg='not found.' |
381 |
|
fi |
382 |
test -f $MAKEFILE && rm -f $MAKEFILE |
test -f $MAKEFILE && rm -f $MAKEFILE |
383 |
test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE |
test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE |
384 |
if test "x${RV0}${RV1}" = x00 ; then |
echo " check makedepend (local: $RV1, system: $RV2, $RV3)" |
385 |
|
if test "x${RV1}" = x0 ; then |
386 |
|
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
387 |
|
echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE |
388 |
|
elif test "x${RV3}" = x0 ; then |
389 |
|
echo " local tools/xmakedepend not working. Use system-default makedepend" |
390 |
MAKEDEPEND=makedepend |
MAKEDEPEND=makedepend |
391 |
echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE |
echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE |
392 |
else |
else |
393 |
echo " system-default makedepend not found. Try to build cyrus-makedepend" |
echo " local tools/xmakedepend not working; system-default makedepend $loc_msg" |
394 |
|
echo -n " Try to build cyrus-makedepend ..." |
395 |
# Try to build the cyrus implementation |
# Try to build the cyrus implementation |
396 |
build_cyrus_makedepend |
build_cyrus_makedepend |
397 |
RETVAL=$? |
RETVAL=$? |
398 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" = x0 ; then |
399 |
echo "WARNING: unable to build cyrus-makedepend. Use local xmakedepend" |
echo " Works" |
400 |
MAKEDEPEND='$(TOOLSDIR)/xmakedepend' |
else |
401 |
echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE |
echo " Fails" ; echo "" >> $LOGFILE |
402 |
|
echo "ERROR: no working makedepend found ; look_for_makedepend FAILED" | tee -a $LOGFILE |
403 |
|
echo "" |
404 |
|
exit -1 |
405 |
|
return |
406 |
fi |
fi |
407 |
fi |
fi |
408 |
fi |
fi |
921 |
program fgennc |
program fgennc |
922 |
#include "netcdf.inc" |
#include "netcdf.inc" |
923 |
EOF |
EOF |
924 |
if test ! "x$MPI" = x ; then |
#if test ! "x$MPI" = x ; then |
925 |
echo '#include "mpif.h"' >> genmake_tnc.F |
# echo '#include "mpif.h"' >> genmake_tnc.F |
926 |
fi |
#fi |
927 |
cat <<EOF >> genmake_tnc.F |
cat <<EOF >> genmake_tnc.F |
928 |
integer iret, ncid, xid |
integer iret, ncid, xid |
929 |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) |
1106 |
echo " --> set HAVE_LAPACK='$HAVE_LAPACK'" >> $LOGFILE |
echo " --> set HAVE_LAPACK='$HAVE_LAPACK'" >> $LOGFILE |
1107 |
} |
} |
1108 |
|
|
1109 |
|
check_HAVE_FLUSH() { |
1110 |
|
if test ! "x$SKIP_CHECK_FLUSH" = x ; then |
1111 |
|
return |
1112 |
|
fi |
1113 |
|
echo >> $LOGFILE |
1114 |
|
echo "running: check_HAVE_FLUSH()" >> $LOGFILE |
1115 |
|
cat <<EOF > genmake_tflsh.$FS |
1116 |
|
program fgenflsh |
1117 |
|
integer iounit |
1118 |
|
character*9 fname |
1119 |
|
iounit = 26 |
1120 |
|
fname = 'tmp.tflsh' |
1121 |
|
open(iounit,FILE=fname,STATUS='unknown') |
1122 |
|
write(iounit,*) 'genmake_tflsh: hello' |
1123 |
|
call flush(iounit) |
1124 |
|
close(iounit) |
1125 |
|
end |
1126 |
|
EOF |
1127 |
|
echo "=== genmake_tflsh.$FS >>>" > genmake_tflsh.log |
1128 |
|
cat genmake_tflsh.$FS >> genmake_tflsh.log |
1129 |
|
echo "<<< genmake_tflsh.$FS ===" >> genmake_tflsh.log |
1130 |
|
|
1131 |
|
echo "$FC $FFLAGS $FOPTIM -c genmake_tflsh.$FS \ " >> genmake_tflsh.log |
1132 |
|
echo " && $LINK $FFLAGS $FOPTIM -o genmake_tflsh.o $LIBS" >> genmake_tflsh.log |
1133 |
|
$FC $FFLAGS $FOPTIM -c genmake_tflsh.$FS >> genmake_tflsh.log 2>&1 \ |
1134 |
|
&& $LINK $FFLAGS $FOPTIM -o genmake_tflsh genmake_tflsh.o $LIBS >> genmake_tflsh.log 2>&1 |
1135 |
|
RET_COMPILE=$? |
1136 |
|
|
1137 |
|
if test "x$RET_COMPILE" = x0 ; then |
1138 |
|
HAVE_FLUSH=t |
1139 |
|
#cat genmake_tflsh.log >> $LOGFILE |
1140 |
|
echo " check_HAVE_FLUSH: successful" >> $LOGFILE |
1141 |
|
else |
1142 |
|
HAVE_FLUSH=f |
1143 |
|
cat genmake_tflsh.log >> $LOGFILE |
1144 |
|
fi |
1145 |
|
rm -f genmake_tflsh* |
1146 |
|
echo " --> set HAVE_FLUSH='$HAVE_FLUSH'" >> $LOGFILE |
1147 |
|
} |
1148 |
|
|
1149 |
############################################################################### |
############################################################################### |
1150 |
# Sequential part of script starts here |
# Sequential part of script starts here |
1202 |
DEVEL= |
DEVEL= |
1203 |
HAVE_TEST_L= |
HAVE_TEST_L= |
1204 |
|
|
1205 |
|
# comment this line out to enable lapack test |
1206 |
|
SKIP_LAPACK_CHECK=t |
1207 |
|
|
1208 |
# DEFINES checked by test compilation or command-line |
# DEFINES checked by test compilation or command-line |
1209 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
1210 |
HAVE_FDATE= |
HAVE_FDATE= |
1216 |
HAVE_ETIME= |
HAVE_ETIME= |
1217 |
IGNORE_TIME= |
IGNORE_TIME= |
1218 |
HAVE_LAPACK= |
HAVE_LAPACK= |
1219 |
|
HAVE_FLUSH= |
1220 |
|
|
1221 |
MODS= |
MODS= |
1222 |
TOOLSDIR= |
TOOLSDIR= |
1270 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
1271 |
gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM" |
gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM" |
1272 |
gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS" |
gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS" |
1273 |
gm_s6="TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK" |
gm_s6="PWD TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK" |
1274 |
gm_s7="PWD THISHOST THISUSER THISDATE THISVER MACHINE" |
gm_s7="THISHOST THISUSER THISDATE THISVER MACHINE FC_NAMEMANGLE" |
1275 |
gm_s8="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK" |
gm_s8="HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK HAVE_FLUSH" |
1276 |
|
|
1277 |
# The following are all related to adjoint/tangent-linear stuff |
# The following are all related to adjoint/tangent-linear stuff |
1278 |
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" |
1715 |
|
|
1716 |
if test ! "x$MPI" = x ; then |
if test ! "x$MPI" = x ; then |
1717 |
echo " Turning on MPI cpp macros" |
echo " Turning on MPI cpp macros" |
1718 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI" |
1719 |
|
#- To compile code older than checkpoint63s (2012/09/05), un-comment the following line: |
1720 |
|
# DEFINES="$DEFINES -DALWAYS_USE_MPI" |
1721 |
fi |
fi |
1722 |
if test ! "x$OMP" = x ; then |
if test ! "x$OMP" = x ; then |
1723 |
echo " Add OMPFLAG and turn on OpenMP cpp macros" |
echo " Add OMPFLAG and turn on OpenMP cpp macros" |
1942 |
else |
else |
1943 |
echo "no" |
echo "no" |
1944 |
fi |
fi |
|
DEFINES="$DEFINES $IGNORE_TIME" |
|
1945 |
|
|
1946 |
|
printf " Can we call FLUSH intrinsic subroutine... " |
1947 |
|
check_HAVE_FLUSH |
1948 |
|
if test "x$HAVE_FLUSH" = xt ; then |
1949 |
|
DEFINES="$DEFINES -DHAVE_FLUSH" |
1950 |
|
echo "yes" |
1951 |
|
else |
1952 |
|
echo "no" |
1953 |
|
fi |
1954 |
|
|
1955 |
|
DEFINES="$DEFINES $IGNORE_TIME" |
1956 |
if test "x$EMBED_SRC" = xt ; then |
if test "x$EMBED_SRC" = xt ; then |
1957 |
build_embed_encode |
build_embed_encode |
1958 |
fi |
fi |
2550 |
OAD_DONT_TRANSFORM="/dev/null" |
OAD_DONT_TRANSFORM="/dev/null" |
2551 |
OAD_KEEP_ORIGINAL="/dev/null" |
OAD_KEEP_ORIGINAL="/dev/null" |
2552 |
OAD_CB2M_FILES="/dev/null" |
OAD_CB2M_FILES="/dev/null" |
2553 |
|
OADTOOLS="$TOOLSDIR/OAD_support" |
2554 |
|
test -f "oadtempflile" && \rm -f "oadtempflile" |
2555 |
|
cat >> "oadtempflile" <<EOF |
2556 |
|
$OADTOOLS |
2557 |
|
EOF |
2558 |
echo " looking for dontCompile file: " |
echo " looking for dontCompile file: " |
2559 |
for i in "." $MODS ; do |
for i in "." $MODS ; do |
2560 |
if test -r $i"/dontCompile" ; then |
if test -r $i"/dontCompile" ; then |
2762 |
EXEDIR = ${EXEDIR} |
EXEDIR = ${EXEDIR} |
2763 |
EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} |
EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} |
2764 |
TOOLSDIR = ${TOOLSDIR} |
TOOLSDIR = ${TOOLSDIR} |
2765 |
|
OADTOOLS = ${OADTOOLS} |
2766 |
|
|
2767 |
#eh3 new defines for the adjoint work |
#eh3 new defines for the adjoint work |
2768 |
AUTODIFF = ${ROOTDIR}/pkg/autodiff |
AUTODIFF = ${ROOTDIR}/pkg/autodiff |
2783 |
echo "EMBEDDED_FILES = " >>$MAKEFILE |
echo "EMBEDDED_FILES = " >>$MAKEFILE |
2784 |
fi |
fi |
2785 |
|
|
2786 |
|
# extract default cpp search path so we can pass it to makedepend |
2787 |
|
CPPINCLUDES=`cat /dev/null | $CPP -v 2>&1 | awk '/^End of search/{f=0}!/^\#/{if(f){printf " -I%s", $1;}}/^\#include "..." search start/{f=1}'` |
2788 |
|
|
2789 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2790 |
# Unix ln (link) |
# Unix ln (link) |
2791 |
LN = ${LN} |
LN = ${LN} |
|
# C preprocessor |
|
|
CPP = cat \$< | ${S64} | ${CPP} |
|
2792 |
# Dependency generator |
# Dependency generator |
2793 |
MAKEDEPEND = ${MAKEDEPEND} |
MAKEDEPEND = ${MAKEDEPEND} |
2794 |
# Special preprocessor (KAP on DECs, FPP on Crays) |
# Special preprocessor (KAP on DECs, FPP on Crays) |
2806 |
DEFINES = ${DEFINES} |
DEFINES = ${DEFINES} |
2807 |
# Includes for CPP |
# Includes for CPP |
2808 |
INCLUDES = ${INCLUDES} |
INCLUDES = ${INCLUDES} |
2809 |
|
# default CPP includes for makedepend |
2810 |
|
CPPINCLUDES = ${CPPINCLUDES} |
2811 |
# Flags for KPP |
# Flags for KPP |
2812 |
KFLAGS1 = ${KFLAGS1} |
KFLAGS1 = ${KFLAGS1} |
2813 |
KFLAGS2 = ${KFLAGS2} |
KFLAGS2 = ${KFLAGS2} |
2873 |
|
|
2874 |
depend: |
depend: |
2875 |
@\$(MAKE) -f \$(MAKEFILE) links |
@\$(MAKE) -f \$(MAKEFILE) links |
2876 |
\$(MAKEDEPEND) -f \$(MAKEFILE) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES) |
\$(MAKEDEPEND) -f \$(MAKEFILE) -o .$FS \$(DEFINES) \$(INCLUDES) \$(CPPINCLUDES) \$(F77_SRC_FILES) |
2877 |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
2878 |
-rm -f makedepend.out |
-rm -f makedepend.out |
2879 |
|
|
2973 |
## This nullifies any default implicit rules concerning these two file types: |
## This nullifies any default implicit rules concerning these two file types: |
2974 |
## %.o : %.F |
## %.o : %.F |
2975 |
|
|
2976 |
|
# C preprocessing and replacing the _d in constants: |
2977 |
|
CPPCMD = cat \$< | ${CPP} \$(DEFINES) \$(INCLUDES) | ${S64} |
2978 |
|
|
2979 |
.F.$FS: |
.F.$FS: |
2980 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPPCMD) > \$@ |
2981 |
.$FS.o: |
.$FS.o: |
2982 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
2983 |
.F.o: |
.F.o: |
2984 |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
\$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< |
2985 |
.F90.$FS90: |
.F90.$FS90: |
2986 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPPCMD) > \$@ |
2987 |
.FF90.f$FS90: |
.FF90.f$FS90: |
2988 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPPCMD) > \$@ |
2989 |
.$FS90.o: |
.$FS90.o: |
2990 |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
2991 |
.f$FS90.o: |
.f$FS90.o: |
2994 |
.c.o: |
.c.o: |
2995 |
\$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$< |
\$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$< |
2996 |
.flow.flowdir: |
.flow.flowdir: |
2997 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPPCMD) > \$@ |
2998 |
|
|
2999 |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
3000 |
.F.p: |
.F.p: |
3001 |
\$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ |
\$(CPPCMD) > \$@ |
3002 |
.p.$FS: |
.p.$FS: |
3003 |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
\$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< |
3004 |
|
|
3056 |
@-rm -f ad_config.template |
@-rm -f ad_config.template |
3057 |
\$(MAKE) -f \$(MAKEFILE) \$(EXE_AD) |
\$(MAKE) -f \$(MAKEFILE) \$(EXE_AD) |
3058 |
|
|
3059 |
ad_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES) \$(AD_FLOW_FILES) |
ad_input_code.$FS: \$(AD_FILES) \$(AD_FLOW_FILES) |
3060 |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Adjoint version" -bAD_CONFIG_H -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Adjoint version" -bAD_CONFIG_H -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template |
3061 |
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 |
3062 |
@-rm -f ad_config.template |
@-rm -f ad_config.template |
3074 |
ls -l ad_input_code_ad.$FS |
ls -l ad_input_code_ad.$FS |
3075 |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS |
cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS |
3076 |
|
|
3077 |
\${EXE_AD}: ad_taf_output.o \$(OBJFILES) |
\$(EXE_AD): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) ad_taf_output.o \$(OBJFILES) \$(EMBEDDED_FILES) |
3078 |
\$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
\$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) |
3079 |
|
|
3080 |
ad_tamc_output.$FS: ad_input_code.$FS |
ad_tamc_output.$FS: ad_input_code.$FS |
3104 |
@-rm -f ad_config.template |
@-rm -f ad_config.template |
3105 |
\$(MAKE) -f \$(MAKEFILE) \$(EXE_FTL) |
\$(MAKE) -f \$(MAKEFILE) \$(EXE_FTL) |
3106 |
|
|
3107 |
ftl_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES) |
ftl_input_code.$FS: \$(AD_FILES) |
3108 |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "TangLin version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ad_config.template |
@$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "TangLin version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ad_config.template |
3109 |
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 |
3110 |
@-rm -f ad_config.template |
@-rm -f ad_config.template |
3122 |
ls -l ftl_input_code_ftl.$FS |
ls -l ftl_input_code_ftl.$FS |
3123 |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS |
cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS |
3124 |
|
|
3125 |
\${EXE_FTL}: ftl_taf_output.o \$(OBJFILES) |
\$(EXE_FTL): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) ftl_taf_output.o \$(OBJFILES) \$(EMBEDDED_FILES) |
3126 |
\$(LINK) -o \${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
\$(LINK) -o \${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) |
3127 |
|
|
3128 |
ftl_tamc_output.$FS: ftl_input_code.$FS |
ftl_tamc_output.$FS: ftl_input_code.$FS |
3238 |
OAD_active.F90 \ |
OAD_active.F90 \ |
3239 |
OAD_cp.F90 \ |
OAD_cp.F90 \ |
3240 |
OAD_rev.F90 \ |
OAD_rev.F90 \ |
3241 |
OAD_tape.F90 |
OAD_tape.F90 \ |
3242 |
|
revolve.F90 |
3243 |
|
|
3244 |
OPENAD_SUPPORT_C_SRC_FILES = \ |
OPENAD_SUPPORT_C_SRC_FILES = \ |
3245 |
iaddr.c \ |
iaddr.c \ |
3265 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS) |
3266 |
|
|
3267 |
# create sources files modules from header files containing common blocks |
# create sources files modules from header files containing common blocks |
3268 |
%_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk |
%_mod.FF90 : %.h \${OADTOOLS}/cb2mGetModules.csh \${OADTOOLS}/cb2mGetModules.awk |
3269 |
../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk |
\${OADTOOLS}/cb2mGetModules.csh $< \${OADTOOLS}/cb2mGetModules.awk |
3270 |
|
|
3271 |
# create new header files with USE statements for the new modules made above |
# create new header files with USE statements for the new modules made above |
3272 |
%_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk |
%_mod.h : %.h \${OADTOOLS}/cb2mGetHeaders.csh \${OADTOOLS}/cb2mGetHeaders.awk |
3273 |
../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) |
\${OADTOOLS}/cb2mGetHeaders.csh $< \${OADTOOLS}/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) |
3274 |
|
|
3275 |
# change the include directives of everybody to refer to the new header files with the USE statements |
# change the include directives of everybody to refer to the new header files with the USE statements |
3276 |
%_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash |
%_cb2m.FF90 : %.F \${OADTOOLS}/cb2mUseModules.bash |
3277 |
../OAD_support/cb2mUseModules.bash $< ${MPI} |
\${OADTOOLS}/cb2mUseModules.bash $< ${MPI} |
3278 |
|
|
3279 |
# makefile debug rule |
# makefile debug rule |
3280 |
small_f: \$(CB2M_F90_PP_SRC_FILES) |
small_f: \$(CB2M_F90_PP_SRC_FILES) |
3296 |
|
|
3297 |
# replace stop statements (to avoid the implied unstructured control flow) with print statements |
# replace stop statements (to avoid the implied unstructured control flow) with print statements |
3298 |
ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90 |
ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90 |
3299 |
cat \$< | sed -f ../OAD_support/stop2print.sed > ad_input_code_sf.pre.s2p.f90 |
cat \$< | sed -f \${OADTOOLS}/stop2print.sed > ad_input_code_sf.pre.s2p.f90 |
3300 |
|
|
3301 |
# F -> WHIRL |
# F -> WHIRL |
3302 |
ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90 |
ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90 |
3319 |
\${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$< |
\${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$< |
3320 |
|
|
3321 |
# insert template directives |
# insert template directives |
3322 |
ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash |
ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 \${OADTOOLS}/insertTemplateDir.bash |
3323 |
../OAD_support/insertTemplateDir.bash \$< \$@ |
\${OADTOOLS}/insertTemplateDir.bash \$< \$@ |
3324 |
|
|
3325 |
PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F |
PPEXTRAS=\$(wildcard \${OADTOOLS}/ad_template.*.F) \${OADTOOLS}/ad_inline.F |
3326 |
# postprocess F' |
# postprocess F' |
3327 |
postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90 |
postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90 |
3328 |
\${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i ../OAD_support/ad_inline.f \$< |
\${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i \${OADTOOLS}/ad_inline.f \$< |
3329 |
# the target is a placeholder to trigger a single execution of the rule |
# the target is a placeholder to trigger a single execution of the rule |
3330 |
touch \$@ |
touch \$@ |
3331 |
# put this so make knows about the postprocessing output |
# put this so make knows about the postprocessing output |
3337 |
|
|
3338 |
# link the support files: |
# link the support files: |
3339 |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES): |
\$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES): |
3340 |
\$(LN) ../OAD_support/\$@ . |
\$(LN) \${OADTOOLS}/\$@ . |
3341 |
|
|
3342 |
AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f) |
AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f) |
3343 |
|
|