/[MITgcm]/MITgcm/tools/xmakedepend
ViewVC logotype

Contents of /MITgcm/tools/xmakedepend

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


Revision 1.1.6.1 - (show annotations) (download)
Mon Apr 8 20:10:39 2002 UTC (21 years, 11 months ago) by heimbach
Branch: release1
CVS Tags: release1_p13_pre, release1_p13, release1_p8, release1_p9, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, release1_chkpt44d_post, release1_p11, release1_p12, release1_p10, release1_p16, release1_p17, release1_p14, release1_p15, release1_p12_pre
Branch point for: release1_50yr
Changes since 1.1: +0 -0 lines
Changes encapsulated by checkpoint43a-release1mods and chkpt44d_post
on the main trunk.
These are:

 o added missing EXCLUDE_MONITOR flags
 o changed "e" to "_d" in gmredi_slope_limit, gmredi_slope_psi
   (incompatible typ in MIN/MAX expressions caused problems
   on IBM SP3)
 o in genmake added variable MAKEDEPEND
   plus resetting for case SunOS
 o added timer_stats.c routine for IBM SP3
 o removed variables in dynamics
 o real fresh water flux implemented with non-linear free-surface.
 o few fix (mask in shap_s2, EmPmR in external_field_load,
   USE_NATURAL_BCS in solve_for_P);
 o add arguments myIter & myTime to S/R obcs_calc & solve_for_P
 o merge of relevant stuff from the ecco-branch:
   - genmake: removed $S64 overwrite for case SunOS
   - pkg/exf: update and corrections for field swapping and obcs
   - pkg/ecco: parameter lists for the_model_main, the_main_loop
               harmonized between ECCO and MITgcm
   - pkg/autodiff: added flow directives for obcs, mdsio_gl_slice
                   updated checkpointing_lev... lists for obcs
   - model/src: minor changes in forward_step, plot_field
                added directive for divided adjoint in the_main_loop
   - pkg/mdsio: added mdsio_gl_slice
 o check parameters & config (chkpt44a_pre,post)
 o OBC and NonLin_FrSurf.
 o fix bug in mom_vi_del2uv
 o select when filters are applied ; add options to zonal_filter (data.zonfilt)
 o gmredi: fix Pb in the adiabatic form ; add options (.e.g. Bolus advection)
 o update AIM experiments (NCEP input files)
 o improve and extend diagnostics (Monitor, TimeAve with NonLin-FrSurf)
 o added some stuff for AD

These were merged with
cvs co -r release1 -P MITgcm
cd MITgcm
cvs update -kk
cvs update -j checkpoint43a-release1mods -j chkpt44d_post -d -P -kk

