Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile.in « m68k « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ad3f69fdf6930e8efd47a9d8c155915baf28e4da (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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# Copyright (c) 1995, 1996, 2001 Cygnus Support
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided
# that existing copyright notices are retained in all copies and that this
# notice is included verbatim in any distributions. No written agreement,
# license, or royalty fee is required for any of the authorized uses.
# Modifications to this software may be copyrighted by their authors
# and need not follow the licensing terms described here, provided that
# the new terms are clearly indicated on the first page of each file where
# they apply.
#
# This currently works with Motorola's MVME135 and IDP m68k based
# target boards.
#

DESTDIR =
VPATH = @srcdir@
srcdir = @srcdir@
objdir = .
srcroot = $(srcdir)/../..
objroot = $(objdir)/../..

prefix = @prefix@
exec_prefix = @exec_prefix@

host_alias = @host_alias@
target_alias = @target_alias@
program_transform_name = @program_transform_name@

bindir = @bindir@
libdir = @libdir@
tooldir = $(exec_prefix)/$(target_alias)

# Multilib support variables.
# TOP is used instead of MULTI{BUILD,SRC}TOP.
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

SHELL =	/bin/sh

CC = @CC@

AS = @AS@
AR = @AR@
LD = @LD@
RANLIB = @RANLIB@
AR_FLAGS = qv

OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
	then echo ${objroot}/../binutils/objdump ; \
	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
	then echo ${objroot}/../binutils/objcopy ; \
	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`

SCRIPTS = mvme162 mvme135 idp bcc

OBJS =  close.o fstat.o getpid.o isatty.o kill.o \
	lseek.o open.o print.o putnum.o read.o sbrk.o stat.o \
	unlink.o write.o

CFLAGS = -g
# ARFLAGS = rv


# Here is all of the simulator stuff
SIM_SCRIPTS	= sim.ld
SIM_LDFLAGS	= -Tsim.ld
SIM_BSP		= libsim.a
SIM_CRT0	= sim-crt0.o
SIM_OBJS	= sim-print.o sim-inbyte.o sim-sbrk.o sim-abort.o sim-errno.o simulator.o sim-funcs.o unlink.o
SIM_TEST	= 
SIM_INSTALL	= install-sim


CRT0 = crt0.o
#
# here's all the MVME135 target stuff
#
MVME_LDFLAGS=	-L${srcdir} -Tmvme135.ld
MVME135_BSP=	libmvme135.a
MVME162_BSP=	libmvme162.a
#MVME135_OBJS=	mvme.o
#MVME162_OBJS=	mvme.o
# Uncomment the last two objects if you want to use the GDB stub. 
# The stub is included "as is", and will likely take some hacking
# to work on your system.
MVME135_OBJS=	cpu32bug.o # mvme-stub.o mvme135-asm.o
MVME162_OBJS=	cpu32bug.o # mvme-stub.o mvme162lx-asm.o


#
# here's all the BCC target stuff
#
BCC_LDFLAGS=	-L${srcdir} -Tbcc.ld
BCC_BSP=	libbcc.a
BCC_OBJS=	cpu32bug.o

#
# here's all the IDP target stuff
#
IDP_LDFLAGS=	-L${srcdir} -Tidp.ld
IDP_BSP=	libidp.a
IDP_OBJS=	leds.o idp-inbyte.o idp-outbyte.o mc68ec.o

#
# here's all the IDP GDB target stuff
#
IDPGDB_LDFLAGS=	-L${srcdir} -Tidpgdb.ld
IDPGDB_BSP=	libidpgdb.a
IDPGDB_OBJS=	leds.o idp-inbyte.o idp-gdb-outbyte.o mc68ec.o

#
# here's all the BDM semihosting stuff
#
BDM_CRT0=	bdm-crt0.o
BDM_BSP=	libbdm.a
BDM_OBJS=	bdm-crt1.o bdm-semihost.o $(BDM_SYSOBJS) \
		$(patsubst %,bdm-%.o,${BDM_ISRS})
BDM_OTHER_OBJS=	getpid.o kill.o sbrk.o
BDM_SYSOBJS= 	bdm-close.o bdm-exit.o bdm-fstat.o bdm-gdb.o \
		bdm-gettimeofday.o bdm-isatty.o bdm-lseek.o \
		bdm-open.o bdm-read.o bdm-rename.o \
		bdm-stat.o bdm-system.o bdm-time.o bdm-unlink.o bdm-write.o
BDM_ISRS=	other_interrupt reset access_error address_error \
	illegal_instruction divide_by_zero privilege_violation \
	trace unimplemented_line_a_opcode unimplemented_line_f_opcode \
	non_pc_breakpoint_debug_interrupt pc_breakpoint_debug_interrupt \
	format_error spurious_interrupt trap0 trap1 trap2 trap3 trap4 \
	trap5 trap6 trap7 trap8 trap9 trap10 trap11 trap12 trap13 trap14 \
	trap15 fp_branch_unordered fp_inexact_result fp_divide_by_zero \
	fp_underflow fp_operand_error fp_overflow fp_input_not_a_number \
	fp_input_denormalized_number unsupported_instruction

CF_BOARDS :=  m5208evb m5213evb m52235evb m5235evb m5272c3 m5282evb \
	m5329evb m5485evb
CF_RAM_SCRIPTS := $(patsubst %,%-ram.ld,$(CF_BOARDS))
CF_ROM_SCRIPTS := $(patsubst %,%-rom.ld,$(CF_BOARDS))
CF_SCRIPTS=  $(CF_RAM_SCRIPTS) $(CF_ROM_SCRIPTS)

# Host specific makefile fragment comes in here.
@host_makefile_frag@

#
# build a test program for each target board. Just trying to get
# it to link is a good test, so we ignore all the errors for now.
#
all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} \
	${MVME135_BSP} ${MVME162_BSP} ${BDM_CRT0} ${BDM_BSP} ${CF_SCRIPTS}

#
# here's where we build the board support packages for each target
#
${SIM_BSP}: ${SIM_OBJS}
	${AR} ${ARFLAGS} $@ ${SIM_OBJS}
	${RANLIB} $@

${BCC_BSP}: $(OBJS) ${BCC_OBJS}
	${AR} ${ARFLAGS} $@ $(OBJS) ${BCC_OBJS}
	${RANLIB} $@

${IDP_BSP}: $(OBJS) ${IDP_OBJS}
	${AR} ${ARFLAGS} $@ $(OBJS) ${IDP_OBJS}
	${RANLIB} $@

${IDPGDB_BSP}: $(OBJS) ${IDPGDB_OBJS}
	${AR} ${ARFLAGS} $@ $(OBJS) ${IDPGDB_OBJS}
	${RANLIB} $@

${BDM_BSP}: $(BDM_OTHER_OBJS) ${BDM_OBJS}
	${AR} ${ARFLAGS} $@ $(BDM_OTHER_OBJS) ${BDM_OBJS}
	${RANLIB} $@

${MVME135_BSP}: $(OBJS) ${MVME135_OBJS}
	${AR} ${ARFLAGS} $@ $(OBJS) ${MVME135_OBJS}
	${RANLIB} $@

${MVME162_BSP}: $(OBJS) ${MVME162_OBJS}
	${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS}
	${RANLIB} $@

$(BDM_SYSOBJS): %.o: %.c bdm-semihost.h bdm-gdb.h
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ 
bdm-crt0.o : bdm-crt0.S
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
bdm-crt1.o : bdm-crt1.c
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
#We need to omit the frame pointer to ensure there is no prologue.
bdm-semihost.o : bdm-semihost.c
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ -fomit-frame-pointer

# We need to keep the frame pointer to make sure there's some
# prologue.  Otherwise we get confused with the semihosting reoutine.
$(patsubst %,bdm-%.o,${BDM_ISRS}) : bdm-isrs.c
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ \
	  -DL_$(patsubst bdm-%.o,%,$@) -fno-omit-frame-pointer

#            RAM       ROM
m5208evb  := 1024M 16M 0M 2M
m5213evb  :=  512M 32K 0M 256K
m52235evb :=  512M 32K 0M 256K
m5235evb  :=    0M 16M 0xFFE00000 2M
m5273c3   :=    0M  4M 0xFFE00000 2M
m5282evb  :=    0M 16M 0xFFE00000 2M
m5329evb  := 1024M 32M 0M 2M
m5485evb  :=    0M 64M 1024M 16M

%-ram.ld : cf.sc Makefile
	RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) ${SHELL} $< >$@
%-rom.ld : cf.sc Makefile
	RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
	  ROM=$(word 3,$($*)) ROM_SIZE=$(word 4,$($*)) ${SHELL} $< >$@

leds.o: ${srcdir}/leds.c
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<

idp-inbyte.o: ${srcdir}/idp-inbyte.c
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<

idp-outbyte.o: ${srcdir}/idp-outbyte.c
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<

idp-gdb-outbyte.o: ${srcdir}/idp-outbyte.c
	$(CC) $(CFLAGS_FOR_TARGET) -DGDB_MONITOR_OUTPUT $(INCLUDES) -c $< -o $@

mc68ec.o: ${srcdir}/mc68ec.c
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<

test.o: ${srcdir}/test.c

#
# Make a simple test case to test the linker script, startup code, and
# I/O code
#
test: $(OBJS) idp-test.srec mvme135-test.srec bcc-test.srec \
	idp-test.dis mvme135-test.dis bcc-test.dis
	@echo Done...

# compile a fully linked binary. The -N option is for a.out, so the
# base address will be zero, rather than the default of 0x2020. The
# -Wl,-T*.ld is for the linker script. By using -Wl, the linker script
# is put on the proper place in the comand line for ld, and all the
# symbols will get fully resolved.

idp-test.x: test.o ${CRT0} Makefile ${IDP_BSP}
	${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
	test.o -o $@ $(LDFLAGS_FOR_TARGET) -N -Wl,-Tidp.ld
idp-test.srec: idp-test.x
	$(OBJCOPY) -O srec idp-test.x $@
idp-test.dis: idp-test.x
	@rm -fr idp-test.dis
	$(OBJDUMP) -d idp-test.x > $@
idp-test: idp-test.srec idp-test.dis

idpgdb-test.x: test.o ${CRT0} Makefile ${IDPGDB_BSP}
	${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
	test.o -o $@ $(LDFLAGS_FOR_TARGET) -N -Wl,-Tidpgdb.ld
idpgdb-test.srec: idpgdb-test.x
	$(OBJCOPY) -O srec idpgdb-test.x $@
idpgdb-test.dis: idpgdb-test.x
	@rm -fr idpgdb-test.dis
	$(OBJDUMP) -d idpgdb-test.x > $@
idpgdb-test: idpgdb-test.srec idpgdb-test.dis

mvme135-test.x: test.o ${CRT0} ${srcdir}/mvme135.ld Makefile  ${MVME135_BSP}
	${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
	-N -Wl,-Tmvme135.ld -nostdlib
mvme135-test.srec: mvme135-test.x
	$(OBJCOPY) -O srec mvme135-test.x $@
mvme135-test.dis: mvme135-test.x
	@rm -fr mvme135-test.dis
	$(OBJDUMP) -d mvme135-test.x > $@
mvme135-test: mvme135-test.srec mvme135-test.dis

mvme162-test.x: test.o ${CRT0} ${srcdir}/mvme162.ld Makefile  ${MVME162_BSP}
	${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
	-N -Wl,-Tmvme162.ld -nostdlib
mvme162-test.srec: mvme162-test.x
	$(OBJCOPY) -O srec mvme162-test.x $@
mvme162-test.dis: mvme162-test.x
	@rm -fr mvme162-test.dis
	$(OBJDUMP) -d mvme162-test.x > $@
mvme162-test: mvme162-test.srec mvme162-test.dis

bcc-test.x: test.o ${CRT0} ${srcdir}/bcc.ld Makefile  ${BCC_BSP}
	${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
	-N -Wl,-Tbcc.ld -nostdlib
bcc-test.srec: bcc-test.x
	$(OBJCOPY) -O srec bcc-test.x $@
bcc-test.dis: bcc-test.x
	@rm -fr bcc-test.dis
	$(OBJDUMP) -d bcc-test.x > $@
bcc-test: bcc-test.srec bcc-test.dis

# a C++ test case
dtor.o:  $(srcdir)/dtor.C
	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $<
dtor.dis: dtor.x
	@rm -fr dtor.dis
	$(OBJDUMP) -d dtor.x > $@
dtor.x: dtor.o ${CRT0} ${srcdir}/mvme135.ld Makefile  ${MVME135_BSP}
	${CC} -L${srcdir} -L${objdir} dtor.o -o $@ $(LIBS_FOR_TARGET) \
	-N -Wl,-Tmvme135.ld -nostdlib

unlink.o: $(srcdir)/../unlink.c

.PHONY: install info dvi doc install-info clean-info
install:
	# install SIM stuff
	$(INSTALL_PROGRAM) $(SIM_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(SIM_CRT0)
	$(INSTALL_PROGRAM) $(SIM_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(SIM_BSP)
	$(INSTALL_DATA) ${srcdir}/sim.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sim.ld
	#
	$(INSTALL_PROGRAM) $(CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CRT0)
	# install BCC stuff
	$(INSTALL_PROGRAM) $(BCC_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BCC_BSP)
	$(INSTALL_DATA) ${srcdir}/bcc.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/bcc.ld
	# install IDP stuff
	$(INSTALL_PROGRAM) $(IDP_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(IDP_BSP)
	$(INSTALL_DATA) ${srcdir}/idp.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/idp.ld
	# install IDPGDB stuff
	$(INSTALL_PROGRAM) $(IDPGDB_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(IDPGDB_BSP)
	$(INSTALL_DATA) ${srcdir}/idpgdb.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/idpgdb.ld
	# install MVME135 stuff
	$(INSTALL_PROGRAM) $(MVME135_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(MVME135_BSP)
	$(INSTALL_DATA) ${srcdir}/mvme135.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/mvme135.ld
	# install MVME162lx stuff
	$(INSTALL_PROGRAM) $(MVME162_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(MVME162_BSP)
	$(INSTALL_DATA) ${srcdir}/mvme162.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/mvme162.ld
	# install BDM stuff
	$(INSTALL_PROGRAM) $(BDM_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_CRT0)
	$(INSTALL_PROGRAM) $(BDM_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_BSP)

	$(INSTALL_DATA) ${srcdir}/sbc5204.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
	$(INSTALL_DATA) ${srcdir}/sbc5206.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5206.ld
	for script in $(CF_SCRIPTS) ; \
	do $(INSTALL_DATA) $$script $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$script ; \
	done

# target specific makefile fragment comes in here.
@target_makefile_frag@

clean mostlyclean:
	rm -f a.out core *.i *~ *.a *.o *-test *.srec *.dis *.x *.map

distclean maintainer-clean realclean: clean
	rm -f Makefile config.cache config.log config.status

info dvi doc:
install-info:
clean-info:

Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@
	$(SHELL) config.status

config.status: configure
	$(SHELL) config.status --recheck