Correctly locate `_' in generated names.
[platform/upstream/binutils.git] / .Sanitize
1 ########################
2 #
3 #        H    H  EEEEEE Y     Y  !!
4 #        H    H  E       Y   Y   !!
5 #        H    H  E        Y Y    !!
6 #        H    H  E         Y     !!
7 #        HHHHHH  EEEEE     Y     !!
8 #        H    H  E         Y     !!
9 #        H    H  E         Y     !!
10 #        H    H  E         Y
11 #        H    H  EEEEEE    Y     !!
12 #
13 # YO!  READ ME!!!!!!!!!
14 # If you're about to add a file or directory which isn't checked out as part
15 # of every module in devo (e.g., if "cvs co gas+utils" won't get it, or if
16 # "cvs co gcc" won't get it), then don't, Don't, DON'T add it to the regular
17 # things-to-keep or things-to-lose sections.  Instead, add it to the setting
18 # of keep_these_too or lose_these_too before those variables are rescanned
19 # to check for the existence of the items listed in them.
20 #
21 # Otherwise, somebody will check out some package that doesn't include your
22 # new file, and will get warnings from Sanitize when everything is really
23 # okay.  You don't want to get people in the habit of ignoring complaints from
24 # Sanitize, do you?  No, I didn't think so.
25 #
26 # If you do add a file to the regular things-to-keep section, don't forget
27 # to add the corresponding entry to the devo-support entry (or whatever) in
28 # the modules file.
29 #
30 ########################
31
32 # .Sanitize for devo.
33
34 # Each directory to survive its way into a release will need a file
35 # like this one called "./.Sanitize".  All keyword lines must exist,
36 # and must exist in the order specified by this file.  Each directory
37 # in the tree will be processed, top down, in the following order.
38
39 # Hash started lines like this one are comments and will be deleted
40 # before anything else is done.  Blank lines will also be squashed
41 # out.
42
43 # The lines between the "Do-first:" line and the "Things-to-keep:"
44 # line are executed as a /bin/sh shell script before anything else is
45 # done in this directory.
46
47 Do-first:
48
49 keep_these_too="${keep_these_too} .cvsignore CYGNUS autoconf
50         apache bash 
51         bfd binutils bison byacc cvs deja-gnu dejagnu diff dosrel dvips
52         emacs emacs19 examples expect fileutils findutils flex
53         gas gawk gcc gdb gdbm gdbtest glob gperf gprof grep grez groff guile gzip
54         include inet install-sh ispell
55         ld less libg++ libgcc libgloss libiberty libio librx libstdc++
56         m4 make mkinstalldirs mmalloc move-if-change newlib ncurses opcodes
57         pagas patch perl prms
58         rcs readline sed send-pr shellutils sim tar textutils time
59         texinfo tgas utils uudecode wdiff xiberty
60         configure.bat makeall.bat setup.com makefile.vms winsup
61         mpw-README mpw-configure mpw-config.in mpw-build.in mpw-install
62         ltconfig ltmain.sh missing ylwrap"
63
64 lose_these_too="${lose_these_too} testsuite"
65
66 cygnus_files="release release-info build-all.mk test-build.mk COPYING.NEWLIB"
67
68 if ( echo $* | grep keep\-cygnus > /dev/null) ; then
69         keep_these_too="${keep_these_too} ${cygnus_files}"
70 else
71         lose_these_too="${lose_these_too} ${cygnus_files}"
72 fi
73
74 gdbtk_files="tcl tk itcl tix"
75
76 if ( echo $* | grep lose\-gdbtk > /dev/null) ; then
77         lose_these_too="${lose_these_too} ${gdbtk_files}"
78         if [ -n "${verbose}" ] ; then
79                 echo Deleting ${gdbtk_files}
80         fi
81 else
82         keep_these_too="${keep_these_too} ${gdbtk_files}"
83         if [ -n "${verbose}" ] ; then
84                 echo Keeping ${gdbtk_files}
85         fi
86 fi
87
88 # This is for newlib net releases.
89 newlib_file="COPYING.NEWLIB"
90
91 if (echo $* | grep keep\-newlib > /dev/null) ; then
92         if (echo $* | grep -v keep\-cygnus > /dev/null) ; then
93                 keep_these_too="${keep_these_too} ${newlib_file}"
94                 lose_these_too="`echo ${lose_these_too} | sed -e s/${newlib_file}//`"
95         fi
96 else
97         true; # Let keep-cygnus handle it.
98 fi
99
100 # IDK releases don't include files which only matter to CDK.
101 inet_files="COPYING.LIB config config-ml.in etc symlink-tree"
102
103 if (echo $* | grep keep\-inet > /dev/null); then
104         lose_these_too="${lose_these_too} ${inet_files}"
105 else
106         keep_these_too="${keep_these_too} ${inet_files}"
107 fi
108
109 ide_files="itcl libide vmake"
110
111 if (echo $* | grep keep\-ide > /dev/null); then
112         keep_these_too="${keep_these_too} ${ide_files}"
113         test -n "$verbose" && echo Keeping ${ide_files}
114 else
115         lose_these_too="${lose_these_too} ${ide_files}"
116 fi
117
118
119 # This top-level directory is special.  We often check out only subsets
120 # of this directory, and complaining about directories or files we didn't
121 # check out just gets obnoxious.
122
123 list="`(for i in ${keep_these_too}; do echo $i ; done) | sort -u`"
124 keep_these_too=
125
126 for file in $list ; do
127         if [ -r $file ] || [ -d $file ] ; then
128                 keep_these_too="${keep_these_too} $file"
129         fi
130 done
131
132 list="`(for i in ${lose_these_too}; do echo $i ; done) | sort -u` "
133 lose_these_too=
134
135 for file in $list ; do
136         if [ -r $file ] || [ -d $file ] ; then
137                 lose_these_too="${lose_these_too} $file"
138         fi
139 done
140
141 # All files listed between the "Things-to-keep:" line and the
142 # "Do-last:" line will be kept.  All other files will be removed.
143 # Directories listed in this section will have their own Sanitize
144 # called.  Directories not listed will be removed in their entirety
145 # with rm -rf.
146
147 Things-to-keep:
148
149 COPYING
150 ChangeLog
151 Makefile.in
152 README
153 config.guess
154 config.sub
155 configure
156 configure.in
157
158 Things-to-lose:
159
160 # The lines between the "Do-last:" line and the end of the file
161 # are executed as a /bin/sh shell script after everything else is
162 # done.
163
164 Do-last:
165
166 # Don't try to clean directories here, as the 'mv' command will fail.
167 # Also, grep fails on NFS mounted directories.
168
169 if ( echo $* | egrep verbose > /dev/null ) ; then
170         verbose=true
171 else
172         verbose=
173 fi
174
175 # Remove "sanitize-Sanitize" lines.
176 if [ -n "${verbose}" ] ; then
177         echo Cleaning unconditional sanitizations out of Makefile.in...
178 fi
179 cp Makefile.in new
180 sed '/start\-sanitize\-Sanitize/,/end-\sanitize\-Sanitize/d' < Makefile.in > new
181 if [ -n "${safe}" -a ! -f .Recover/Makefile.in ] ; then
182         mv Makefile.in .Recover
183 fi
184 mv new Makefile.in
185
186 if [ -n "${verbose}" ] ; then
187         echo Thawing away the \"chill\"...
188 fi
189
190 if ( echo $* | grep keep\-chill > /dev/null ) ; then
191         for i in * ; do
192                 if test ! -d $i && (grep sanitize-chill $i > /dev/null) ; then
193                         if [ -n "${verbose}" ] ; then
194                                 echo Keeping chill stuff in $i
195                         fi
196                 fi
197         done
198 else
199         for i in * ; do
200                 if test ! -d $i && (grep sanitize-chill $i > /dev/null) ; then
201                         if [ -n "${verbose}" ] ; then
202                                 echo Thawing the \"chill\" out of $i...
203                         fi
204                         cp $i new
205                         sed '/start\-sanitize\-chill/,/end-\sanitize\-chill/d' < $i > new
206                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
207                                 if [ -n "${verbose}" ] ; then
208                                         echo Caching $i in .Recover...
209                                 fi
210                                 mv $i .Recover
211                         fi
212                         mv new $i
213                 fi
214         done
215 fi
216
217 if [ -n "${verbose}" ] ; then
218         echo Processing \"d30v\"...
219 fi
220
221 d30v_files="ChangeLog config.sub configure.in"
222
223 if ( echo $* | grep keep\-d30v > /dev/null ) ; then
224         for i in $d30v_files ; do
225                 if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
226                         if [ -n "${verbose}" ] ; then
227                                 echo Keeping d30v stuff in $i
228                         fi
229                 fi
230         done
231 else
232         for i in * ; do
233                 if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
234                         if [ -n "${verbose}" ] ; then
235                                 echo Removing traces of \"d30v\" from $i...
236                         fi
237                         cp $i new
238                         sed '/start\-sanitize\-d30v/,/end-\sanitize\-d30v/d' < $i > new
239                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
240                                 if [ -n "${verbose}" ] ; then
241                                         echo Caching $i in .Recover...
242                                 fi
243                                 mv $i .Recover
244                         fi
245                         mv new $i
246                 fi
247         done
248 fi
249
250 if [ -n "${verbose}" ] ; then
251         echo Processing \"v850\"...
252 fi
253
254 v850_files="ChangeLog config.sub configure.in"
255
256 if ( echo $* | grep keep\-v850 > /dev/null ) ; then
257         for i in $v850_files ; do
258                 if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
259                         if [ -n "${verbose}" ] ; then
260                                 echo Keeping v850 stuff in $i
261                         fi
262                 fi
263         done
264 else
265         for i in * ; do
266                 if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
267                         if [ -n "${verbose}" ] ; then
268                                 echo Removing traces of \"v850\" from $i...
269                         fi
270                         cp $i new
271                         sed '/start\-sanitize\-v850/,/end-\sanitize\-v850/d' < $i > new
272                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
273                                 if [ -n "${verbose}" ] ; then
274                                         echo Caching $i in .Recover...
275                                 fi
276                                 mv $i .Recover
277                         fi
278                         mv new $i
279                 fi
280         done
281 fi
282 if ( echo $* | grep keep\-v850e > /dev/null ) ; then
283         for i in $v850_files ; do
284                 if test ! -d $i && (grep sanitize-v850e $i > /dev/null) ; then
285                         if [ -n "${verbose}" ] ; then
286                                 echo Keeping v850e stuff in $i
287                         fi
288                 fi
289         done
290 else
291         for i in * ; do
292                 if test ! -d $i && (grep sanitize-v850e $i > /dev/null) ; then
293                         if [ -n "${verbose}" ] ; then
294                                 echo Removing traces of \"v850e\" from $i...
295                         fi
296                         cp $i new
297                         sed '/start\-sanitize\-v850e/,/end-\sanitize\-v850e/d' < $i > new
298                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
299                                 if [ -n "${verbose}" ] ; then
300                                         echo Caching $i in .Recover...
301                                 fi
302                                 mv $i .Recover
303                         fi
304                         mv new $i
305                 fi
306         done
307 fi
308 if ( echo $* | grep keep\-v850eq > /dev/null ) ; then
309         for i in $v850_files ; do
310                 if test ! -d $i && (grep sanitize-v850eq $i > /dev/null) ; then
311                         if [ -n "${verbose}" ] ; then
312                                 echo Keeping v850eq stuff in $i
313                         fi
314                 fi
315         done
316 else
317         for i in * ; do
318                 if test ! -d $i && (grep sanitize-v850eq $i > /dev/null) ; then
319                         if [ -n "${verbose}" ] ; then
320                                 echo Removing traces of \"v850eq\" from $i...
321                         fi
322                         cp $i new
323                         sed '/start\-sanitize\-v850eq/,/end-\sanitize\-v850eq/d' < $i > new
324                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
325                                 if [ -n "${verbose}" ] ; then
326                                         echo Caching $i in .Recover...
327                                 fi
328                                 mv $i .Recover
329                         fi
330                         mv new $i
331                 fi
332         done
333 fi
334
335 r5900_files="ChangeLog config.sub configure.in"
336
337 if ( echo $* | grep keep\-r5900 > /dev/null ) ; then
338         for i in $r5900_files ; do
339                 if test ! -d $i && (grep sanitize-r5900 $i > /dev/null) ; then
340                         if [ -n "${verbose}" ] ; then
341                                 echo Keeping r5900 stuff in $i
342                         fi
343                 fi
344         done
345 else
346         for i in * ; do
347                 if test ! -d $i && (grep sanitize-r5900 $i > /dev/null) ; then
348                         if [ -n "${verbose}" ] ; then
349                                 echo Removing traces of \"r5900\" from $i...
350                         fi
351                         cp $i new
352                         sed '/start\-sanitize\-r5900/,/end-\sanitize\-r5900/d' < $i > new
353                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
354                                 if [ -n "${verbose}" ] ; then
355                                         echo Caching $i in .Recover...
356                                 fi
357                                 mv $i .Recover
358                         fi
359                         mv new $i
360                 fi
361         done
362 fi
363
364 tx19_files="ChangeLog config.sub"
365
366 if ( echo $* | grep keep\-tx19 > /dev/null ) ; then
367         for i in $tx19_files ; do
368                 if test ! -d $i && (grep sanitize-tx19 $i > /dev/null) ; then
369                         if [ -n "${verbose}" ] ; then
370                                 echo Keeping tx19 stuff in $i
371                         fi
372                 fi
373         done
374 else
375         for i in * ; do
376                 if test ! -d $i && (grep sanitize-tx19 $i > /dev/null) ; then
377                         if [ -n "${verbose}" ] ; then
378                                 echo Removing traces of \"tx19\" from $i...
379                         fi
380                         cp $i new
381                         sed '/start\-sanitize\-tx19/,/end-\sanitize\-tx19/d' < $i > new
382                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
383                                 if [ -n "${verbose}" ] ; then
384                                         echo Caching $i in .Recover...
385                                 fi
386                                 mv $i .Recover
387                         fi
388                         mv new $i
389                 fi
390         done
391 fi
392
393 tic80_files="ChangeLog config.sub configure.in"
394
395 if ( echo $* | grep keep\-tic80 > /dev/null ) ; then
396         for i in $tic80_files ; do
397                 if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
398                         if [ -n "${verbose}" ] ; then
399                                 echo Keeping tic80 stuff in $i
400                         fi
401                 fi
402         done
403 else
404         for i in * ; do
405                 if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
406                         if [ -n "${verbose}" ] ; then
407                                 echo Removing traces of \"tic80\" from $i...
408                         fi
409                         cp $i new
410                         sed '/start\-sanitize\-tic80/,/end-\sanitize\-tic80/d' < $i > new
411                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
412                                 if [ -n "${verbose}" ] ; then
413                                         echo Caching $i in .Recover...
414                                 fi
415                                 mv $i .Recover
416                         fi
417                         mv new $i
418                 fi
419         done
420 fi
421
422 if ( echo $* | grep keep\-gm > /dev/null ) ; then
423         for i in * ; do
424                 if test ! -d $i && (grep sanitize-gm $i > /dev/null) ; then
425                         if [ -n "${verbose}" ] ; then
426                                 echo Keeping gm stuff in $i
427                         fi
428                 fi
429         done
430 else
431         for i in * ; do
432                 if test ! -d $i && (grep sanitize-gm $i > /dev/null) ; then
433                         if [ -n "${verbose}" ] ; then
434                                 echo Removing traces of \"gm\" from $i...
435                         fi
436                         cp $i new
437                         sed '/start\-sanitize\-gm/,/end-\sanitize\-gm/d' < $i > new
438                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
439                                 if [ -n "${verbose}" ] ; then
440                                         echo Caching $i in .Recover...
441                                 fi
442                                 mv $i .Recover
443                         fi
444                         mv new $i
445                 fi
446         done
447 fi
448
449 if ( echo $* | grep keep\-ide > /dev/null ) ; then
450         for i in * ; do
451                 if test ! -d $i && (grep sanitize-ide $i > /dev/null) ; then
452                         if [ -n "${verbose}" ] ; then
453                                 echo Keeping ide stuff in $i
454                         fi
455                 fi
456         done
457 else
458         for i in * ; do
459                 if test ! -d $i && (grep sanitize-ide $i > /dev/null) ; then
460                         if [ -n "${verbose}" ] ; then
461                                 echo Removing traces of \"ide\" from $i...
462                         fi
463                         cp $i new
464                         sed '/start\-sanitize\-ide/,/end-\sanitize\-ide/d' < $i > new
465                         if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
466                                 if [ -n "${verbose}" ] ; then
467                                         echo Caching $i in .Recover...
468                                 fi
469                                 mv $i .Recover
470                         fi
471                         mv new $i
472                 fi
473         done
474 fi
475
476 if ( echo $* | grep lose\-gdbtk > /dev/null ) ; then
477         echo Catering to RMS by removing traces of \"gdbtk\"...
478         if [ -n "${verbose}" ] ; then
479                 echo Removing traces of \"gdbtk\" from Makefile.in...
480         fi
481         cp Makefile.in new
482         sed -e '/GDBTK_SUPPORT_DIRS=/d' -e 's/ $(GDBTK_SUPPORT_DIRS)//' < Makefile.in > new
483         if [ -n "${safe}" -a ! -f .Recover/Makefile.in ] ; then
484                 if [ -n "${verbose}" ] ; then
485                         echo Caching Makefile.in in .Recover...
486                 fi
487                 mv Makefile.in .Recover
488         fi
489         mv new Makefile.in
490 fi
491
492 # Do this check LAST!
493 for i in * ; do
494         if test ! -d $i && (grep sanitize $i > /dev/null) ; then
495                 echo '***' Some mentions of Sanitize are still left in $i! 1>&2
496                 exit 1
497         fi
498 done
499
500 # eof