1 #!/usr/bin/sh
2 #
3 # $TOG: mdepend.cpp /main/13 1997/06/20 21:12:18 kaleb $
4 #
5 # Do the equivalent of the 'makedepend' program, but do it right.
6 #
7 # Usage:
8 #
9 # makedepend [cpp-flags] [-w width] [-s magic-string] [-f makefile]
10 # [-o object-suffix]
11 #
12 # Notes:
13 #
14 # The C compiler used can be overridden with the environment
15 # variable "CC".
16 #
17 # The "-v" switch of the "makedepend" program is not supported.
18 #
19 #
20 # This script should
21 # work on both USG and BSD systems. However, when System V.4 comes out,
22 # USG users will probably have to change "silent" to "-s" instead of
23 # "-" (at least, that is what the documentation implies).
24 #
25 # $XFree86: xc/config/util/mdepend.cpp,v 3.2 1997/06/29 07:54:20 dawes Exp $
26 #
27
28 CC="cpp -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE "
29
30 silent='-'
31
32 TMP=./mdep$$
33 CPPCMD=${TMP}a
34 DEPENDLINES=${TMP}b
35 TMPMAKEFILE=${TMP}c
36 MAGICLINE=${TMP}d
37 ARGS=${TMP}e
38
39 trap "rm -f ${TMP}*; exit 1" 1 2 15
40 trap "rm -f ${TMP}*; exit 0" 1 2 13
41
42 echo " \c" > $CPPCMD
43 if [ `wc -c < $CPPCMD` -eq 1 ]
44 then
45 c="\c"
46 n=
47 else
48 c=
49 n="-n"
50 fi
51
52 echo $n "$c" >$ARGS
53
54 files=
55 makefile=
56 magic_string='# DO NOT DELETE'
57 objsuffix='.o'
58 width=78
59 endmarker=""
60 verbose=n
61 append=n
62
63 while [ $# != 0 ]
64 do
65 if [ "$endmarker"x != x ] && [ "$endmarker" = "$1" ]; then
66 endmarker=""
67 else
68 case "$1" in
69 -D*|-I*)
70 echo $n " '$1'$c" >> $ARGS
71 ;;
72
73 -g|-O) # ignore so we can just pass $(CFLAGS) in
74 ;;
75
76 *)
77 if [ "$endmarker"x = x ]; then
78 case "$1" in
79 -w)
80 width="$2"
81 shift
82 ;;
83 -s)
84 magic_string="$2"
85 shift
86 ;;
87 -f*)
88 if [ "$1" = "-f-" ]; then
89 makefile="-"
90 else
91 makefile="$2"
92 shift
93 fi
94 ;;
95 -o)
96 objsuffix="$2"
97 shift
98 ;;
99
100 --*)
101 echo "$1" | sed 's/^\-\-//' >${TMP}end
102 endmarker="`cat ${TMP}end`"
103 rm -f ${TMP}end
104 if [ "$endmarker"x = x ]; then
105 endmarker="--"
106 fi
107 ;;
108 -v)
109 verbose="y"
110 ;;
111
112 -a)
113 append="y"
114 ;;
115
116 -cc)
117 CC="$2"
118 shift
119 ;;
120
121 -*)
122 echo "Unknown option '$1' ignored" 1>&2
123 ;;
124 *)
125 files="$files $1"
126 ;;
127 esac
128 fi
129 ;;
130 esac
131 fi
132 shift
133 done
134 echo ' $*' >> $ARGS
135
136 echo "#!/bin/sh" > $CPPCMD
137 echo "exec $CC `cat $ARGS`" >> $CPPCMD
138 chmod +x $CPPCMD
139 rm $ARGS
140
141 case "$makefile" in
142 '')
143 if [ -r makefile ]
144 then
145 makefile=makefile
146 elif [ -r Makefile ]
147 then
148 makefile=Makefile
149 else
150 echo 'no makefile or Makefile found' 1>&2
151 exit 1
152 fi
153 ;;
154 -)
155 makefile=$TMPMAKEFILE
156 ;;
157 esac
158
159 if [ "$verbose"x = "y"x ]; then
160 cat $CPPCMD
161 fi
162
163 echo '' > $DEPENDLINES
164 for i in $files
165 do
166 $CPPCMD $i | sed -n "/^#/s;^;$i ;p"
167
168 done | sed -e 's|/[^/.][^/]*/\.\.||g' -e 's|/\.[^.][^/]*/\.\.||g' -e 's|"||g' -e 's| \./| |' | awk '{
169 if ($1 != $4 && $2 != "#ident" && $2 != "#pragma")
170
171
172
173 {
174 ofile = substr ($1, 1, length ($1) - 2) "'"$objsuffix"'"
175 print ofile, $4
176 }
177 }' | sort -u | awk '
178
179
180 {
181 newrec = rec " " $2
182 if ($1 != old1)
183 {
184 old1 = $1
185 if (rec != "")
186 print rec
187 rec = $1 ": " $2
188 }
189 else if (length (newrec) > '"$width"')
190 {
191 print rec
192 rec = $1 ": " $2
193 }
194 else
195 rec = newrec
196 }
197 END {
198
199 if (rec != "")
200 print rec
201 }' | egrep -v '^[^:]*:[ ]*$' >> $DEPENDLINES
202
203
204 trap "" 1 2 13 15 # Now we are committed
205 case "$makefile" in
206 $TMPMAKEFILE)
207 ;;
208 *)
209 rm -f $makefile.bak
210 cp $makefile $makefile.bak
211 echo "Appending dependencies to $makefile"
212 ;;
213 esac
214
215 #
216 # If not -a, append the magic string and a blank line so that
217 # /^$magic_string/+1,\$d can be used to delete everything from after
218 # the magic string to the end of the file. Then, append a blank
219 # line again and then the dependencies.
220 #
221 if [ "$append" = "n" ]
222 then
223 cat >> $makefile << END_OF_APPEND
224
225 $magic_string
226
227 END_OF_APPEND
228 ed $silent $makefile << END_OF_ED_SCRIPT
229 /^$magic_string/+1,\$d
230 w
231 q
232 END_OF_ED_SCRIPT
233 echo '' >>$makefile
234 fi
235
236 cat $DEPENDLINES >>$makefile
237
238 case "$makefile" in
239 $TMPMAKEFILE)
240 cat $TMPMAKEFILE
241 ;;
242
243 esac
244
245 rm -f ${TMP}*
246 exit 0

  ViewVC Help
Powered by ViewVC 1.1.22