# .Sanitize for devo/gdb.

# Each directory to survive its way into a release will need a file
# like this one called "./.Sanitize".  All keyword lines must exist,
# and must exist in the order specified by this file.  Each directory
# in the tree will be processed, top down, in the following order.

# Hash started lines like this one are comments and will be deleted
# before anything else is done.  Blank lines will also be squashed
# out.

# The lines between the "Do-first:" line and the "Things-to-keep:"
# line are executed as a /bin/sh shell script before anything else is
# done in this directory.

Do-first:

arc_files="arc-tdep.c remote-arc.c"

if ( echo $* | grep keep\-arc > /dev/null ) ; then
	keep_these_too="${arc_files} ${keep_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Keeping ${arc_files}
	fi
else
	lose_these_too="${arc_files} ${lose_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Deleting ${arc_files}
	fi
fi

gdbtk_files="README.GDBTK gdbtk.c gdbtcl gdbtk.tcl"

if ( echo $* | grep lose\-gdbtk > /dev/null ) ; then
	lose_these_too="${gdbtk_files} ${lose_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Deleting ${gdbtk_files}
	fi
else
	keep_these_too="${gdbtk_files} ${keep_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Keeping ${gdbtk_files}
	fi
fi

# WinGDB files are not really ready to be part of FSF releases, but
# keep them for progressives and such.

mswin_files="mswin"

if ( echo $* | grep lose\-mswin > /dev/null ) ; then
	lose_these_too="${mswin_files} ${lose_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Deleting ${mswin_files}
	fi
else
	keep_these_too="${mswin_files} ${keep_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Keeping ${mswin_files}
	fi
fi

gm_files="gmagic.c gmagic.h"

if ( echo $* | grep keep\-gm > /dev/null ) ; then
	keep_these_too="${gm_files} ${keep_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Keeping ${gm_files}
	fi
else
	lose_these_too="${gm_files} ${lose_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Deleting ${gm_files}
	fi
fi

tic80_files="tic80-tdep.c"

if ( echo $* | grep keep\-tic80 > /dev/null ) ; then
	keep_these_too="${tic80_files} ${keep_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Keeping ${tic80_files}
	fi
else
	lose_these_too="${tic80_files} ${lose_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Deleting ${tic80_files}
	fi
fi

v850_files="v850ice.c v850-tdep.c"

if ( echo $* | grep keep\-v850 > /dev/null ) ; then
	keep_these_too="${v850_files} ${keep_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Keeping ${v850_files}
	fi
else
	lose_these_too="${v850_files} ${lose_these_too}"
	if [ -n "${verbose}" ] ; then
		echo Deleting ${v850_files}
	fi
fi

# All files listed between the "Things-to-keep:" line and the
# "Files-to-sed:" line will be kept.  All other files will be removed.
# Directories listed in this section will have their own Sanitize
# called.  Directories not listed will be removed in their entirety
# with rm -rf.

Things-to-keep:

