* Fixes for PRs 17559, 16602, brought over from sky branch.
[binutils-gdb.git] / ld / .Sanitize
1 # .Sanitize for devo/ld
2
3 # Each directory to survive its way into a release will need a file
4 # like this one called "./.Sanitize". All keyword lines must exist,
5 # and must exist in the order specified by this file. Each directory
6 # in the tree will be processed, top down, in the following order.
7
8 # Hash started lines like this one are comments and will be deleted
9 # before anything else is done. Blank lines will also be squashed
10 # out.
11
12 # The lines between the "Do-first:" line and the "Things-to-keep:"
13 # line are executed as a /bin/sh shell script before anything else is
14 # done in this directory.
15
16 Do-first:
17
18 # Remember the current lists of files in the subdirectories from which
19 # we might remove files.
20 if test -d emulparams; then
21 ld_emulparams_files=`cd emulparams; echo *`
22 else
23 ld_emulparams_files=
24 fi
25 if test -d emultempl; then
26 ld_emultempl_files=`cd emultempl; echo *`
27 else
28 ld_emultempl_files=
29 fi
30 if test -d scripttempl; then
31 ld_scripttempl_files=`cd scripttempl; echo *`
32 else
33 ld_scripttempl_files=
34 fi
35
36 # All files listed between the "Things-to-keep:" line and the
37 # "Do-last:" line will be kept. All other files will be removed.
38 # Directories listed in this section will have their own Sanitize
39 # called. Directories not listed will be removed in their entirety
40 # with rm -rf.
41
42 Things-to-keep:
43
44 ChangeLog
45 Makefile.am
46 Makefile.in
47 NEWS
48 README
49 TODO
50 acconfig.h
51 acinclude.m4
52 aclocal.m4
53 config.in
54 configure
55 configure.bat
56 configure.host
57 configure.in
58 configure.tgt
59 dep-in.sed
60 emulparams
61 emultempl
62 gen-doc.texi
63 genscripts.sh
64 h8-doc.texi
65 ld.1
66 ld.h
67 ld.texinfo
68 ldcref.c
69 ldctor.c
70 ldctor.h
71 ldemul.c
72 ldemul.h
73 ldexp.c
74 ldexp.h
75 ldfile.c
76 ldfile.h
77 ldgram.y
78 ldint.texinfo
79 ldlang.c
80 ldlang.h
81 ldlex.h
82 ldlex.l
83 ldmain.c
84 ldmain.h
85 ldmisc.c
86 ldmisc.h
87 ldver.c
88 ldver.h
89 ldwrite.c
90 ldwrite.h
91 lexsup.c
92 mac-ld.r
93 mpw-config.in
94 mpw-elfmips.c
95 mpw-eppcmac.c
96 mpw-esh.c
97 mpw-idtmips.c
98 mpw-make.sed
99 mri.c
100 mri.h
101 po
102 scripttempl
103 stamp-h.in
104 sysdep.h
105 testsuite
106
107 Things-to-lose:
108
109
110
111 # The lines between the "Do-last:" line and the end of the file
112 # are executed as a /bin/sh shell script after everything else is
113 # done.
114
115 Do-last:
116
117 v850_files="ChangeLog configure.tgt Makefile.am Makefile.in"
118 if ( echo $* | grep keep\-v850e > /dev/null ) ; then
119 for i in $v850_files ; do
120 if test ! -d $i && (grep sanitize-v850e $i > /dev/null) ; then
121 if [ -n "${verbose}" ] ; then
122 echo Keeping v850e stuff in $i
123 fi
124 fi
125 done
126 else
127 for i in $v850_files ; do
128 if test ! -d $i && (grep sanitize-v850e $i > /dev/null) ; then
129 if [ -n "${verbose}" ] ; then
130 echo Removing traces of \"v850e\" from $i...
131 fi
132 cp $i new
133 sed '/start\-sanitize\-v850e/,/end-\sanitize\-v850e/d' < $i > new
134 if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
135 if [ -n "${verbose}" ] ; then
136 echo Caching $i in .Recover...
137 fi
138 mv $i .Recover
139 fi
140 mv new $i
141 fi
142 done
143 fi
144
145 tx49_files="ChangeLog configure.tgt"
146 if ( echo $* | grep keep\-tx49 > /dev/null ) ; then
147 for i in $tx49_files ; do
148 if test ! -d $i && (grep sanitize-tx49 $i > /dev/null) ; then
149 if [ -n "${verbose}" ] ; then
150 echo Keeping tx49 stuff in $i
151 fi
152 fi
153 done
154 else
155 for i in $tx49_files ; do
156 if test ! -d $i && (grep sanitize-tx49 $i > /dev/null) ; then
157 if [ -n "${verbose}" ] ; then
158 echo Removing traces of \"tx49\" from $i...
159 fi
160 cp $i new
161 sed '/start\-sanitize\-tx49/,/end-\sanitize\-tx49/d' < $i > new
162 if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
163 if [ -n "${verbose}" ] ; then
164 echo Caching $i in .Recover...
165 fi
166 mv $i .Recover
167 fi
168 mv new $i
169 fi
170 done
171 fi
172
173 r5900_files="ChangeLog configure.tgt Makefile.in Makefile.am"
174 if ( echo $* | grep keep\-r5900 > /dev/null ) ; then
175 for i in $r5900_files ; do
176 if test ! -d $i && (grep sanitize-r5900 $i > /dev/null) ; then
177 if [ -n "${verbose}" ] ; then
178 echo Keeping r5900 stuff in $i
179 fi
180 fi
181 done
182 else
183 for i in $r5900_files ; do
184 if test ! -d $i && (grep sanitize-r5900 $i > /dev/null) ; then
185 if [ -n "${verbose}" ] ; then
186 echo Removing traces of \"r5900\" from $i...
187 fi
188 cp $i new
189 sed '/start\-sanitize\-r5900/,/end-\sanitize\-r5900/d' < $i > new
190 if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
191 if [ -n "${verbose}" ] ; then
192 echo Caching $i in .Recover...
193 fi
194 mv $i .Recover
195 fi
196 mv new $i
197 fi
198 done
199 fi
200
201 vr4320_files="ChangeLog configure.tgt"
202 if ( echo $* | grep keep\-vr4320 > /dev/null ) ; then
203 for i in $vr4320_files ; do
204 if test ! -d $i && (grep sanitize-vr4320 $i > /dev/null) ; then
205 if [ -n "${verbose}" ] ; then
206 echo Keeping vr4320 stuff in $i
207 fi
208 fi
209 done
210 else
211 for i in $vr4320_files ; do
212 if test ! -d $i && (grep sanitize-vr4320 $i > /dev/null) ; then
213 if [ -n "${verbose}" ] ; then
214 echo Removing traces of \"vr4320\" from $i...
215 fi
216 cp $i new
217 sed '/start\-sanitize\-vr4320/,/end-\sanitize\-vr4320/d' < $i > new
218 if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
219 if [ -n "${verbose}" ] ; then
220 echo Caching $i in .Recover...
221 fi
222 mv $i .Recover
223 fi
224 mv new $i
225 fi
226 done
227 fi
228
229 tic80_files="ChangeLog configure.tgt Makefile.am Makefile.in"
230 if ( echo $* | grep keep\-tic80 > /dev/null ) ; then
231 for i in $tic80_files ; do
232 if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
233 if [ -n "${verbose}" ] ; then
234 echo Keeping tic80 stuff in $i
235 fi
236 fi
237 done
238 else
239 for i in $tic80_files ; do
240 if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
241 if [ -n "${verbose}" ] ; then
242 echo Removing traces of \"tic80\" from $i...
243 fi
244 cp $i new
245 sed '/start\-sanitize\-tic80/,/end-\sanitize\-tic80/d' < $i > new
246 if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
247 if [ -n "${verbose}" ] ; then
248 echo Caching $i in .Recover...
249 fi
250 mv $i .Recover
251 fi
252 mv new $i
253 fi
254 done
255 fi
256
257 sky_files="ChangeLog configure.tgt"
258 if ( echo $* | grep keep\-sky > /dev/null ) ; then
259 for i in $sky_files ; do
260 if test ! -d $i && (grep sanitize-sky $i > /dev/null) ; then
261 if [ -n "${verbose}" ] ; then
262 echo Keeping sky stuff in $i
263 fi
264 fi
265 done
266 else
267 for i in $sky_files ; do
268 if test ! -d $i && (grep sanitize-sky $i > /dev/null) ; then
269 if [ -n "${verbose}" ] ; then
270 echo Removing traces of \"sky\" from $i...
271 fi
272 cp $i new
273 sed '/start\-sanitize\-sky/,/end-\sanitize\-sky/d' < $i > new
274 if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
275 if [ -n "${verbose}" ] ; then
276 echo Caching $i in .Recover...
277 fi
278 mv $i .Recover
279 fi
280 mv new $i
281 fi
282 done
283 fi
284
285 beos_files="ChangeLog Makefile.am Makefile.in configure.tgt"
286 if ( echo $* | grep keep\-beos > /dev/null ) ; then
287 for i in $beos_files ; do
288 if test ! -d $i && (grep sanitize-beos $i > /dev/null) ; then
289 if [ -n "${verbose}" ] ; then
290 echo Keeping beos stuff in $i
291 fi
292 fi
293 done
294 else
295 for i in $beos_files ; do
296 if test ! -d $i && (grep sanitize-beos $i > /dev/null) ; then
297 if [ -n "${verbose}" ] ; then
298 echo Removing traces of \"beos\" from $i...
299 fi
300 cp $i new
301 sed '/start\-sanitize\-beos/,/end-\sanitize\-beos/d' < $i > new
302 if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
303 if [ -n "${verbose}" ] ; then
304 echo Caching $i in .Recover...
305 fi
306 mv $i .Recover
307 fi
308 mv new $i
309 fi
310 done
311 fi
312
313 for i in * ; do
314 if test ! -d $i && (grep sanitize $i > /dev/null) ; then
315 echo '***' Some mentions of Sanitize are still left in ld/$i! 1>&2
316 fi
317 done
318
319 for lost in .. $ld_emulparams_files; do
320 if test $lost != .. && test $lost != CVS; then
321 if test -f emulparams/$lost; then
322 :
323 else
324 lost2=`echo $lost | sed -e 's/.sh$//'`
325 for i in Makefile.am Makefile.in configure.host configure.tgt configure.in configure; do
326 if fgrep $lost2 $i >/dev/null 2>&1; then
327 echo '***' File ld/emulparams/$lost was sanitized out but is still mentioned in ld/$i 1>&2
328 fi
329 done
330 fi
331 fi
332 done
333
334 for lost in .. $ld_emultempl_files; do
335 if test $lost != .. && test $lost != CVS; then
336 if test -f emultempl/$lost; then
337 :
338 else
339 lost2=`echo $lost | sed -e 's/.em$//'`
340 for i in Makefile.am Makefile.in configure.host configure.tgt configure.in configure; do
341 if fgrep $lost2 $i >/dev/null 2>&1; then
342 # There is a valid mention of beos in configure.tgt
343 if test $lost2 != "beos" || test $i != configure.tgt; then
344 echo '***' File ld/emultempl/$lost was sanitized out but is still mentioned in ld/$i 1>&2
345 fi
346 fi
347 done
348 if test -d emulparams; then
349 for i in emulparams/*; do
350 if fgrep $lost2 $i >/dev/null 2>&1; then
351 echo '***' File ld/emultempl/$lost was sanitized out but is still mentioned in ld/$i 1>&2
352 fi
353 done
354 fi
355 fi
356 fi
357 done
358
359 for lost in .. $ld_scripttempl_files; do
360 if test $lost != .. && test $lost != CVS; then
361 if test -f scripttempl/$lost; then
362 :
363 else
364 lost2=`echo $lost | sed -e 's/.sc$//'`
365 for i in Makefile.am Makefile.in configure.host configure.tgt configure.in configure; do
366 if fgrep $lost2 $i >/dev/null 2>&1; then
367 echo '***' File ld/scripttempl/$lost was sanitized out but is still mentioned in ld/$i 1>&2
368 fi
369 done
370 if test -d emulparams; then
371 for i in emulparams/*; do
372 if fgrep $lost2 $i >/dev/null 2>&1; then
373 echo '***' File ld/scripttempl/$lost was sanitized out but is still mentioned in ld/$i 1>&2
374 fi
375 done
376 fi
377 fi
378 fi
379 done
380
381 # This must come after all other sanitizations. Re-sanitize the .pot
382 # file.
383 if [ -n "${verbose}" ]; then
384 echo Re-computing files for gettext ...
385 fi
386
387 if [ -n "${safe}" -a ! -f po/.Recover/POTFILES.in ]; then
388 if [ -n "${verbose}" ]; then
389 echo Caching po/POTFILES.in in .Recover...
390 fi
391 mv po/POTFILES.in po/.Recover
392 fi
393 find . -name '*.[ch]' | sed -e 's,^\./,,' > po/POTFILES.in
394
395 if [ -n "${safe}" -a ! -f po/.Recover/ld.pot ]; then
396 if [ -n "${verbose}" ]; then
397 echo Caching po/ld.pot in .Recover...
398 fi
399 mv po/ld.pot po/.Recover
400 fi
401 # If this fails, Sanitization must fail.
402 xgettext -c -C -k_ -kN_ -f po/POTFILES.in -o po/ld.pot || exit 1
403 # eof