/[MITgcm]/MITgcm/tools/genmake2
ViewVC logotype

Annotation of /MITgcm/tools/genmake2

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.33 - (hide annotations) (download)
Thu Nov 13 15:10:40 2003 UTC (20 years, 4 months ago) by adcroft
Branch: MAIN
Changes since 1.32: +11 -1 lines
Added backup selection of xmakedepend in TOOLSDIR for occasions when makedepend does not exist on the system (e.g. new and partial Linux installs).

1 edhill 1.1 #!/bin/bash
2     #
3 adcroft 1.33 # $Header: /u/gcmpack/MITgcm/tools/genmake2,v 1.32 2003/11/12 22:05:47 edhill Exp $
4 edhill 1.1 #
5     # Makefile generator for MITgcm UV codes
6     # created by cnh 03/98
7     # adapted by aja 06/98
8     # modified by aja 01/00
9     # rewritten in bash by eh3 08/03
10    
11 edhill 1.12 # Search for particular CPP #cmds associated with packages
12     # usage: test_for_package_in_cpp_options CPP_file package_name
13     test_for_package_in_cpp_options() {
14     cpp_options=$1
15     pkg=$2
16     grep -i "#define.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1
17     RETVAL=$?
18     if test "x${RETVAL}" = x0 ; then
19     echo "Error: In $cpp_options there is an illegal line: #define ALLOW_$pkg"
20     exit 99
21     fi
22     grep -i "#undef.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1
23     RETVAL=$?
24     if test "x${RETVAL}" = x0 ; then
25     echo "Error: In $cpp_options there is an illegal line: #undef ALLOW_$pkg"
26     exit 99
27     fi
28     grep -i "#define.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1
29     RETVAL=$?
30     if test "x${RETVAL}" = x0 ; then
31     echo "Error: In $cpp_options there is an illegal line: #define DISABLE_$pkg"
32     exit 99
33     fi
34     grep -i "#undef.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1
35     RETVAL=$?
36     if test "x${RETVAL}" = x0 ; then
37     echo "Error: In $cpp_options there is an illegal line: #undef DISABLE_$pkg"
38     exit 99
39     fi
40     }
41    
42     # Read the $ROOTDIR/pkg/pkg_groups file and expand any references to
43     # the package list.
44     expand_pkg_groups() {
45     new_packages=
46     PKG_GROUPS=$ROOTDIR"/pkg/pkg_groups"
47     if test -r $PKG_GROUPS ; then
48     cat $PKG_GROUPS | sed -e 's/#.*$//g' | sed -e 's/:/ : /g' > ./p1.tmp
49 edhill 1.15 cat ./p1.tmp | $AWK '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp
50 edhill 1.12 matched=0
51     for i in $PACKAGES ; do
52     line=`grep "^ *$i" ./p2.tmp`
53     RETVAL=$?
54     if test "x$RETVAL" = x0 ; then
55     matched=1
56 edhill 1.15 replace=`echo $line | $AWK '{ $1=""; $2=""; print $0 }'`
57 edhill 1.12 echo " replacing \"$i\" with: $replace"
58     new_packages="$new_packages $replace"
59     else
60     new_packages="$new_packages $i"
61     fi
62     done
63     PACKAGES=$new_packages
64     rm -f ./p[1,2].tmp
65     else
66     echo "Warning: can't read package groups definition file: $PKG_GROUPS"
67     fi
68     }
69 edhill 1.1
70     # Guess possible config options for this host
71     find_possible_configs() {
72    
73 edhill 1.11 tmp1=`uname`"_"`uname -m`
74     tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
75 edhill 1.25 tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
76     PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
77 edhill 1.11 OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
78     echo " The platform appears to be: $PLATFORM"
79     # if test "x$OFLIST" = x ; then
80     # echo " No pre-defined options files were found matching this platform"
81     # echo " but examples for other platforms can be found in:"
82     # echo " $ROOTDIR/tools/build_options"
83     # else
84     # echo " Options files (located in $ROOTDIR/tools/build_options) that"
85     # echo " may work with this machine are:"
86     # for i in $OFLIST ; do
87     # echo " $i"
88     # done
89     # fi
90    
91 edhill 1.1 echo "test" > test
92     ln -s ./test link
93     RETVAL=$?
94     if test "x${RETVAL}" = x0 ; then
95 edhill 1.11 LN="ln -s"
96     else
97     echo "Error: \"ln -s\" does not appear to work on this system!"
98     echo " For help, please contact <MITgcm-support@mitgcm.org>."
99     exit 1
100 edhill 1.1 fi
101     rm -f test link
102    
103 edhill 1.11 if test "x$CPP" = x ; then
104     CPP="cpp -traditional -P"
105 adcroft 1.33 fi
106    
107     # makedepend is not always available
108     if test "x${MAKEDEPEND}" = x ; then
109     which makedepend >& /dev/null
110     RETVAL=$?
111     if test "x${RETVAL}" = x1 ; then
112     echo " makedepend was not found. Using xmakedpend instead."
113     MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
114     fi
115 edhill 1.1 fi
116    
117     # look for possible fortran compilers
118 cnh 1.24 tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95"
119 edhill 1.1 p_FC=
120 edhill 1.11 for c in $tmp ; do
121     rm -f ./hello.f ./hello
122     cat >> hello.f <<EOF
123     program hello
124     do i=1,3
125     print *, 'hello world : ', i
126     enddo
127     end
128     EOF
129     $c -o hello hello.f > /dev/null 2>&1
130 edhill 1.1 RETVAL=$?
131     if test "x${RETVAL}" = x0 ; then
132     p_FC="$p_FC $c"
133     fi
134     done
135 edhill 1.21 rm -f ./hello.f ./hello
136 edhill 1.1 if test "x${p_FC}" = x ; then
137 edhill 1.11 cat 1>&2 <<EOF
138    
139     Error: No Fortran compilers were found in your path. Please specify one using:
140    
141     1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"),
142     2) a command-line option (eg. "-fc NAME"), or
143     3) the MITGCM_FC environment variable.
144    
145     EOF
146     exit 1
147 edhill 1.1 else
148 edhill 1.11 echo " The possible FORTRAN compilers found in your path are:"
149     echo " "$p_FC
150     if test "x$FC" = x ; then
151 edhill 1.15 FC=`echo $p_FC | $AWK '{print $1}'`
152 edhill 1.11 fi
153 edhill 1.1 fi
154    
155 edhill 1.11 for i in $p_FC ; do
156     p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i
157     if test -r $p_OF ; then
158     OPTFILE=$p_OF
159     echo " The options file: $p_OF"
160     echo " appears to match so we'll use it."
161     break
162     fi
163     done
164     if test "x$OPTFILE" = x ; then
165     cat 1>&2 <<EOF
166    
167     Error: No options file was found in: $ROOTDIR/tools/build_options/
168     that matches this platform ("$PLATFORM") and the compilers found in
169     your path. Please specify an "optfile" using:
170    
171     1) the command line (eg. "-optfile=path/to/OPTFILE"), or
172     2) the MITGCM_OF environment variable.
173    
174     If you need help, please contact the developers at <MITgcm-support@mitgcm.org>.
175    
176 edhill 1.1 EOF
177 edhill 1.11 exit 1
178 edhill 1.1 fi
179 edhill 1.11
180     # # look for possible MPI libraries
181     # mpi_libs=
182     # mpi_fort=`which mpif77 2>/dev/null`
183     # RETVAL=$?
184     # if test "x${RETVAL}" = x0 ; then
185     # cat >>test.f <<EOF
186     # PROGRAM HELLO
187     # DO 10, I=1,10
188     # PRINT *,'Hello World'
189     # 10 CONTINUE
190     # STOP
191     # END
192     # EOF
193     # eval "$mpi_fort -showme test.f > out"
194     # RETVAL=$?
195     # if test "x${RETVAL}" = x0 ; then
196     # a=`cat out`
197     # for i in $a ; do
198     # case $i in
199     # -*)
200     # mpi_libs="$mpi_libs $i" ;;
201     # esac
202     # done
203     # echo "The MPI libs appear to be:"
204     # echo " "$mpi_libs
205     # fi
206     # rm -f test.f out
207     # fi
208 edhill 1.1
209     }
210    
211     # Parse the package dependency information
212     get_pdepend_list() {
213    
214     # strip the comments and then convert the dependency file into
215     # two arrays: PNAME, DNAME
216     cat $1 | sed -e 's/#.*$//g' \
217 edhill 1.15 | $AWK 'BEGIN{nn=0;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME["nn"]="$1"\nDNAME["nn"]="$i} }' \
218 edhill 1.1 > ./.pd_tmp
219     source ./.pd_tmp
220     rm -f ./.pd_tmp
221    
222     echo -n "PNAME = "${}
223     }
224    
225    
226     # Explain usage
227     usage() {
228 edhill 1.2 echo
229 edhill 1.1 echo "Usage: "$0" [OPTIONS]"
230 edhill 1.2 echo " where [OPTIONS] can be:"
231     echo
232 edhill 1.1 echo " -help | --help | -h | --h"
233     echo " -nooptfile | --nooptfile"
234     echo " -optfile NAME | --optfile NAME | -of NAME | --of NAME"
235     echo " -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME"
236     echo " -pdepend NAME | --pdepend NAME"
237     echo " -pdepend=NAME | --pdepend=NAME"
238     echo " -pdefault NAME | --pdefault NAME"
239     echo " -pdefault=NAME | --pdefault=NAME"
240 edhill 1.6 echo " -make NAME | -m NAME"
241     echo " --make=NAME | -m=NAME"
242     echo " -makefile NAME | -mf NAME"
243     echo " --makefile=NAME | -mf=NAME"
244 edhill 1.1 echo " -platform NAME | --platform NAME | -pl NAME | --pl NAME"
245     echo " -platform=NAME | --platform=NAME | -pl=NAME | --pl=NAME"
246     echo " -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME"
247     echo " -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME"
248     echo " -mods NAME | --mods NAME | -mo NAME | --mo NAME"
249     echo " -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME"
250     echo " -disable NAME | --disable NAME"
251     echo " -disable=NAME | --disable=NAME"
252     echo " -enable NAME | --enable NAME"
253     echo " -enable=NAME | --enable=NAME"
254 edhill 1.12 echo " -standarddirs NAME | --standarddirs NAME"
255     echo " -standarddirs=NAME | --standarddirs=NAME"
256 edhill 1.1 echo " -noopt NAME | --noopt NAME"
257     echo " -noopt=NAME | --noopt=NAME"
258     # echo " -cpp NAME | --cpp NAME"
259     # echo " -cpp=NAME | --cpp=NAME"
260     echo " -fortran NAME | --fortran NAME | -fc NAME | --fc NAME"
261     echo " -fc=NAME | --fc=NAME"
262     echo " -[no]ieee | --[no]ieee"
263     echo " -[no]mpi | --[no]mpi"
264 edhill 1.2 echo " -[no]jam | --[no]jam"
265     echo
266     echo " and NAME is a string such as:"
267     echo
268 edhill 1.1 echo " --enable pkg1 --enable 'pkg1 pkg2' --enable 'pkg1 pkg2 pkg3'"
269     echo " -mods=dir1 -mods='dir1' -mods='dir1 dir2 dir3'"
270 edhill 1.2 echo " -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'"
271     echo
272 edhill 1.1 echo " which, depending upon your shell, may need to be single-quoted"
273     echo " if it contains spaces, dashes, or other special characters."
274     exit 1
275     }
276    
277 edhill 1.31 # Build a CPP macro to automate calling C routines from FORTRAN
278     get_fortran_c_namemangling() {
279     default_nm="#define FC_NAMEMANGLE(X) X ## _"
280    
281     cat > genmake_test.c <<EOF
282     void tcall( char * string ) { tsub( string ); }
283     EOF
284     $MAKE genmake_test.o > genmake_test.log 2>&1
285     RETVAL=$?
286     if test "x$RETVAL" != x0 ; then
287     cat genmake_test.log >> genmake_errors
288     FC_NAMEMANGLE=$default_nm
289     echo
290     echo "WARNING: C test compile fails -- please see \"genmake_errors\""
291     echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
292     echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
293     return 1
294     fi
295     c_tcall=`nm genmake_test.o | grep tcall | cut -d ' ' -f 3`
296     RETVAL=$?
297     if test "x$RETVAL" != x0 ; then
298     FC_NAMEMANGLE=$default_nm
299     echo
300     echo "WARNING: The \"nm\" command failed."
301     echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
302     echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
303     return 1
304     fi
305     cat > genmake_tcomp.f <<EOF
306     subroutine tcall( string )
307     character*(*) string
308     call tsub( string )
309     end
310     EOF
311     $FC $FFLAGS $DEFINES -c genmake_tcomp.f > genmake_tcomp.log 2>&1
312     RETVAL=$?
313     if test "x$RETVAL" != x0 ; then
314     cat genmake_tcomp.log >> genmake_errors
315     FC_NAMEMANGLE=$default_nm
316     echo
317     echo "WARNING: FORTRAN test compile fails -- please see \"genmake_errors\""
318     echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
319     echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
320     return 1
321     fi
322     f_tcall=`nm genmake_tcomp.o | grep tcall | cut -d ' ' -f 3`
323     RETVAL=$?
324     if test "x$RETVAL" != x0 ; then
325     FC_NAMEMANGLE=$default_nm
326     echo
327     echo "WARNING: The \"nm\" command failed."
328     echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
329     echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
330     return 1
331     fi
332    
333     c_a=`echo $c_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 1 | sed -e 's|Y||'`
334     f_a=`echo $f_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 1 | sed -e 's|Y||'`
335     c_b=`echo $c_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 2 | sed -e 's|Y||'`
336     f_b=`echo $f_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 2 | sed -e 's|Y||'`
337    
338     nmangle="X"
339     if test "x$c_a" != "x$f_a" ; then
340     comm="echo x$f_a | sed -e 's|x$c_a||'"
341     a=`eval $comm`
342     nmangle="$a ## $nmangle"
343     fi
344     if test "x$c_b" != "x$f_b" ; then
345     comm="echo x$f_b | sed -e 's|x$c_b||'"
346     b=`eval $comm`
347     nmangle="$nmangle ## $b"
348     fi
349    
350     FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) $nmangle"
351 edhill 1.32
352     # cleanup the testing files
353     rm -f genmake_tcomp.* genmake_test.*
354 edhill 1.31 }
355 edhill 1.1
356     # Set defaults here
357 edhill 1.5 COMMANDL="$0 $@"
358    
359 edhill 1.1 PLATFORM=
360     LN=
361     S64=
362     KPP=
363     FC=
364     LINK=
365 edhill 1.31 # DEFINES="-DWORDLENGTH=4"
366     DEFINES=
367 edhill 1.1 PACKAGES=
368     ENABLE=
369     DISABLE=
370     MAKEFILE=
371     MAKEDEPEND=
372     PDEPEND=
373 edhill 1.11 DUMPSTATE=t
374 edhill 1.1 PDEFAULT=
375     OPTFILE=
376 edhill 1.2 INCLUDES="-I."
377 edhill 1.1 FFLAGS=
378     FOPTIM=
379     CFLAGS=
380     KFLAGS1=
381     KFLAGS2=
382     LIBS=
383     KPPFILES=
384     NOOPTFILES=
385     NOOPTFLAGS=
386    
387 edhill 1.29 # DEFINES checked by test compilation
388     HAVE_SYSTEM=
389     HAVE_FDATE=
390     FC_NAMEMANGLE=
391    
392 edhill 1.1 MODS=
393     TOOLSDIR=
394     SOURCEDIRS=
395     INCLUDEDIRS=
396 edhill 1.12 STANDARDDIRS=
397 edhill 1.1
398     PWD=`pwd`
399     MAKE=make
400 edhill 1.15 AWK=awk
401 edhill 1.1 THISHOSTNAME=`hostname`
402     THISCWD=`pwd`
403     THISDATE=`date`
404     MACHINE=`uname -a`
405 edhill 1.7 EXECUTABLE=
406     EXEHOOK=
407     EXEDIR=
408 edhill 1.12 PACKAGES_CONF=
409     IEEE=
410     if test "x$MITGCM_IEEE" != x ; then
411     IEEE=$MITGCM_IEEE
412     fi
413 edhill 1.1
414 edhill 1.14 AUTODIFF_PKG_USED=f
415     AD_OPTFILE=
416 edhill 1.17 TAF=
417     AD_TAF_FLAGS=
418     FTL_TAF_FLAGS=
419     SVD_TAF_FLAGS=
420     TAF_EXTRA=
421     TAMC=
422     AD_TAMC_FLAGS=
423     FTL_TAF_FLAGS=
424     SVD_TAMC_FLAGS=
425     TAMC_EXTRA=
426    
427 edhill 1.14
428 edhill 1.5 # The following state can be set directly by command-line switches
429     gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"
430 edhill 1.12 gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS"
431 edhill 1.5
432     # The following state is not directly set by command-line switches
433     gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM "
434     gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
435     gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"
436 edhill 1.12 gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
437 edhill 1.29 gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE"
438 edhill 1.5
439 edhill 1.14 # The following are all related to adjoint/tangent-linear stuff
440 edhill 1.29 gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"
441     gm_s11="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS"
442     gm_s12="TAF_EXTRA TAMC_EXTRA"
443 edhill 1.14
444 edhill 1.29 gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7"
445     gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"
446 edhill 1.5
447    
448 edhill 1.2 echo
449     echo "=== Processing options files and arguments ==="
450 edhill 1.12 gm_local="genmake_local"
451     for i in . $MODS ; do
452     if test -r $i/$gm_local ; then
453     source $i/$gm_local
454     break
455     fi
456     done
457 edhill 1.1 echo -n " getting local config information: "
458     if test -e $gm_local ; then
459     echo "using $gm_local"
460     source $gm_local
461 edhill 1.2 # echo "DISABLE=$DISABLE"
462     # echo "ENABLE=$ENABLE"
463 edhill 1.1 else
464     echo "none found"
465     fi
466    
467     # echo "$0::$1:$2:$3:$4:$5:$6:$7:"
468 edhill 1.2 #OPTIONS=
469     #n=0
470     #for i ; do
471     # echo "$i $n"
472     # setvar="OPTIONS[$n]='$i'"
473     # # echo " $setvar"
474     # eval "$setvar"
475     # n=$(( $n + 1 ))
476     #done
477     #parse_options
478     ac_prev=
479     for ac_option ; do
480    
481     # If the previous option needs an argument, assign it.
482     if test -n "$ac_prev"; then
483     eval "$ac_prev=\$ac_option"
484     ac_prev=
485     continue
486     fi
487    
488     ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
489    
490     case $ac_option in
491    
492     -help | --help | -h | --h)
493     usage ;;
494    
495     -nooptfile | --nooptfile)
496     OPTFILE="NONE" ;;
497     -optfile | --optfile | -of | --of)
498 edhill 1.4 ac_prev=OPTFILE ;;
499 edhill 1.2 -optfile=* | --optfile=* | -of=* | --of=*)
500     OPTFILE=$ac_optarg ;;
501    
502 edhill 1.14 -adoptfile | --adoptfile | -ad | --ad)
503     ac_prev=AD_OPTFILE ;;
504     -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)
505     AD_OPTFILE=$ac_optarg ;;
506    
507 edhill 1.2 -pdepend | --pdepend)
508 edhill 1.4 ac_prev=PDEPEND ;;
509 edhill 1.2 -pdepend=* | --pdepend=*)
510     PDEPEND=$ac_optarg ;;
511    
512     -pdefault | --pdefault)
513 edhill 1.4 ac_prev=PDEFAULT ;;
514 edhill 1.2 -pdefault=* | --pdefault=*)
515     PDEFAULT=$ac_optarg ;;
516    
517 edhill 1.6 -make | --make | -m | --m)
518     ac_prev=MAKE ;;
519     -make=* | --make=* | -m=* | --m=*)
520     MAKE=$ac_optarg ;;
521    
522     -makefile | --makefile | -ma | --ma)
523 edhill 1.4 ac_prev=MAKEFILE ;;
524 edhill 1.6 -makefile=* | --makefile=* | -ma=* | --ma=*)
525 edhill 1.2 MAKEFILE=$ac_optarg ;;
526    
527     -platform | --platform | -pl | --pl)
528 edhill 1.4 ac_prev=PLATFORM ;;
529 edhill 1.2 -platform=* | --platform=* | -pl=* | --pl=*)
530     PLATFORM=$ac_optarg ;;
531    
532     -rootdir | --rootdir | -rd | --rd)
533 edhill 1.4 ac_prev=ROOTDIR ;;
534 edhill 1.2 -rootdir=* | --rootdir=* | -rd=* | --rd=*)
535     ROOTDIR=$ac_optarg ;;
536    
537     -mods | --mods | -mo | --mo)
538 edhill 1.4 ac_prev=MODS ;;
539 edhill 1.2 -mods=* | --mods=* | -mo=* | --mo=*)
540     MODS=$ac_optarg ;;
541    
542     -disable | --disable)
543 edhill 1.4 ac_prev=DISABLE ;;
544 edhill 1.2 -disable=* | --disable=*)
545     DISABLE=$ac_optarg ;;
546    
547     -enable | --enable)
548 edhill 1.4 ac_prev=ENABLE ;;
549 edhill 1.2 -enable=* | --enable=*)
550     ENABLE=$ac_optarg ;;
551    
552 edhill 1.12 -standarddirs | --standarddirs)
553     ac_prev=STANDARDDIRS ;;
554     -standarddirs=* | --standarddirs=*)
555     STANDARDDIRS=$ac_optarg ;;
556    
557 edhill 1.2 -noopt | --noopt)
558 edhill 1.4 ac_prev=NOOPT ;;
559 edhill 1.2 -noopt=* | --noopt=*)
560     NOOPT=$ac_optarg ;;
561    
562     # -cpp | --cpp)
563     # ac_prev=cpp ;;
564     # -cpp=* | --cpp=*)
565     # CPP=$ac_optarg ;;
566    
567     -fortran | --fortran | -fc | --fc)
568 edhill 1.4 ac_prev=FC ;;
569 edhill 1.2 -fc=* | --fc=*)
570     FC=$ac_optarg ;;
571    
572     -ieee | --ieee)
573 edhill 1.12 IEEE=true ;;
574 edhill 1.2 -noieee | --noieee)
575 edhill 1.12 IEEE= ;;
576 edhill 1.2
577     -mpi | --mpi)
578 edhill 1.12 MPI=true ;;
579 edhill 1.2 -nompi | --nompi)
580 edhill 1.12 MPI= ;;
581 edhill 1.2
582     -jam | --jam)
583     JAM=1 ;;
584     -nojam | --nojam)
585     JAM=0 ;;
586    
587 edhill 1.5 -ds | --ds)
588     DUMPSTATE=t ;;
589    
590 edhill 1.17 -taf_extra | --taf_extra)
591     ac_prev=TAF_EXTRA ;;
592     -taf_extra=* | --taf_extra=*)
593     TAF_EXTRA=$ac_optarg ;;
594    
595     -tamc_extra | --tamc_extra)
596     ac_prev=TAMC_EXTRA ;;
597     -tamc_extra=* | --tamc_extra=*)
598     TAMC_EXTRA=$ac_optarg ;;
599    
600 edhill 1.2 -*)
601     echo "Error: unrecognized option: "$ac_option
602     usage
603     ;;
604    
605     *)
606     echo "Error: unrecognized argument: "$ac_option
607     usage
608     ;;
609    
610     esac
611    
612 edhill 1.1 done
613    
614 edhill 1.12 if test -f ./.genmakerc ; then
615     echo
616     echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
617     echo " file. This file format is no longer supported. Please see:"
618     echo
619     echo " http://mitgcm.org/devel_HOWTO/"
620     echo
621     echo " for directions on how to setup and use the new \"genmake2\" input"
622     echo " files and send an email to MITgcm-support@mitgcm.org if you want help."
623     echo
624     fi
625    
626 edhill 1.11 if test "x${ROOTDIR}" = x ; then
627     if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then
628     ROOTDIR=".."
629     else
630     for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do
631     if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then
632     ROOTDIR=$d
633     echo -n "Warning: ROOTDIR was not specified but there appears to be"
634     echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."
635     break
636     fi
637     done
638     fi
639     fi
640     if test "x${ROOTDIR}" = x ; then
641     echo "Error: Cannot determine ROOTDIR for MITgcm code."
642     echo " Please specify a ROOTDIR using either an options "
643     echo " file or a command-line option."
644     exit 1
645     fi
646     if test ! -d ${ROOTDIR} ; then
647     echo "Error: the specified ROOTDIR (\"$ROOTDIR\") does not exist!"
648     exit 1
649     fi
650    
651 edhill 1.1 echo " getting OPTFILE information: "
652     if test "x${OPTFILE}" = x ; then
653 edhill 1.11 if test "x$MITGCM_OF" = x ; then
654     echo "Warning: no OPTFILE specified so we'll look for possible settings"
655     printf "\n=== Searching for possible settings for OPTFILE ===\n"
656     find_possible_configs
657 edhill 1.1 else
658 edhill 1.11 OPTFILE=$MITGCM_OF
659     fi
660     fi
661     if test "x$OPTFILE" != xNONE ; then
662     if test -f "$OPTFILE" -a -r "$OPTFILE" ; then
663     echo " using OPTFILE=\"$OPTFILE\""
664     source "$OPTFILE"
665     RETVAL=$?
666     if test "x$RETVAL" != x0 ; then
667     echo -n "Error: failed to source OPTFILE \"$OPTFILE\""
668     echo "--please check that variable syntax is bash-compatible"
669 edhill 1.1 exit 1
670     fi
671 edhill 1.11 if test "x$DUMPSTATE" != xf ; then
672 edhill 1.12 cp -f $OPTFILE "genmake_optfile"
673 edhill 1.11 fi
674     else
675     echo "Error: can't read OPTFILE=\"$OPTFILE\""
676     exit 1
677 edhill 1.1 fi
678     fi
679 edhill 1.8
680 edhill 1.14 echo " getting AD_OPTFILE information: "
681     if test "x${AD_OPTFILE}" = x ; then
682     if test "x$MITGCM_AD_OF" = x ; then
683     AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default
684     else
685     AD_OPTFILE=$MITGCM_AD_OF
686     fi
687     fi
688     if test "x${AD_OPTFILE}" != xNONE ; then
689     if test -f "$AD_OPTFILE" -a -r "$AD_OPTFILE" ; then
690     echo " using AD_OPTFILE=\"$AD_OPTFILE\""
691     source "$AD_OPTFILE"
692     RETVAL=$?
693     if test "x$RETVAL" != x0 ; then
694     echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""
695     echo "--please check that variable syntax is bash-compatible"
696     exit 1
697     fi
698     if test "x$DUMPSTATE" != xf ; then
699     cp -f $AD_OPTFILE "genmake_ad_optfile"
700     fi
701     else
702     echo "Error: can't read AD_OPTFILE=\"$AD_OPTFILE\""
703     exit 1
704     fi
705     fi
706    
707 edhill 1.8 # Check that FC, LINK, CPP, and S64 are defined. If not, complain
708     # and abort!
709     if test "x$FC" = x ; then
710     cat <<EOF 1>&2
711    
712     Error: no Fortran compiler: please specify using one of the following:
713     1) within the options file ("FC=...") as specified by "-of=OPTFILE"
714     2) the "-fc=XXX" command-line option
715 edhill 1.12 3) the "./genmake_local" file
716 edhill 1.8 EOF
717     exit 1
718     fi
719     if test "x$LINK" = x ; then
720     LINK=$FC
721     fi
722     if test "x$CPP" = x ; then
723 edhill 1.11 CPP="cpp"
724     fi
725 edhill 1.13 echo "#define A a" | $CPP > test_cpp 2>&1
726 edhill 1.11 RETVAL=$?
727     if test "x$RETVAL" != x0 ; then
728 edhill 1.8 cat <<EOF 1>&2
729    
730 edhill 1.11 Error: C pre-processor "$CPP" failed the test case: please specify using:
731    
732 edhill 1.8 1) within the options file ("CPP=...") as specified by "-of=OPTFILE"
733 edhill 1.12 2) the "./genmake_local" file
734 edhill 1.30 3) with the CPP environment variable
735 edhill 1.11
736 edhill 1.8 EOF
737     exit 1
738 edhill 1.11 else
739     rm -f test_cpp
740 edhill 1.8 fi
741 edhill 1.11 if test "x$MAKEDEPEND" = x ; then
742     MAKEDEPEND=makedepend
743 edhill 1.8 fi
744 edhill 1.29
745    
746     printf "\n=== Checking system libraries ===\n"
747     echo -n " Do we have the system() command using $FC... "
748     cat > genmake_tcomp.f <<EOF
749     program hello
750     call system('echo hi')
751     end
752     EOF
753     $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1
754     RETVAL=$?
755     if test "x$RETVAL" = x0 ; then
756     HAVE_SYSTEM=t
757     DEFINES="$DEFINES -DHAVE_SYSTEM"
758     echo "yes"
759     else
760     HAVE_SYSTEM=
761     echo "no"
762     fi
763     rm -f genmake_tcomp*
764    
765     echo -n " Do we have the fdate() command using $FC... "
766     cat > genmake_tcomp.f <<EOF
767     program hello
768     CHARACTER(128) string
769     string = ' '
770     call fdate( string )
771     print *, string
772     end
773     EOF
774     $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1
775     RETVAL=$?
776     if test "x$RETVAL" = x0 ; then
777     HAVE_FDATE=t
778     DEFINES="$DEFINES -DHAVE_FDATE"
779     echo "yes"
780     else
781     HAVE_FDATE=
782     echo "no"
783     fi
784     rm -f genmake_tcomp*
785    
786 edhill 1.31 echo " The name mangling convention for $FC is... "
787     #FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _"
788 edhill 1.29 if test "x$FC_NAMEMANGLE" = x ; then
789 edhill 1.31 get_fortran_c_namemangling
790 edhill 1.29 fi
791 edhill 1.31 echo " '$FC_NAMEMANGLE'"
792 edhill 1.29 echo "$FC_NAMEMANGLE" > FC_NAMEMANGLE.h.template
793     cmp FC_NAMEMANGLE.h FC_NAMEMANGLE.h.template > /dev/null 2>&1
794     RETVAL=$?
795     if test "x$RETVAL" != x0 ; then
796     mv -f FC_NAMEMANGLE.h.template FC_NAMEMANGLE.h
797     fi
798    
799 edhill 1.8
800 edhill 1.2 printf "\n=== Setting defaults ===\n"
801 edhill 1.1 echo -n " Adding MODS directories: "
802     for d in $MODS ; do
803     if test ! -d $d ; then
804 edhill 1.2 echo
805     echo "Error: MODS directory \"$d\" not found!"
806 edhill 1.1 exit 1
807     else
808     echo -n " $d"
809     SOURCEDIRS="$SOURCEDIRS $d"
810     INCLUDEDIRS="$INCLUDEDIRS $d"
811     fi
812     done
813     echo
814    
815     if test "x$MAKEFILE" = x ; then
816     MAKEFILE="Makefile"
817     fi
818     if test "x${PLATFORM}" = x ; then
819     PLATFORM=$p_PLATFORM
820     fi
821    
822     if test "x${EXEDIR}" = x ; then
823     if test "${PWD##/*/}" = "bin" -a -d ../exe -a $ROOTDIR = .. ; then
824     EXEDIR=../exe
825     else
826     EXEDIR=.
827     fi
828     fi
829     if test ! -d ${EXEDIR} ; then
830     echo "Error: the specified EXEDIR (\"$EXEDIR\") does not exist!"
831     exit 1
832     fi
833    
834     if test "x${TOOLSDIR}" = x ; then
835     TOOLSDIR="$ROOTDIR/tools"
836     fi
837     if test ! -d ${TOOLSDIR} ; then
838     echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!"
839     exit 1
840     fi
841 edhill 1.11 if test "x$S64" = x ; then
842     S64='$(TOOLSDIR)/set64bitConst.sh'
843     fi
844 edhill 1.1
845     EXECUTABLE=${EXECUTABLE:-mitgcmuv}
846    
847     # We have a special set of source files in eesupp/src which are
848     # generated from some template source files. We'll make them first so
849     # they appear as regular source code
850     if test -r $ROOTDIR"/eesupp/src/Makefile" ; then
851     echo " Making source files in eesupp from templates"
852     $MAKE -C $ROOTDIR"/eesupp/src/" > make_eesupp.errors 2>&1
853     RETVAL=$?
854 edhill 1.2 if test "x${RETVAL}" = x0 ; then
855 edhill 1.1 rm -f make_eesupp.errors
856     else
857     echo "Error: problem encountered while building source files in eesupp:"
858     cat make_eesupp.errors
859     exit 1
860     fi
861     fi
862    
863 edhill 1.2 printf "\n=== Determining package settings ===\n"
864 edhill 1.1 if test "x${PDEPEND}" = x ; then
865     tmp=$ROOTDIR"/pkg/pkg_depend"
866     if test -r $tmp ; then
867     PDEPEND=$tmp
868     else
869     echo "Warning: No package dependency information was specified."
870     echo " Please check that ROOTDIR/pkg/pkg_depend exists."
871     fi
872     else
873     if test ! -r ${PDEPEND} ; then
874     echo "Error: can't read package dependency info from PDEPEND=\"$PDEPEND\""
875     exit 1
876     fi
877     fi
878     echo " getting package dependency info from $PDEPEND"
879     # Strip the comments and then convert the dependency file into
880     # two arrays: PNAME, DNAME
881     cat $PDEPEND | sed -e 's/#.*$//g' \
882 edhill 1.15 | $AWK 'BEGIN{nn=-1;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME_"nn"="$1"\nDNAME_"nn"="$i}} END{print "nname="nn}' \
883 edhill 1.1 > ./.pd_tmp
884     RETVAL=$?
885     if test ! "x${RETVAL}" = x0 ; then
886     echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$PDEPEND\""
887     exit 1
888     fi
889     source ./.pd_tmp
890     rm -f ./.pd_tmp
891    
892 edhill 1.12 # Search for default packages. Note that a "$ROOTDIR/pkg/pkg_groups"
893     # file should eventually be added so that, for convenience, one can
894     # specify groups of packages using names like "ocean" and "atmosphere".
895 edhill 1.1 echo -n " checking default package list: "
896     if test "x${PDEFAULT}" = x ; then
897 edhill 1.12 for i in "." $MODS ; do
898     if test -r $i"/packages.conf" ; then
899     PDEFAULT=$i"/packages.conf"
900     break
901     fi
902     done
903     fi
904     if test "x${PDEFAULT}" = x ; then
905 edhill 1.1 PDEFAULT="$ROOTDIR/pkg/pkg_default"
906     fi
907     if test "x${PDEFAULT}" = xNONE ; then
908     echo "default packages file disabled"
909     else
910     if test ! -r $PDEFAULT ; then
911     echo ""
912     echo "Warning: can't read default packages from PDEFAULT=\"$PDEFAULT\""
913     else
914     echo " using PDEFAULT=\"$PDEFAULT\""
915     # Strip the comments and add all the names
916 edhill 1.15 def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`
917 edhill 1.1 RETVAL=$?
918     if test "x${RETVAL}" != x0 ; then
919     echo -n "Error: can't parse default package list "
920     echo "-- please check PDEFAULT=\"$PDEFAULT\""
921     exit 1
922     fi
923     for i in $def ; do
924     PACKAGES="$PACKAGES $i"
925     done
926 edhill 1.12 echo " before group expansion packages are: $PACKAGES"
927     expand_pkg_groups
928     echo " after group expansion packages are: $PACKAGES"
929 edhill 1.1 fi
930     fi
931    
932     echo " applying DISABLE settings"
933     pack=
934     for p in $PACKAGES ; do
935     addit="t"
936     for d in $DISABLE ; do
937     if test "x$p" = "x$d" ; then
938     addit="f"
939     fi
940     done
941     if test "x$addit" = xt ; then
942     pack="$pack $p"
943     fi
944     done
945     PACKAGES="$pack"
946     echo " applying ENABLE settings"
947 edhill 1.12 echo "" > ./.tmp_pack
948 edhill 1.1 PACKAGES="$PACKAGES $ENABLE"
949     for i in $PACKAGES ; do
950     if test ! -d "$ROOTDIR/pkg/$i" ; then
951     echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""
952     exit 1
953     fi
954     echo $i >> ./.tmp_pack
955     done
956     pack=`cat ./.tmp_pack | sort | uniq`
957     rm -f ./.tmp_pack
958     PACKAGES=
959     for i in $pack ; do
960     PACKAGES="$PACKAGES $i"
961     done
962     echo " packages are: $PACKAGES"
963    
964     echo " applying package dependency rules"
965     ck=
966     while test "x$ck" != xtt ; do
967     i=0
968 edhill 1.2 # rtot=${#PNAME[@]}
969     rtot=$nname
970 edhill 1.1 while test $i -lt $rtot ; do
971    
972     # Is $pname in the current $PACKAGES list?
973 edhill 1.2 # pname=${PNAME[$i]}
974     tmp="pname=\"\$PNAME_$i\""
975     eval $tmp
976 edhill 1.1 pin="f"
977     for p in $PACKAGES ; do
978     if test "x$p" = "x$pname" ; then
979     pin="t"
980     fi
981     done
982    
983     # Is the DNAME entry a (+) or (-) rule ?
984 edhill 1.2 tmp="dname=\"\$DNAME_$i\""
985     eval $tmp
986 edhill 1.1 plus="-"
987 edhill 1.2 echo $dname | grep '^+' > /dev/null 2>&1
988 edhill 1.1 RETVAL=$?
989     if test "x$RETVAL" = x0 ; then
990     plus="+"
991     fi
992    
993     # Is $dname in the current $PACKAGES list?
994 edhill 1.2 dname=`echo $dname | sed -e 's/^[+-]//'`
995 edhill 1.1 din="f"
996     for p in $PACKAGES ; do
997     if test "x$p" = "x$dname" ; then
998     din="t"
999     fi
1000     done
1001    
1002     # Do we need to add $dname according to the dependency rules?
1003     if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then
1004     in_dis="f"
1005     for dis in $DISABLE ; do
1006     if test "x$dis" = "x$dname" ; then
1007     in_dis="t"
1008     fi
1009     done
1010     if test "x$in_dis" = xt ; then
1011     echo "Error: can't satisfy package dependencies:"
1012     echo " \"$dname\" is required by the dependency rules"
1013     echo " but is disallowed by the DISABLE settings"
1014     exit 1
1015     else
1016     PACKAGES="$PACKAGES $dname"
1017     ck=
1018     fi
1019     fi
1020    
1021     # Do we need to get rid of $dname according to the dependency rules?
1022     if test "x$pin" = xt -a "x$plus" = "x-" -a "x$din" = xt; then
1023     echo "Error: can't satisfy package dependencies:"
1024     echo " \"$pname\" was requested but is disallowed by"
1025     echo " the dependency rules for \"$dname\""
1026     exit 1
1027     fi
1028     i=$(( $i + 1 ))
1029     done
1030     ck=$ck"t"
1031     done
1032     echo " packages are: $PACKAGES"
1033     for i in $PACKAGES ; do
1034     adr="$ROOTDIR/pkg/$i"
1035     if test -d $adr ; then
1036     SOURCEDIRS="$SOURCEDIRS $adr"
1037     INCLUDEDIRS="$INCLUDEDIRS $adr"
1038 edhill 1.14 if test "x$i" = xautodiff ; then
1039     AUTODIFF_PKG_USED=t
1040     fi
1041 edhill 1.1 else
1042     echo "Error: the directory \"$adr\" for package $i doesn't exist"
1043     exit 1
1044     fi
1045     done
1046    
1047    
1048 edhill 1.12 # Create a list of #define and #undef to enable/disable packages
1049     PACKAGES_DOT_H=PACKAGES_CONFIG.h
1050     cat <<EOF >$PACKAGES_DOT_H".tmp"
1051 edhill 1.1 C=== GENMAKE v2 ===
1052 edhill 1.11 C The following defines have been set by GENMAKE, so please do not
1053     C edit anything below these comments. In general, you should
1054 edhill 1.1 C add or remove packages by re-running genmake with different
1055     C "-enable" and/or "-disable" options.
1056    
1057 edhill 1.12 #ifndef PACKAGES_H
1058     #define PACKAGES_H
1059    
1060 edhill 1.1 C Packages disabled by genmake:
1061     EOF
1062     # The following UGLY HACK sets multiple "#undef"s and it needs to go
1063     # away. On 2003-08-12, CNH, JMC, and EH3 agreed that the CPP_OPTIONS.h
1064     # file would eventually be split up so that all package-related #define
1065     # statements could be separated and handled only by genmake.
1066     names=`ls -1 "$ROOTDIR/pkg"`
1067     all_pack=
1068     for n in $names ; do
1069     if test -d "$ROOTDIR/pkg/$n" -a "x$n" != xCVS ; then
1070     has_pack="f"
1071     for pack in $PACKAGES ; do
1072     if test "x$pack" = "x$n" ; then
1073     has_pack="t"
1074     break
1075     fi
1076     done
1077     if test "x$has_pack" = xf ; then
1078 edhill 1.15 undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`
1079 edhill 1.12 echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"
1080 edhill 1.1 fi
1081     fi
1082     done
1083 edhill 1.12 cat <<EOF >>$PACKAGES_DOT_H".tmp"
1084 edhill 1.1
1085     C Packages enabled by genmake:
1086     EOF
1087     for i in $PACKAGES ; do
1088 edhill 1.15 def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'`
1089 edhill 1.12 echo "#define $def" >> $PACKAGES_DOT_H".tmp"
1090     #eh3 DEFINES="$DEFINES -D$def"
1091 edhill 1.1
1092     #EH3 WARNING : This is an UGLY HACK that needs to be removed!!!
1093     case $i in
1094     aim_v23)
1095 edhill 1.12 echo "#define ALLOW_AIM" >> $PACKAGES_DOT_H".tmp"
1096     DEFINES="$DEFINES -DALLOW_AIM"
1097     echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)"
1098 edhill 1.1 ;;
1099     esac
1100     #EH3 WARNING : This is an UGLY HACK that needs to be removed!!!
1101    
1102     done
1103 edhill 1.12 cat <<EOF >>$PACKAGES_DOT_H".tmp"
1104    
1105     #endif /* PACKAGES_H */
1106     EOF
1107    
1108     if test ! -f $PACKAGES_DOT_H ; then
1109     mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
1110     else
1111     cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
1112     RETVAL=$?
1113     if test "x$RETVAL" = x0 ; then
1114     rm -f $PACKAGES_DOT_H".tmp"
1115     else
1116     mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak"
1117     mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
1118     fi
1119     fi
1120 edhill 1.1
1121     echo " Adding STANDARDDIRS"
1122     BUILDDIR=${BUILDDIR:-.}
1123 edhill 1.12 if test "x$STANDARDDIRS" = x ; then
1124     STANDARDDIRS="eesupp model"
1125     fi
1126 edhill 1.1 for d in $STANDARDDIRS ; do
1127     adr="$ROOTDIR/$d/src"
1128     if test ! -d $adr ; then
1129     echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""
1130     echo " is correct and that you correctly specified the STANDARDDIRS option"
1131     exit 1
1132     else
1133     SOURCEDIRS="$SOURCEDIRS $adr"
1134     fi
1135     adr="$ROOTDIR/$d/inc"
1136     if test ! -d $adr ; then
1137     echo "Error: directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""
1138     echo " is correct and that you correctly specified the STANDARDDIRS option"
1139     exit 1
1140     else
1141     INCLUDEDIRS="$INCLUDEDIRS $adr"
1142     fi
1143     done
1144    
1145 edhill 1.22 echo " Searching for CPP_OPTIONS.h in order to warn about the presence"
1146     echo " of \"#define ALLOW_PKGNAME\"-type statements:"
1147 edhill 1.12 CPP_OPTIONS=
1148     spaths=". $INCLUDEDIRS"
1149     for i in $spaths ; do
1150     try="$i/CPP_OPTIONS.h"
1151     # echo -n " trying $try : "
1152     if test -f $try -a -r $try ; then
1153     echo " found CPP_OPTIONS=\"$try\""
1154     CPP_OPTIONS="$try"
1155     break
1156     fi
1157     done
1158     if test "x$CPP_OPTIONS" = x ; then
1159     echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths"
1160     exit 1
1161     fi
1162     # New safety test: make sure packages are not mentioned in CPP_OPTIONS.h
1163     names=`ls -1 "$ROOTDIR/pkg"`
1164     for n in $names ; do
1165     test_for_package_in_cpp_options $CPP_OPTIONS $n
1166     done
1167    
1168 edhill 1.1
1169 edhill 1.14 # Here, we build the list of files to be "run through" the adjoint
1170     # compiler.
1171     if test -f ./ad_files ; then
1172     rm -f ./ad_files
1173     fi
1174     echo " Creating the list of files for the adjoint compiler."
1175     for i in $SOURCEDIRS ; do
1176     list_files=`( cd $i && ls -1 *.list 2>/dev/null )`
1177     for j in $list_files ; do
1178     cat $i/$j >> ad_files
1179     done
1180     done
1181    
1182     cat <<EOF > adjoint_sed
1183     s/call adopen(/call adopen ( mythid,\\
1184     \& /g
1185     s/call adclose(/call adclose( mythid,\\
1186     \& /g
1187     s/call adread(/call adread ( mythid,\\
1188     \& /g
1189     s/call adwrite(/call adwrite( mythid,\\
1190     \& /g
1191    
1192     EOF
1193    
1194 edhill 1.2 echo
1195     echo "=== Creating the Makefile ==="
1196 edhill 1.1 echo " setting INCLUDES"
1197     for i in $INCLUDEDIRS ; do
1198 edhill 1.12 if ! test -d $i ; then
1199     # INCLUDES="$INCLUDES -I$i"
1200     # else
1201 edhill 1.1 echo "Warning: can't find INCLUDEDIRS=\"$i\""
1202     fi
1203     done
1204    
1205     echo " Determining the list of source and include files"
1206     rm -rf .links.tmp
1207     mkdir .links.tmp
1208     echo "# This section creates symbolic links" > srclinks.tmp
1209     echo "" >> srclinks.tmp
1210 cnh 1.3 echo -n 'SRCFILES = ' > srclist.inc
1211     echo -n 'CSRCFILES = ' > csrclist.inc
1212     echo -n 'F90SRCFILES = ' > f90srclist.inc
1213 edhill 1.1 echo -n 'HEADERFILES = ' > hlist.inc
1214 edhill 1.14 echo -n 'AD_FLOW_FILES = ' > ad_flow_files.inc
1215 adcroft 1.9 alldirs="$SOURCEDIRS $INCLUDEDIRS ."
1216 edhill 1.1 for d in $alldirs ; do
1217     deplist=
1218 edhill 1.14 sfiles=`( cd $d; echo *.[h,c,F] *.flow )`
1219 cnh 1.3 sfiles=`( echo $sfiles; cd $d; echo *.F90 )`
1220 edhill 1.1 for sf in $sfiles ; do
1221     if test ! -r ".links.tmp/$sf" ; then
1222     if test -f "$d/$sf" ; then
1223 edhill 1.15 extn=`echo $sf | $AWK -F '.' '{print $NF}'`
1224 edhill 1.1 touch .links.tmp/$sf
1225     deplist="$deplist $sf"
1226     case $extn in
1227     F)
1228     echo " \\" >> srclist.inc
1229     echo -n " $sf" >> srclist.inc
1230     ;;
1231 cnh 1.3 F90)
1232     echo " \\" >> f90srclist.inc
1233     echo -n " $sf" >> f90srclist.inc
1234     ;;
1235 edhill 1.1 c)
1236     echo " \\" >> csrclist.inc
1237     echo -n " $sf" >> csrclist.inc
1238     ;;
1239     h)
1240     echo " \\" >> hlist.inc
1241     echo -n " $sf" >> hlist.inc
1242     ;;
1243 edhill 1.14 flow)
1244     echo " \\" >> ad_flow_files.inc
1245     echo -n " $sf" >> ad_flow_files.inc
1246     ;;
1247 edhill 1.1 esac
1248     fi
1249     fi
1250     done
1251     if test "x$deplist" != x ; then
1252 edhill 1.2 echo "" >> srclinks.tmp
1253     echo "# These files are linked from $d" >> srclinks.tmp
1254 edhill 1.1 echo "$deplist :" >> srclinks.tmp
1255 edhill 1.2 printf "\t\$(LN) %s/\$@ \$@\n" $d >> srclinks.tmp
1256 edhill 1.1 fi
1257     done
1258     rm -rf .links.tmp
1259     echo "" >> srclist.inc
1260     echo "" >> csrclist.inc
1261 cnh 1.3 echo "" >> f90srclist.inc
1262 edhill 1.1 echo "" >> hlist.inc
1263 edhill 1.14 echo "" >> ad_flow_files.inc
1264 edhill 1.1
1265     if test -e $MAKEFILE ; then
1266     mv -f $MAKEFILE "$MAKEFILE.bak"
1267     fi
1268     echo " Writing makefile: $MAKEFILE"
1269     echo "# Multithreaded + multi-processing makefile for:" > $MAKEFILE
1270     echo "# $MACHINE" >> $MAKEFILE
1271     echo "# This makefile was generated automatically on" >> $MAKEFILE
1272     echo "# $THISDATE" >> $MAKEFILE
1273     echo "# by the command:" >> $MAKEFILE
1274     echo "# $0 $@" >> $MAKEFILE
1275     echo "# executed by:" >> $MAKEFILE
1276     echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE
1277 edhill 1.21
1278     EXE_AD=$EXECUTABLE"_ad"
1279     EXE_FTL=$EXECUTABLE"_ftl"
1280     EXE_SVD=$EXECUTABLE"_svd"
1281    
1282 edhill 1.1 cat >>$MAKEFILE <<EOF
1283     #
1284     # BUILDDIR : Directory where object files are written
1285     # SOURCEDIRS : Directories containing the source (.F) files
1286     # INCLUDEDIRS : Directories containing the header-source (.h) files
1287     # EXEDIR : Directory where executable that is generated is written
1288     # EXECUTABLE : Full path of executable binary
1289     #
1290     # CPP : C-preprocessor command
1291     # INCLUDES : Directories searched for header files
1292     # DEFINES : Macro definitions for CPP
1293     # MAKEDEPEND : Dependency generator
1294     # KPP : Special preprocessor command (specific to platform)
1295     # KFLAGS : Flags for KPP
1296     # FC : Fortran compiler command
1297     # FFLAGS : Configuration/debugging options for FC
1298     # FOPTIM : Optimization options for FC
1299     # LINK : Command for link editor program
1300     # LIBS : Library flags /or/ additional optimization/debugging flags
1301    
1302     ROOTDIR = ${ROOTDIR}
1303     BUILDDIR = ${BUILDDIR}
1304     SOURCEDIRS = ${SOURCEDIRS}
1305     INCLUDEDIRS = ${INCLUDEDIRS}
1306     EXEDIR = ${EXEDIR}
1307     EXECUTABLE = \$(EXEDIR)/${EXECUTABLE}
1308     TOOLSDIR = ${TOOLSDIR}
1309    
1310 edhill 1.14 #eh3 new defines for the adjoint work
1311     AUTODIFF = ${ROOTDIR}/pkg/autodiff
1312 edhill 1.21 EXE_AD = ${EXE_AD}
1313     EXE_FTL = ${EXE_FTL}
1314     EXE_SVD = ${EXE_SVD}
1315 edhill 1.14
1316 edhill 1.1 EOF
1317    
1318     # Note: figure out some way to add Hyades JAM libraries here
1319    
1320     cat >>$MAKEFILE <<EOF
1321     # Unix ln (link)
1322     LN = ${LN}
1323     # C preprocessor
1324     CPP = cat \$< | ${S64} | ${CPP}
1325     # Dependency generator
1326     MAKEDEPEND = ${MAKEDEPEND}
1327     # Special preprocessor (KAP on DECs, FPP on Crays)
1328     KPP = ${KPP}
1329     # Fortran compiler
1330     FC = ${FC}
1331 cnh 1.3 # Fortran compiler
1332     F90C = ${F90C}
1333 edhill 1.1 # Link editor
1334     LINK = ${LINK}
1335    
1336     # Defines for CPP
1337     DEFINES = ${DEFINES}
1338     # Includes for CPP
1339     INCLUDES = ${INCLUDES}
1340     # Flags for KPP
1341     KFLAGS1 = ${KFLAGS1}
1342     KFLAGS2 = ${KFLAGS2}
1343     # Optim./debug for FC
1344     FFLAGS = ${FFLAGS}
1345     FOPTIM = ${FOPTIM}
1346 cnh 1.3 # Optim./debug for FC
1347     F90FLAGS = ${F90FLAGS}
1348     F90OPTIM = ${F90OPTIM}
1349 edhill 1.1 # Flags for CC
1350     CFLAGS = ${CFLAGS}
1351     # Files that should not be optimized
1352     NOOPTFILES = ${NOOPTFILES}
1353     NOOPTFLAGS = ${NOOPTFLAGS}
1354     # Flags and libraries needed for linking
1355     LIBS = ${LIBS} \$(XLIBS)
1356 cnh 1.3 # Name of the Mekfile
1357     MAKEFILE=${MAKEFILE}
1358 edhill 1.1
1359     EOF
1360    
1361 edhill 1.14 cat srclist.inc >> $MAKEFILE
1362     cat csrclist.inc >> $MAKEFILE
1363     cat f90srclist.inc >> $MAKEFILE
1364     cat hlist.inc >> $MAKEFILE
1365     cat ad_flow_files.inc >> $MAKEFILE
1366     echo >> $MAKEFILE
1367 cnh 1.3 echo 'F77FILES = $(SRCFILES:.F=.f)' >> $MAKEFILE
1368     echo 'F90FILES = $(F90SRCFILES:.F90=.f90)' >> $MAKEFILE
1369     echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE
1370 edhill 1.1
1371 cnh 1.3 rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc
1372 edhill 1.14 rm -f ad_flow_files.inc
1373 edhill 1.1
1374     cat >>$MAKEFILE <<EOF
1375    
1376     .SUFFIXES:
1377 cnh 1.3 .SUFFIXES: .o .f .p .F .c .F90 .f90
1378 edhill 1.1
1379     all: \$(EXECUTABLE)
1380     \$(EXECUTABLE): \$(OBJFILES)
1381     \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
1382     depend:
1383     @make links
1384     \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
1385 edhill 1.7 ${TOOLSDIR}/f90mkdepend >> \$(MAKEFILE)
1386 edhill 1.1
1387 cnh 1.3 links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES)
1388 edhill 1.1
1389 cnh 1.3 small_f: \$(F77FILES) \$(F90FILES)
1390 edhill 1.1
1391     output.txt: \$(EXECUTABLE)
1392     @printf 'running ... '
1393     @\$(EXECUTABLE) > \$@
1394    
1395     clean:
1396 edhill 1.22 -cat AD_CONFIG.template > AD_CONFIG.h
1397 cnh 1.3 -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl}
1398 edhill 1.1 Clean:
1399     @make clean
1400     @make cleanlinks
1401 edhill 1.22 -rm -f Makefile.bak genmake_state genmake_*optfile make.log
1402 edhill 1.1 CLEAN:
1403     @make Clean
1404     -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
1405     -find \$(EXEDIR) -name "*.data" -exec rm {} \;
1406     -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
1407 edhill 1.12 -rm -f \$(EXECUTABLE) output.txt
1408 edhill 1.1
1409 edhill 1.18 #eh3 Makefile: makefile
1410 edhill 1.1 makefile:
1411     ${0} $@
1412     cleanlinks:
1413     -find . -type l -exec rm {} \;
1414    
1415     # The normal chain of rules is ( .F - .f - .o )
1416     .F.f:
1417     \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1418     .f.o:
1419     \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
1420 cnh 1.3 .F90.f90:
1421     \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1422     .f90.o:
1423     \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
1424 edhill 1.1 .c.o:
1425     \$(CC) \$(CFLAGS) -c \$<
1426    
1427     # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
1428     .F.p:
1429     \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1430     .p.f:
1431     \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
1432 edhill 1.14
1433     #=========================================
1434     #=== Automatic Differentiation Rules ===
1435    
1436     TAMC = ${TAMC}
1437     TAF = ${TAF}
1438    
1439 edhill 1.17 TAF_EXTRA = ${TAF_EXTRA}
1440     TAMC_EXTRA = ${TAMC_EXTRA}
1441    
1442 edhill 1.14 EOF
1443    
1444     ad_vars="AD_TAMC_FLAGS AD_TAF_FLAGS"
1445     ad_vars="$ad_vars FTL_TAMC_FLAGS FTL_TAF_FLAGS"
1446     ad_vars="$ad_vars SVD_TAMC_FLAGS SVD_TAF_FLAGS"
1447     for i in $ad_vars ; do
1448     name=$i
1449     t1="t2=\$"`echo $i`
1450     eval $t1
1451     printf "%-20s = " $name >> $MAKEFILE
1452     echo $t2 >> $MAKEFILE
1453     done
1454    
1455     echo " Add the source list for AD code generation"
1456     echo >> $MAKEFILE
1457     echo -n "AD_FILES = " >> $MAKEFILE
1458     AD_FILES=`cat ad_files`
1459     for i in $AD_FILES ; do
1460     echo " \\" >> $MAKEFILE
1461     echo -n " $i" >> $MAKEFILE
1462     done
1463     echo >> $MAKEFILE
1464 edhill 1.21 rm -f ad_files
1465 edhill 1.14
1466     cat >>$MAKEFILE <<EOF
1467    
1468 edhill 1.16 # ... AD ...
1469 edhill 1.23 adall: ad_taf
1470     adtaf: ad_taf_output.f
1471     adtamc: ad_tamc_output.f
1472 edhill 1.21
1473 heimbach 1.26 ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1474 edhill 1.23 cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
1475 edhill 1.22 @make \$(F77FILES)
1476     @make \$(AD_FLOW_FILES)
1477     cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f
1478    
1479 edhill 1.14 ad_taf_output.f: ad_input_code.f
1480 edhill 1.17 \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1481 edhill 1.14 cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f
1482    
1483     ad_taf: ad_taf_output.o \$(OBJFILES)
1484 edhill 1.21 \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
1485 edhill 1.14
1486     ad_tamc_output.f: ad_input_code.f
1487 edhill 1.17 \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f
1488 edhill 1.16 cat ad_input_code_ad.f | sed -f adjoint_sed > ad_tamc_output.f
1489 edhill 1.14
1490     ad_tamc: ad_tamc_output.o \$(OBJFILES)
1491 edhill 1.21 \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
1492 edhill 1.14
1493    
1494 edhill 1.19 # ... FTL ...
1495 edhill 1.23 ftlall: ftl_taf
1496     ftltaf: ftl_taf_output.f
1497     ftltamc: ftl_tamc_output.f
1498 edhill 1.21
1499 heimbach 1.26 ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1500 edhill 1.23 cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h
1501     @make \$(F77FILES)
1502 edhill 1.22 @make \$(AD_FLOW_FILES)
1503     cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f
1504    
1505     ftl_taf_output.f: ftl_input_code.f
1506     \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1507     cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f
1508 edhill 1.14
1509 edhill 1.19 ftl_taf: ftl_taf_output.o \$(OBJFILES)
1510 edhill 1.21 \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
1511 edhill 1.14
1512 edhill 1.22 ftl_tamc_output.f: ftl_input_code.f
1513     \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f
1514     cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f
1515 edhill 1.16
1516 edhill 1.19 ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
1517 edhill 1.21 \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
1518 edhill 1.16
1519    
1520     # ... SVD ...
1521 edhill 1.21 svd: svd_taf
1522     svd_taf_f: svd_taf_output.f
1523    
1524 edhill 1.22 svd_input_code.f: \$(SRCFILES)
1525 edhill 1.23 cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h
1526     @make \$(F77FILES)
1527 edhill 1.22 @make \$(AD_FLOW_FILES)
1528     cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f
1529    
1530     svd_taf_output.f: svd_input_code.f
1531     \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f
1532     cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f
1533 edhill 1.16
1534     svd_taf: svd_taf_output.o \$(OBJFILES)
1535 edhill 1.21 \$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS)
1536 edhill 1.14
1537    
1538     #=========================================
1539 edhill 1.1
1540     EOF
1541 edhill 1.7
1542     if test "x$EXEHOOK" != x ; then
1543     printf "\nexehook:\n\t%s\n" $EXEHOOK >> $MAKEFILE
1544     fi
1545 edhill 1.1
1546     echo " Making list of \"exceptions\" that need \".p\" files"
1547     for i in $KPPFILES ; do
1548     base=`echo $i | sed -e 's/\/.*\///g' | sed -e 's/\..*$//g'`
1549     RETVAL=$?
1550     if test "x$RETVAL" != x0 ; then
1551     echo "Error: unable to add file \"$i\" to the exceptions list"
1552     fi
1553     echo "$base.f: $base.p" >> $MAKEFILE
1554     done
1555    
1556     echo " Making list of NOOPTFILES"
1557     for i in $NOOPTFILES ; do
1558     base=`echo $i | sed -e 's/\/.*\///g' | sed -e 's/\..*$//g'`
1559     RETVAL=$?
1560     if test "x$RETVAL" != x0 ; then
1561     echo "Error: unable to add file \"$i\" to the exceptions list"
1562     fi
1563     echo "$base.o: $base.f" >> $MAKEFILE
1564 edhill 1.2 printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE
1565 edhill 1.1 done
1566    
1567     echo " Add rules for links"
1568     cat srclinks.tmp >> $MAKEFILE
1569     rm -f srclinks.tmp
1570    
1571     echo " Adding makedepend marker"
1572 edhill 1.2 printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE
1573 edhill 1.1
1574 edhill 1.2 printf "\n=== Done ===\n"
1575 edhill 1.22
1576     # Write the "template" files for the adjoint builds
1577 edhill 1.23 cat >AD_CONFIG.template <<EOF
1578 edhill 1.22 C WARNING: This file is automatically generated by genmake2 and
1579     C used by the Makefile rules. Please DO NOT EDIT this file
1580 edhill 1.23 C unless you are CERTAIN that you know what you are doing.
1581 edhill 1.22
1582     #undef ALLOW_ADJOINT_RUN
1583     #undef ALLOW_TANGENTLINEAR_RUN
1584     #undef ALLOW_ECCO_OPTIMIZATION
1585     EOF
1586 edhill 1.23 cat >ad_config.template <<EOF
1587 edhill 1.22 C WARNING: This file is automatically generated by genmake2 and
1588     C used by the Makefile rules. Please DO NOT EDIT this file
1589 edhill 1.23 C unless you are CERTAIN that you know what you are doing.
1590 edhill 1.22
1591 edhill 1.23 #define ALLOW_ADJOINT_RUN
1592 edhill 1.22 #undef ALLOW_TANGENTLINEAR_RUN
1593     #undef ALLOW_ECCO_OPTIMIZATION
1594     EOF
1595 edhill 1.23 cat >ftl_config.template <<EOF
1596 edhill 1.22 C WARNING: This file is automatically generated by genmake2 and
1597     C used by the Makefile rules. Please DO NOT EDIT this file
1598 edhill 1.23 C unless you are CERTAIN that you know what you are doing.
1599 edhill 1.22
1600     #undef ALLOW_ADJOINT_RUN
1601 edhill 1.23 #define ALLOW_TANGENTLINEAR_RUN
1602 edhill 1.22 #undef ALLOW_ECCO_OPTIMIZATION
1603     EOF
1604 edhill 1.23 cat >svd_config.template <<EOF
1605 edhill 1.22 C WARNING: This file is automatically generated by genmake2 and
1606     C used by the Makefile rules. Please DO NOT EDIT this file
1607 edhill 1.23 C unless you are CERTAIN that you know what you are doing.
1608 edhill 1.22
1609     #undef ALLOW_ADJOINT_RUN
1610     #undef ALLOW_TANGENTLINEAR_RUN
1611     #undef ALLOW_ECCO_OPTIMIZATION
1612     EOF
1613     cp AD_CONFIG.template AD_CONFIG.h
1614 edhill 1.5
1615    
1616     # Write the "state" for future records
1617     if test "x$DUMPSTATE" != xf ; then
1618 edhill 1.12 echo -n "" > genmake_state
1619 edhill 1.5 for i in $gm_state ; do
1620     t1="t2=\$$i"
1621     eval $t1
1622 edhill 1.12 echo "$i='$t2'" >> genmake_state
1623 edhill 1.5 done
1624     fi

  ViewVC Help
Powered by ViewVC 1.1.22