1 # Copyright (c) 1995, 1996, 2001 Cygnus Support
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
13 # This currently works with Motorola's MVME135 and IDP m68k based
20 srcroot
= $(srcdir)/..
/..
21 objroot
= $(objdir
)/..
/..
24 exec_prefix = @
exec_prefix@
26 host_alias
= @host_alias@
27 target_alias
= @target_alias@
28 program_transform_name
= @program_transform_name@
32 tooldir
= $(exec_prefix)/$(target_alias
)
34 # Multilib support variables.
35 # TOP is used instead of MULTI{BUILD,SRC}TOP.
42 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
43 INSTALL_DATA
= @INSTALL_DATA@
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`
62 SCRIPTS
= mvme162 mvme135 idp bcc
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 \
72 # Here is all of the simulator stuff
74 SIM_LDFLAGS
= -Tsim.
ld
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
79 SIM_INSTALL
= install-sim
84 # here's all the MVME135 target stuff
86 MVME_LDFLAGS
= -L
${srcdir} -Tmvme135.
ld
87 MVME135_BSP
= libmvme135.a
88 MVME162_BSP
= libmvme162.a
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
99 # here's all the BCC target stuff
101 BCC_LDFLAGS
= -L
${srcdir} -Tbcc.
ld
106 # here's all the IDP target stuff
108 IDP_LDFLAGS
= -L
${srcdir} -Tidp.
ld
110 IDP_OBJS
= leds.o idp-inbyte.o idp-outbyte.o mc68ec.o
113 # here's all the IDP GDB target stuff
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
120 # here's all the DBUG target stuff
123 DBUG_OBJS
= dbug-exit.o dbug-inbyte.o dbug-outbyte.o
125 # Host specific makefile fragment comes in here.
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.
132 all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP}
135 # here's where we build the board support packages for each target
137 ${SIM_BSP}: ${SIM_OBJS}
138 ${AR} ${ARFLAGS} $@
${SIM_OBJS}
141 ${BCC_BSP}: $(OBJS
) ${BCC_OBJS}
142 ${AR} ${ARFLAGS} $@
$(OBJS
) ${BCC_OBJS}
145 ${IDP_BSP}: $(OBJS
) ${IDP_OBJS}
146 ${AR} ${ARFLAGS} $@
$(OBJS
) ${IDP_OBJS}
149 ${IDPGDB_BSP}: $(OBJS
) ${IDPGDB_OBJS}
150 ${AR} ${ARFLAGS} $@
$(OBJS
) ${IDPGDB_OBJS}
153 ${DBUG_BSP}: $(OBJS
) ${DBUG_OBJS}
154 ${AR} ${ARFLAGS} $@
$(OBJS
) ${DBUG_OBJS}
157 ${MVME135_BSP}: $(OBJS
) ${MVME135_OBJS}
158 ${AR} ${ARFLAGS} $@
$(OBJS
) ${MVME135_OBJS}
161 ${MVME162_BSP}: $(OBJS
) ${MVME162_OBJS}
162 ${AR} ${ARFLAGS} $@
$(OBJS
) ${MVME162_OBJS}
165 leds.o
: ${srcdir}/leds.c
166 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) -c
$<
168 idp-inbyte.o
: ${srcdir}/idp-inbyte.c
169 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) -c
$<
171 idp-outbyte.o
: ${srcdir}/idp-outbyte.c
172 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) -c
$<
174 idp-gdb-outbyte.o
: ${srcdir}/idp-outbyte.c
175 $(CC
) $(CFLAGS_FOR_TARGET
) -DGDB_MONITOR_OUTPUT
$(INCLUDES
) -c
$< -o
$@
177 mc68ec.o
: ${srcdir}/mc68ec.c
178 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) -c
$<
180 test.o
: ${srcdir}/test.c
183 # Make a simple test case to test the linker script, startup code, and
186 test: $(OBJS
) idp-test.srec mvme135-test.srec bcc-test.srec \
187 idp-test.dis mvme135-test.dis bcc-test.dis
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.
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
203 $(OBJDUMP
) -d idp-test.x
> $@
204 idp-test
: idp-test.srec idp-test.dis
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
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
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
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
243 $(OBJDUMP
) -d bcc-test.x
> $@
244 bcc-test
: bcc-test.srec bcc-test.dis
247 dtor.o
: $(srcdir)/dtor.C
248 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) -o
$@
-c
$<
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
256 unlink.o
: $(srcdir)/..
/unlink.c
258 .PHONY
: install info dvi doc install-info clean-info
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
265 $(INSTALL_PROGRAM
) $(CRT0
) $(tooldir
)/lib
${MULTISUBDIR}/$(CRT0
)
267 $(INSTALL_PROGRAM
) $(BCC_BSP
) $(tooldir
)/lib
${MULTISUBDIR}/$(BCC_BSP
)
268 $(INSTALL_DATA
) ${srcdir}/bcc.
ld $(tooldir
)/lib
${MULTISUBDIR}/bcc.
ld
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
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
286 # target specific makefile fragment comes in here.
287 @target_makefile_frag@
290 rm -f a.out core
*.i
*~
*.a
*.o
*-test *.srec
*.dis
*.x
*.map
292 distclean maintainer-clean
realclean: clean
293 rm -f Makefile config.cache config.log config.status
299 Makefile
: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@
300 $(SHELL
) config.status
302 config.status
: configure
303 $(SHELL
) config.status
--recheck