29k-share
COPYING
ChangeLog
ChangeLog-3.x
ChangeLog-9091
ChangeLog-92
ChangeLog-93
ChangeLog-94
ChangeLog-95
ChangeLog-96
Makefile.in
NEWS
README
TODO
a29k-tdep.c
a68v-nat.c
abug-rom.c
aclocal.m4
acconfig.h
alpha-nat.c
alpha-tdep.c
altos-xdep.c
annotate.c
annotate.h
arm-convert.s
arm-tdep.c
arm-xdep.c
bcache.c
bcache.h
blockframe.c
breakpoint.c
breakpoint.h
buildsym.c
buildsym.h
c-exp.y
c-lang.c
c-lang.h
c-typeprint.c
c-valprint.c
call-cmds.h
ch-exp.c
ch-lang.c
ch-lang.h
ch-typeprint.c
ch-valprint.c
coff-solib.c
coff-solib.h
coffread.c
command.c
command.h
complaints.c
complaints.h
config
config.in
configure
configure.host
configure.in
configure.tgt
convex-tdep.c
convex-xdep.c
copying.awk
copying.c
core-aout.c
core-regset.c
core-sol2.c
corefile.c
corelow.c
cp-valprint.c
cpu32bug-rom.c
cxux-nat.c
d10v-tdep.c
dbug-rom.c
dbxread.c
dcache.c
dcache.h
debugify.h
debugify.c
defs.h
delta68-nat.c
demangle.c
dink32-rom.c
doc
dpx2-nat.c
dsrec.c
dst.h
dstread.c
dwarf2read.c
dwarfread.c
elfread.c
environ.c
environ.h
eval.c
exec.c
exc_request.defs
expprint.c
expression.h
f-exp.y
f-lang.c
f-lang.h
f-typeprint.c
f-valprint.c
findvar.c
fork-child.c
frame.h
gdb_stat.h
gdb_string.h
gdb-stabs.h
gdb.1
gdb.gdb
gdba.el
gdbcmd.h
gdbcore.h
gdbinit.in
gdbserver
gdbthread.h
gdbtypes.c
gdbtypes.h
gnu-nat.c
gnu-nat.h
gnu-regex.c
gnu-regex.h
go32-xdep.c
gould-tdep.c
gould-xdep.c
h8300-tdep.c
h8500-tdep.c
hp300ux-nat.c
hppa-tdep.c
hppab-nat.c
hppah-nat.c
hppam3-nat.c
hpread.c
hpux-thread.c
i386-stub.c
i386-tdep.c
i386aix-nat.c
i386b-nat.c
i386gnu-nat.c
i386ly-tdep.c
i386m3-nat.c
i386mach-nat.c
i386v-nat.c
i386v4-nat.c
i387-tdep.c
i960-tdep.c
infcmd.c
inferior.h
inflow.c
infptrace.c
infrun.c
inftarg.c
irix4-nat.c
irix5-nat.c
isi-xdep.c
jv-exp.y
jv-lang.c
jv-lang.h
jv-valprint.c
jv-typeprint.c
kdb-start.c
language.c
language.h
lynx-nat.c
m2-exp.y
m2-lang.c
m2-lang.h
m2-typeprint.c
m2-valprint.c
m3-nat.c
m32r-rom.c
m32r-stub.c
m32r-tdep.c
m68k-stub.c
m68k-tdep.c
m68knbsd-nat.c
m88k-nat.c
m88k-tdep.c
mac-defs.h
mac-xdep.c
mac-gdb.r
mac-nat.c
main.c
maint.c
mdebugread.c
mem-break.c
minimon.h
minsyms.c
mips-nat.c
mips-tdep.c
mipsm3-nat.c
mipsv4-nat.c
mipsread.c
mn10200-tdep.c
mn10300-tdep.c
mon960-rom.c
monitor.h
monitor.c
mpw-config.in
mpw-make.sed
msg.defs
msg_reply.defs
news-xdep.c
nindy-share
nindy-tdep.c
nlm
nlmread.c
notify.defs
ns32k-tdep.c
ns32km3-nat.c
objfiles.c
objfiles.h
ocd.c
ocd.h
op50-rom.c
os9kread.c
osf-share
osfsolib.c
parse.c
parser-defs.h
partial-stab.h
ppcbug-rom.c
ppc-bdm.c
printcmd.c
process_reply.defs
procfs.c
ptx4-nat.c
pyr-tdep.c
pyr-xdep.c
remote-adapt.c
remote-array.c
remote-bug.c
remote-e7000.c
remote-eb.c
remote-es.c
remote-est.c
remote-hms.c
remote-mips.c
remote-mm.c
remote-nindy.c
remote-nrom.c
remote-os9k.c
remote-rdp.c
remote-sds.c
remote-sim.c
remote-st.c
remote-udi.c
remote-utils.c
remote-utils.h
remote-vx.c
remote-vx29k.c
remote-vx68.c
remote-vx960.c
remote-vxmips.c
remote-vxsparc.c
remote.c
reply_mig_hack.awk
rs6000-nat.c
rs6000-tdep.c
rom68k-rom.c
saber.suppress
scm-exp.c
scm-lang.c
scm-lang.h
scm-tags.h
scm-valprint.c
ser-e7kpc.c
ser-go32.c
ser-mac.c
ser-ocd.c
ser-tcp.c
ser-unix.c
serial.c
serial.h
sh-stub.c
sh-tdep.c
sh3-rom.c
signals.h
sol-thread.c
solib.c
solib.h
somread.c
somsolib.c
somsolib.h
source.c
sparc-nat.c
sparc-stub.c
sparc-tdep.c
sparcl-stub.c
sparcl-tdep.c
sparclet-rom.c
sparclet-stub.c
srec.h
stabsread.c
stabsread.h
stack.c
standalone.c
stop-gdb.c
stuff.c
sun3-nat.c
sun386-nat.c
symfile.c
symfile.h
symm-nat.c
symm-tdep.c
symmisc.c
symtab.c
symtab.h
tahoe-tdep.c
target.c
target.h
terminal.h
testsuite
thread.c
top.c
top.h
typeprint.c
typeprint.h
ultra3-nat.c
ultra3-xdep.c
umax-xdep.c
utils.c
valarith.c
valops.c
valprint.c
valprint.h
value.h
values.c
vax-tdep.c
vx-share
w65-tdep.c
w89k-rom.c
win32-nat.c
xcoffread.c
xcoffsolib.c
xcoffsolib.h
xmodem.c
xmodem.h
z8k-tdep.c

# Things which are explicitly *not* kept, for now.

Things-to-lose:

ser-go32-para.c
HOW_TO_RELEASE

Do-last:

# Don't try to clean directories here, as the 'mv' command will fail.
# Also, grep fails on NFS mounted directories.
if ( echo $* | grep lose\-gdbtk > /dev/null ) ; then
	echo Catering to RMS by removing traces of \"gdbtk\"...
	for i in * ; do
		if test ! -d $i && (grep sanitize-gdbtk $i > /dev/null) ; then
			echo Removing traces of \"gdbtk\" out of $i...
			cp $i new
			sed '/start\-sanitize\-gdbtk/,/end-\sanitize\-gdbtk/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				echo Caching $i in .Recover...
				mv $i .Recover
			fi
			mv new $i
		fi
	done
