aboutsummaryrefslogtreecommitdiff
path: root/gdb/config.gdb
blob: 257846215586144b5a8cf3292e1c61eed41b943a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/bin/sh

#
# Shell script to create proper links to machine-dependent files in
# preparation for compiling gdb.
#
# Usage: config.gdb machine [operating-system]
#
# If config.gdb succeeds, it leaves its status in config.status.
# If config.gdb fails after disturbing the status quo, 
# 	config.status is removed.
#

progname=$0

case $# in 
1)
	machine=$1
	os="none"
	;;
2)
	machine=$1
	os=$2
	;;
*)
	echo "Usage: $progname machine [operating-system]"
	echo "Available machine types:"
	echo m-*.h | sed 's/m-//g' | sed 's/\.h//g'
	if [ -r config.status ]
	then
		cat config.status
	fi
	exit 1
	;;
esac

paramfile=m-${machine}.h
pinsnfile=${machine}-pinsn.c
opcodefile=${machine}-opcode.h
if [ -r ${machine}-dep.c ]
then
	depfile=${machine}-dep.c
else
	depfile=default-dep.c
fi

#
# Special cases.
# If a file is not needed, set the filename to 'skip' and it will be
# ignored.
#
case $machine in
aux)
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;
vax)
	pinsnfile=vax-pinsn.c
	opcodefile=vax-opcode.h
	;;
hp9k320)
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;
isi)
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;
i386)
	echo "Note: i386 users need to modify \`CLIBS' & \`REGEX*' in the Makefile"
	opcodefile=skip
	;;
i386gas)
	echo "Note: i386 users need to modify \`CLIBS' & \`REGEX*' in the Makefile"
	echo "Use of the coff encapsulation features also requires the GNU binutils utilities"
	echo "to be ahead of their System V counterparts in your path."
	pinsnfile=i386-pinsn.c
	depfile=i386-dep.c
	opcodefile=skip
	;;
merlin)
	pinsnfile=ns32k-pinsn.c
	opcodefile=ns32k-opcode.h
	;;
news)
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;
npl)
	pinsnfile=gld-pinsn.c
	;;
pn)
	pinsnfile=gld-pinsn.c
	;;
sun2)
	case $os in
	os4|sunos4)
		paramfile=m-sun2os4.h
		;;
	os2|sunos2)
		paramfile=m-sun2os2.h
	esac
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;
sun2os2)
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;	
sun2os4)
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;	
sun3)
	case $os in
	os4|sunos4)
		paramfile=m-sun3os4.h
	esac
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	;;
sun3os4)
	pinsnfile=m68k-pinsn.c
	opcodefile=m68k-opcode.h
	depfile=sun3-dep.c
	;;	
sun4os4)
	pinsnfile=sparc-pinsn.c
	opcodefile=sparc-opcode.h
	depfile=sparc-dep.c
	;;	
umax)
	pinsnfile=ns32k-pinsn.c
	opcodefile=ns32k-opcode.h
	;;
sparc|sun4)
	case $os in
	os4|sunos4)
		paramfile=m-sun4os4.h
	esac
	pinsnfile=sparc-pinsn.c
	opcodefile=sparc-opcode.h
	depfile=sparc-dep.c
	paramfile=m-sparc.h
	;;
test)
	paramfile=one
	pinsnfile=three
	opcodefile=four
	;;
*)
	echo "Unknown machine type: \`$machine'"
	echo "Available types:"
	echo m-*.h | sed 's/m-//g' | sed 's/\.h//g'
	exit 1
esac

files="$paramfile $pinsnfile $opcodefile $depfile"
links="param.h pinsn.c opcode.h dep.c"	

while [ -n "$files" ]
do
	# set file to car of files, files to cdr of files
	set $files; file=$1; shift; files=$*
	set $links; link=$1; shift; links=$*

	if [ "$file" != skip ]
	then
		if [ ! -r $file ]
		then
			echo "$progname: cannot create a link \`$link',"
			echo "since the file \`$file' does not exist."
			exit 1
		fi

		rm -f $link config.status
		# Make a symlink if possible, otherwise try a hard link
		ln -s $file $link 2>/dev/null || ln $file $link

		if [ ! -r $link ]
		then
			echo "$progname: unable to link \`$link' to \`$file'."
			exit 1
		fi
		echo "Linked \`$link' to \`$file'."
	fi
done

echo "Links are now set up for use with a $machine." \
	| tee config.status
exit 0