1 |
1005 |
ivang |
# Copyright (c) 1995, 1996, 2001 Cygnus Support
|
2 |
|
|
#
|
3 |
|
|
# The authors hereby grant permission to use, copy, modify, distribute,
|
4 |
|
|
# and license this software and its documentation for any purpose, provided
|
5 |
|
|
# that existing copyright notices are retained in all copies and that this
|
6 |
|
|
# notice is included verbatim in any distributions. No written agreement,
|
7 |
|
|
# license, or royalty fee is required for any of the authorized uses.
|
8 |
|
|
# Modifications to this software may be copyrighted by their authors
|
9 |
|
|
# and need not follow the licensing terms described here, provided that
|
10 |
|
|
# the new terms are clearly indicated on the first page of each file where
|
11 |
|
|
# they apply.
|
12 |
|
|
#
|
13 |
|
|
# This currently works with Motorola's MVME135 and IDP m68k based
|
14 |
|
|
# target boards.
|
15 |
|
|
#
|
16 |
|
|
|
17 |
|
|
VPATH = @srcdir@
|
18 |
|
|
srcdir = @srcdir@
|
19 |
|
|
objdir = .
|
20 |
|
|
srcroot = $(srcdir)/../..
|
21 |
|
|
objroot = $(objdir)/../..
|
22 |
|
|
|
23 |
|
|
prefix = @prefix@
|
24 |
|
|
exec_prefix = @exec_prefix@
|
25 |
|
|
|
26 |
|
|
host_alias = @host_alias@
|
27 |
|
|
target_alias = @target_alias@
|
28 |
|
|
program_transform_name = @program_transform_name@
|
29 |
|
|
|
30 |
|
|
bindir = @bindir@
|
31 |
|
|
libdir = @libdir@
|
32 |
|
|
tooldir = $(exec_prefix)/$(target_alias)
|
33 |
|
|
|
34 |
|
|
# Multilib support variables.
|
35 |
|
|
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
36 |
|
|
MULTIDIRS =
|
37 |
|
|
MULTISUBDIR =
|
38 |
|
|
MULTIDO = true
|
39 |
|
|
MULTICLEAN = true
|
40 |
|
|
|
41 |
|
|
INSTALL = @INSTALL@
|
42 |
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
43 |
|
|
INSTALL_DATA = @INSTALL_DATA@
|
44 |
|
|
|
45 |
|
|
SHELL = /bin/sh
|
46 |
|
|
|
47 |
|
|
CC = @CC@
|
48 |
|
|
|
49 |
|
|
AS = @AS@
|
50 |
|
|
AR = @AR@
|
51 |
|
|
LD = @LD@
|
52 |
|
|
RANLIB = @RANLIB@
|
53 |
|
|
AR_FLAGS = qv
|
54 |
|
|
|
55 |
|
|
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
56 |
|
|
then echo ${objroot}/../binutils/objdump ; \
|
57 |
|
|
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
58 |
|
|
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
59 |
|
|
then echo ${objroot}/../binutils/objcopy ; \
|
60 |
|
|
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
61 |
|
|
|
62 |
|
|
SCRIPTS = mvme162 mvme135 idp bcc
|
63 |
|
|
|
64 |
|
|
OBJS = close.o fstat.o getpid.o isatty.o kill.o \
|
65 |
|
|
lseek.o open.o print.o putnum.o read.o sbrk.o stat.o \
|
66 |
|
|
unlink.o write.o
|
67 |
|
|
|
68 |
|
|
CFLAGS = -g
|
69 |
|
|
# ARFLAGS = rv
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
# Here is all of the simulator stuff
|
73 |
|
|
SIM_SCRIPTS = sim.ld
|
74 |
|
|
SIM_LDFLAGS = -Tsim.ld
|
75 |
|
|
SIM_BSP = libsim.a
|
76 |
|
|
SIM_CRT0 = sim-crt0.o
|
77 |
|
|
SIM_OBJS = sim-print.o sim-inbyte.o sim-sbrk.o sim-abort.o sim-errno.o simulator.o sim-funcs.o unlink.o
|
78 |
|
|
SIM_TEST =
|
79 |
|
|
SIM_INSTALL = install-sim
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
CRT0 = crt0.o
|
83 |
|
|
#
|
84 |
|
|
# here's all the MVME135 target stuff
|
85 |
|
|
#
|
86 |
|
|
MVME_LDFLAGS= -L${srcdir} -Tmvme135.ld
|
87 |
|
|
MVME135_BSP= libmvme135.a
|
88 |
|
|
MVME162_BSP= libmvme162.a
|
89 |
|
|
#MVME135_OBJS= mvme.o
|
90 |
|
|
#MVME162_OBJS= mvme.o
|
91 |
|
|
# Uncomment the last two objects if you want to use the GDB stub.
|
92 |
|
|
# The stub is included "as is", and will likely take some hacking
|
93 |
|
|
# to work on your system.
|
94 |
|
|
MVME135_OBJS= cpu32bug.o # mvme-stub.o mvme135-asm.o
|
95 |
|
|
MVME162_OBJS= cpu32bug.o # mvme-stub.o mvme162lx-asm.o
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
#
|
99 |
|
|
# here's all the BCC target stuff
|
100 |
|
|
#
|
101 |
|
|
BCC_LDFLAGS= -L${srcdir} -Tbcc.ld
|
102 |
|
|
BCC_BSP= libbcc.a
|
103 |
|
|
BCC_OBJS= cpu32bug.o
|
104 |
|
|
|
105 |
|
|
#
|
106 |
|
|
# here's all the IDP target stuff
|
107 |
|
|
#
|
108 |
|
|
IDP_LDFLAGS= -L${srcdir} -Tidp.ld
|
109 |
|
|
IDP_BSP= libidp.a
|
110 |
|
|
IDP_OBJS= leds.o idp-inbyte.o idp-outbyte.o mc68ec.o
|
111 |
|
|
|
112 |
|
|
#
|
113 |
|
|
# here's all the IDP GDB target stuff
|
114 |
|
|
#
|
115 |
|
|
IDPGDB_LDFLAGS= -L${srcdir} -Tidpgdb.ld
|
116 |
|
|
IDPGDB_BSP= libidpgdb.a
|
117 |
|
|
IDPGDB_OBJS= leds.o idp-inbyte.o idp-gdb-outbyte.o mc68ec.o
|
118 |
|
|
|
119 |
|
|
#
|
120 |
|
|
# here's all the DBUG target stuff
|
121 |
|
|
#
|
122 |
|
|
DBUG_BSP= libdbug.a
|
123 |
|
|
DBUG_OBJS= dbug-exit.o dbug-inbyte.o dbug-outbyte.o
|
124 |
|
|
|
125 |
|
|
# Host specific makefile fragment comes in here.
|
126 |
|
|
@host_makefile_frag@
|
127 |
|
|
|
128 |
|
|
#
|
129 |
|
|
# build a test program for each target board. Just trying to get
|
130 |
|
|
# it to link is a good test, so we ignore all the errors for now.
|
131 |
|
|
#
|
132 |
|
|
all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP}
|
133 |
|
|
|
134 |
|
|
#
|
135 |
|
|
# here's where we build the board support packages for each target
|
136 |
|
|
#
|
137 |
|
|
${SIM_BSP}: ${SIM_OBJS}
|
138 |
|
|
${AR} ${ARFLAGS} $@ ${SIM_OBJS}
|
139 |
|
|
${RANLIB} $@
|
140 |
|
|
|
141 |
|
|
${BCC_BSP}: $(OBJS) ${BCC_OBJS}
|
142 |
|
|
${AR} ${ARFLAGS} $@ $(OBJS) ${BCC_OBJS}
|
143 |
|
|
${RANLIB} $@
|
144 |
|
|
|
145 |
|
|
${IDP_BSP}: $(OBJS) ${IDP_OBJS}
|
146 |
|
|
${AR} ${ARFLAGS} $@ $(OBJS) ${IDP_OBJS}
|
147 |
|
|
${RANLIB} $@
|
148 |
|
|
|
149 |
|
|
${IDPGDB_BSP}: $(OBJS) ${IDPGDB_OBJS}
|
150 |
|
|
${AR} ${ARFLAGS} $@ $(OBJS) ${IDPGDB_OBJS}
|
151 |
|
|
${RANLIB} $@
|
152 |
|
|
|
153 |
|
|
${DBUG_BSP}: $(OBJS) ${DBUG_OBJS}
|
154 |
|
|
${AR} ${ARFLAGS} $@ $(OBJS) ${DBUG_OBJS}
|
155 |
|
|
${RANLIB} $@
|
156 |
|
|
|
157 |
|
|
${MVME135_BSP}: $(OBJS) ${MVME135_OBJS}
|
158 |
|
|
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME135_OBJS}
|
159 |
|
|
${RANLIB} $@
|
160 |
|
|
|
161 |
|
|
${MVME162_BSP}: $(OBJS) ${MVME162_OBJS}
|
162 |
|
|
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS}
|
163 |
|
|
${RANLIB} $@
|
164 |
|
|
|
165 |
|
|
leds.o: ${srcdir}/leds.c
|
166 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
167 |
|
|
|
168 |
|
|
idp-inbyte.o: ${srcdir}/idp-inbyte.c
|
169 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
170 |
|
|
|
171 |
|
|
idp-outbyte.o: ${srcdir}/idp-outbyte.c
|
172 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
173 |
|
|
|
174 |
|
|
idp-gdb-outbyte.o: ${srcdir}/idp-outbyte.c
|
175 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) -DGDB_MONITOR_OUTPUT $(INCLUDES) -c $< -o $@
|
176 |
|
|
|
177 |
|
|
mc68ec.o: ${srcdir}/mc68ec.c
|
178 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
179 |
|
|
|
180 |
|
|
test.o: ${srcdir}/test.c
|
181 |
|
|
|
182 |
|
|
#
|
183 |
|
|
# Make a simple test case to test the linker script, startup code, and
|
184 |
|
|
# I/O code
|
185 |
|
|
#
|
186 |
|
|
test: $(OBJS) idp-test.srec mvme135-test.srec bcc-test.srec \
|
187 |
|
|
idp-test.dis mvme135-test.dis bcc-test.dis
|
188 |
|
|
@echo Done...
|
189 |
|
|
|
190 |
|
|
# compile a fully linked binary. The -N option is for a.out, so the
|
191 |
|
|
# base address will be zero, rather than the default of 0x2020. The
|
192 |
|
|
# -Wl,-T*.ld is for the linker script. By using -Wl, the linker script
|
193 |
|
|
# is put on the proper place in the comand line for ld, and all the
|
194 |
|
|
# symbols will get fully resolved.
|
195 |
|
|
|
196 |
|
|
idp-test.x: test.o ${CRT0} Makefile ${IDP_BSP}
|
197 |
|
|
${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
|
198 |
|
|
test.o -o $@ $(LDFLAGS_FOR_TARGET) -N -Wl,-Tidp.ld
|
199 |
|
|
idp-test.srec: idp-test.x
|
200 |
|
|
$(OBJCOPY) -O srec idp-test.x $@
|
201 |
|
|
idp-test.dis: idp-test.x
|
202 |
|
|
@rm -fr idp-test.dis
|
203 |
|
|
$(OBJDUMP) -d idp-test.x > $@
|
204 |
|
|
idp-test: idp-test.srec idp-test.dis
|
205 |
|
|
|
206 |
|
|
idpgdb-test.x: test.o ${CRT0} Makefile ${IDPGDB_BSP}
|
207 |
|
|
${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
|
208 |
|
|
test.o -o $@ $(LDFLAGS_FOR_TARGET) -N -Wl,-Tidpgdb.ld
|
209 |
|
|
idpgdb-test.srec: idpgdb-test.x
|
210 |
|
|
$(OBJCOPY) -O srec idpgdb-test.x $@
|
211 |
|
|
idpgdb-test.dis: idpgdb-test.x
|
212 |
|
|
@rm -fr idpgdb-test.dis
|
213 |
|
|
$(OBJDUMP) -d idpgdb-test.x > $@
|
214 |
|
|
idpgdb-test: idpgdb-test.srec idpgdb-test.dis
|
215 |
|
|
|
216 |
|
|
mvme135-test.x: test.o ${CRT0} ${srcdir}/mvme135.ld Makefile ${MVME135_BSP}
|
217 |
|
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
218 |
|
|
-N -Wl,-Tmvme135.ld -nostdlib
|
219 |
|
|
mvme135-test.srec: mvme135-test.x
|
220 |
|
|
$(OBJCOPY) -O srec mvme135-test.x $@
|
221 |
|
|
mvme135-test.dis: mvme135-test.x
|
222 |
|
|
@rm -fr mvme135-test.dis
|
223 |
|
|
$(OBJDUMP) -d mvme135-test.x > $@
|
224 |
|
|
mvme135-test: mvme135-test.srec mvme135-test.dis
|
225 |
|
|
|
226 |
|
|
mvme162-test.x: test.o ${CRT0} ${srcdir}/mvme162.ld Makefile ${MVME162_BSP}
|
227 |
|
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
228 |
|
|
-N -Wl,-Tmvme162.ld -nostdlib
|
229 |
|
|
mvme162-test.srec: mvme162-test.x
|
230 |
|
|
$(OBJCOPY) -O srec mvme162-test.x $@
|
231 |
|
|
mvme162-test.dis: mvme162-test.x
|
232 |
|
|
@rm -fr mvme162-test.dis
|
233 |
|
|
$(OBJDUMP) -d mvme162-test.x > $@
|
234 |
|
|
mvme162-test: mvme162-test.srec mvme162-test.dis
|
235 |
|
|
|
236 |
|
|
bcc-test.x: test.o ${CRT0} ${srcdir}/bcc.ld Makefile ${BCC_BSP}
|
237 |
|
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
238 |
|
|
-N -Wl,-Tbcc.ld -nostdlib
|
239 |
|
|
bcc-test.srec: bcc-test.x
|
240 |
|
|
$(OBJCOPY) -O srec bcc-test.x $@
|
241 |
|
|
bcc-test.dis: bcc-test.x
|
242 |
|
|
@rm -fr bcc-test.dis
|
243 |
|
|
$(OBJDUMP) -d bcc-test.x > $@
|
244 |
|
|
bcc-test: bcc-test.srec bcc-test.dis
|
245 |
|
|
|
246 |
|
|
# a C++ test case
|
247 |
|
|
dtor.o: $(srcdir)/dtor.C
|
248 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $<
|
249 |
|
|
dtor.dis: dtor.x
|
250 |
|
|
@rm -fr dtor.dis
|
251 |
|
|
$(OBJDUMP) -d dtor.x > $@
|
252 |
|
|
dtor.x: dtor.o ${CRT0} ${srcdir}/mvme135.ld Makefile ${MVME135_BSP}
|
253 |
|
|
${CC} -L${srcdir} -L${objdir} dtor.o -o $@ $(LIBS_FOR_TARGET) \
|
254 |
|
|
-N -Wl,-Tmvme135.ld -nostdlib
|
255 |
|
|
|
256 |
|
|
unlink.o: $(srcdir)/../unlink.c
|
257 |
|
|
|
258 |
|
|
.PHONY: install info dvi doc install-info clean-info
|
259 |
|
|
install:
|
260 |
|
|
# install SIM stuff
|
261 |
|
|
$(INSTALL_PROGRAM) $(SIM_CRT0) $(tooldir)/lib${MULTISUBDIR}/$(SIM_CRT0)
|
262 |
|
|
$(INSTALL_PROGRAM) $(SIM_BSP) $(tooldir)/lib${MULTISUBDIR}/$(SIM_BSP)
|
263 |
|
|
$(INSTALL_DATA) ${srcdir}/sim.ld $(tooldir)/lib${MULTISUBDIR}/sim.ld
|
264 |
|
|
#
|
265 |
|
|
$(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
|
266 |
|
|
# install BCC stuff
|
267 |
|
|
$(INSTALL_PROGRAM) $(BCC_BSP) $(tooldir)/lib${MULTISUBDIR}/$(BCC_BSP)
|
268 |
|
|
$(INSTALL_DATA) ${srcdir}/bcc.ld $(tooldir)/lib${MULTISUBDIR}/bcc.ld
|
269 |
|
|
# install IDP stuff
|
270 |
|
|
$(INSTALL_PROGRAM) $(IDP_BSP) $(tooldir)/lib${MULTISUBDIR}/$(IDP_BSP)
|
271 |
|
|
$(INSTALL_DATA) ${srcdir}/idp.ld $(tooldir)/lib${MULTISUBDIR}/idp.ld
|
272 |
|
|
# install IDPGDB stuff
|
273 |
|
|
$(INSTALL_PROGRAM) $(IDPGDB_BSP) $(tooldir)/lib${MULTISUBDIR}/$(IDPGDB_BSP)
|
274 |
|
|
$(INSTALL_DATA) ${srcdir}/idpgdb.ld $(tooldir)/lib${MULTISUBDIR}/idpgdb.ld
|
275 |
|
|
# install MVME135 stuff
|
276 |
|
|
$(INSTALL_PROGRAM) $(MVME135_BSP) $(tooldir)/lib${MULTISUBDIR}/$(MVME135_BSP)
|
277 |
|
|
$(INSTALL_DATA) ${srcdir}/mvme135.ld $(tooldir)/lib${MULTISUBDIR}/mvme135.ld
|
278 |
|
|
# install MVME162lx stuff
|
279 |
|
|
$(INSTALL_PROGRAM) $(MVME162_BSP) $(tooldir)/lib${MULTISUBDIR}/$(MVME162_BSP)
|
280 |
|
|
$(INSTALL_DATA) ${srcdir}/mvme162.ld $(tooldir)/lib${MULTISUBDIR}/mvme162.ld
|
281 |
|
|
# install DBUG stuff
|
282 |
|
|
$(INSTALL_PROGRAM) $(DBUG_BSP) $(tooldir)/lib${MULTISUBDIR}/$(DBUG_BSP)
|
283 |
|
|
$(INSTALL_DATA) ${srcdir}/sbc5204.ld $(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
|
284 |
|
|
$(INSTALL_DATA) ${srcdir}/sbc5206.ld $(tooldir)/lib${MULTISUBDIR}/sbc5206.ld
|
285 |
|
|
|
286 |
|
|
# target specific makefile fragment comes in here.
|
287 |
|
|
@target_makefile_frag@
|
288 |
|
|
|
289 |
|
|
clean mostlyclean:
|
290 |
|
|
rm -f a.out core *.i *~ *.a *.o *-test *.srec *.dis *.x *.map
|
291 |
|
|
|
292 |
|
|
distclean maintainer-clean realclean: clean
|
293 |
|
|
rm -f Makefile config.cache config.log config.status
|
294 |
|
|
|
295 |
|
|
info dvi doc:
|
296 |
|
|
install-info:
|
297 |
|
|
clean-info:
|
298 |
|
|
|
299 |
|
|
Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@
|
300 |
|
|
$(SHELL) config.status
|
301 |
|
|
|
302 |
|
|
config.status: configure
|
303 |
|
|
$(SHELL) config.status --recheck
|