else
	echo Leaving \"gdbtk\" in the sources...
	for i in * ; do
		if test ! -d $i && (grep sanitize-gdbtk $i > /dev/null) ; then
			echo Keeping \"gdbtk\" stuff in $i, but editing out sanitize lines...
			cp $i new
			sed -e '/start\-sanitize\-gdbtk/d' -e '/end\-sanitize\-gdbtk/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				echo Caching $i in .Recover...
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

arc_files="configure.tgt ChangeLog-95"

if ( echo $* | grep keep\-arc > /dev/null ) ; then
	for i in $arc_files ; do
		if test ! -d $i && (grep sanitize-arc $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Keeping arc stuff in $i
			fi
		fi
	done
else
	for i in $arc_files ; do
		if test ! -d $i && (grep sanitize-arc $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Removing traces of \"arc\" from $i...
			fi
			cp $i new
			sed '/start\-sanitize\-arc/,/end-\sanitize\-arc/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				if [ -n "${verbose}" ] ; then
					echo Caching $i in .Recover...
				fi
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

if ( echo $* | grep keep\-gm > /dev/null ) ; then
	for i in * ; do
		if test ! -d $i && (grep sanitize-gm $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Keeping gm stuff in $i
			fi
		fi
	done
else
	for i in * ; do
		if test ! -d $i && (grep sanitize-gm $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Removing traces of \"gm\" from $i...
			fi
			cp $i new
			sed '/start\-sanitize\-gm/,/end-\sanitize\-gm/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				if [ -n "${verbose}" ] ; then
					echo Caching $i in .Recover...
				fi
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

if ( echo $* | grep keep\-v850 > /dev/null ) ; then
	for i in * ; do
		if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Keeping v850 stuff in $i
			fi
		fi
	done
else
	for i in * ; do
		if test ! -d $i && (grep sanitize-v850 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Removing traces of \"v850\" from $i...
			fi
			cp $i new
			sed '/start\-sanitize\-v850/,/end-\sanitize\-v850/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				if [ -n "${verbose}" ] ; then
					echo Caching $i in .Recover...
				fi
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

if ( echo $* | grep keep\-sh4 > /dev/null ) ; then
	for i in * ; do
		if test ! -d $i && (grep sanitize-sh4 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Keeping sh4 stuff in $i
			fi
		fi
	done
else
	for i in * ; do
		if test ! -d $i && (grep sanitize-sh4 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Removing traces of \"sh4\" from $i...
			fi
			cp $i new
			sed '/start\-sanitize\-sh4/,/end-\sanitize\-sh4/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				if [ -n "${verbose}" ] ; then
					echo Caching $i in .Recover...
				fi
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

if ( echo $* | grep keep\-r5900 > /dev/null ) ; then
	for i in * ; do
		if test ! -d $i && (grep sanitize-r5900 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Keeping r5900 stuff in $i
			fi
		fi
	done
else
	for i in * ; do
		if test ! -d $i && (grep sanitize-r5900 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Removing traces of \"r5900\" from $i...
			fi
			cp $i new
			sed '/start\-sanitize\-r5900/,/end-\sanitize\-r5900/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				if [ -n "${verbose}" ] ; then
					echo Caching $i in .Recover...
				fi
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

if ( echo $* | grep keep\-tx39 > /dev/null ) ; then
	for i in * ; do
		if test ! -d $i && (grep sanitize-tx39 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Keeping tx39 stuff in $i
			fi
		fi
	done
else
	for i in * ; do
		if test ! -d $i && (grep sanitize-tx39 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Removing traces of \"tx39\" from $i...
			fi
			cp $i new
			sed '/start\-sanitize\-tx39/,/end-\sanitize\-tx39/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				if [ -n "${verbose}" ] ; then
					echo Caching $i in .Recover...
				fi
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

if ( echo $* | grep keep\-tic80 > /dev/null ) ; then
	for i in * ; do
		if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Keeping tic80 stuff in $i
			fi
		fi
	done
else
	for i in * ; do
		if test ! -d $i && (grep sanitize-tic80 $i > /dev/null) ; then
			if [ -n "${verbose}" ] ; then
				echo Removing traces of \"tic80\" from $i...
			fi
			cp $i new
			sed '/start\-sanitize\-tic80/,/end-\sanitize\-tic80/d' < $i > new
			if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
				if [ -n "${verbose}" ] ; then
					echo Caching $i in .Recover...
				fi
				mv $i .Recover
			fi
			mv new $i
		fi
	done
fi

for i in * ; do
	if test ! -d $i && (grep sanitize $i > /dev/null) ; then
		echo '***' Some mentions of Sanitize are still left in $i! 1>&2
	fi
done

#
# End of file.
