1 |
148 |
jeremybenn |
# Copyright (c) 1995, 1996, 1997 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 |
|
|
# Makefile for libgloss/sparc. This is the board support
|
14 |
|
|
# code for the various sparc targets.
|
15 |
|
|
|
16 |
|
|
DESTDIR =
|
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 |
|
|
|
29 |
|
|
bindir = @bindir@
|
30 |
|
|
libdir = @libdir@
|
31 |
|
|
tooldir = $(exec_prefix)/$(target_alias)
|
32 |
|
|
|
33 |
|
|
# Multilib support variables.
|
34 |
|
|
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
35 |
|
|
MULTIDIRS =
|
36 |
|
|
MULTISUBDIR =
|
37 |
|
|
MULTIDO = true
|
38 |
|
|
MULTICLEAN = true
|
39 |
|
|
|
40 |
|
|
INSTALL = @INSTALL@
|
41 |
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
42 |
|
|
INSTALL_DATA = @INSTALL_DATA@
|
43 |
|
|
|
44 |
|
|
SHELL = /bin/sh
|
45 |
|
|
|
46 |
|
|
CC = @CC@
|
47 |
|
|
|
48 |
|
|
AS = @AS@
|
49 |
|
|
AR = @AR@
|
50 |
|
|
LD = @LD@
|
51 |
|
|
RANLIB = @RANLIB@
|
52 |
|
|
AR_FLAGS = qrv
|
53 |
|
|
|
54 |
|
|
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
55 |
|
|
then echo ${objroot}/../binutils/objdump ; \
|
56 |
|
|
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
57 |
|
|
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
58 |
|
|
then echo ${objroot}/../binutils/objcopy ; \
|
59 |
|
|
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
60 |
|
|
|
61 |
|
|
CYGMON_CRT0 = cygmon-crt0.o
|
62 |
|
|
CYGMON_BSP = libcygmon.a
|
63 |
|
|
CYGMON_OBJS = cygmon-salib.o
|
64 |
|
|
|
65 |
|
|
701_CRT0 = crt0-701.o
|
66 |
|
|
701_BSP = libsplet701.a
|
67 |
|
|
701_OBJS = sysc-701.o salib-701.o sparclet-stub.o
|
68 |
|
|
|
69 |
|
|
930_BSP = libslite930.a
|
70 |
|
|
931_BSP = libslite931.a
|
71 |
|
|
934_BSP = libslite934.a
|
72 |
|
|
86X_BSP = libslite86x.a
|
73 |
|
|
|
74 |
|
|
# for the time being, built the stub without hardware breakpoint support
|
75 |
|
|
SLITE_OBJS = salib.o sparcl-stub.o cache.o
|
76 |
|
|
|
77 |
|
|
# ERC32: SIS simulator, see sim/erc32.
|
78 |
|
|
ERC32_CRT0 = erc32-crt0.o
|
79 |
|
|
ERC32_BSP = liberc32.a
|
80 |
|
|
ERC32_OBJS = erc32-io.o traps.o erc32-stub.o debug.o fixctors.o
|
81 |
|
|
ERC32_ALL = $(ERC32_CRT0) $(ERC32_BSP)
|
82 |
|
|
|
83 |
|
|
CRT0 = crt0.o
|
84 |
|
|
OBJS = close.o fstat.o getpid.o isatty.o kill.o \
|
85 |
|
|
lseek.o open.o print.o putnum.o read.o sbrk.o stat.o \
|
86 |
|
|
unlink.o write.o
|
87 |
|
|
|
88 |
|
|
# This is set to one of SPARC, SLITE, or SPLET by configure.
|
89 |
|
|
# It's not clear what to do here.
|
90 |
|
|
# One could certainly build everything. The assembler supports all cpu
|
91 |
|
|
# variants (via runtime switches). However, the compiler [currently] doesn't.
|
92 |
|
|
# Of course, it may be the case that there isn't any cpu specific code in
|
93 |
|
|
# C source files, but there might be in the future.
|
94 |
|
|
CPU = @CPU@
|
95 |
|
|
|
96 |
|
|
# sparc stuff (not sparclite or sparclet)
|
97 |
|
|
SPARC_ALL = $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld
|
98 |
|
|
SPARC_INSTALL = sparc-install
|
99 |
|
|
SPARC_OBJ_FORMAT = sparc
|
100 |
|
|
SPARC_RAM_START = 0x4000
|
101 |
|
|
|
102 |
|
|
# sparc 64 stuff
|
103 |
|
|
SPARC64_ALL = $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld
|
104 |
|
|
SPARC64_INSTALL = sparc-install
|
105 |
|
|
SPARC64_OBJ_FORMAT = sparc:v9
|
106 |
|
|
SPARC64_RAM_START = 0x4000
|
107 |
|
|
|
108 |
|
|
# sparclite stuff
|
109 |
|
|
SLITE_ALL = $(930_BSP) $(931_BSP) $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld $(934_BSP) $(86X_BSP)
|
110 |
|
|
SLITE_INSTALL = slite-install
|
111 |
|
|
SLITE_OBJ_FORMAT = sparc
|
112 |
|
|
SLITE_RAM_START = 0x40050000
|
113 |
|
|
|
114 |
|
|
# sparclet stuff
|
115 |
|
|
SPLET_ALL = $(701_CRT0) $(701_BSP)
|
116 |
|
|
SPLET_INSTALL = splet-install
|
117 |
|
|
|
118 |
|
|
#### Host specific Makefile fragment comes in here.
|
119 |
|
|
@host_makefile_frag@
|
120 |
|
|
|
121 |
|
|
all: ${CRT0} $($(CPU)_ALL) $(ERC32_ALL)
|
122 |
|
|
|
123 |
|
|
$(CYGMON_CRT0): cygmon-crt0.S
|
124 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -DTARGET_CPU_$(CPU) $(INCLUDES) -o $@ -c $(srcdir)/cygmon-crt0.S
|
125 |
|
|
|
126 |
|
|
$(CYGMON_BSP): $(CYGMON_OBJS)
|
127 |
|
|
@rm -f $@
|
128 |
|
|
${AR} ${AR_FLAGS} $@ $(CYGMON_OBJS)
|
129 |
|
|
${RANLIB} $@
|
130 |
|
|
|
131 |
|
|
#$(STUBLIBS): $(OBJS) $(SLITE_OBJS) $(CRT0)
|
132 |
|
|
# ${CC} -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(930_BSP)
|
133 |
|
|
# ${CC} -DSL931 -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(931_BSP)
|
134 |
|
|
# ${CC} -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(934_BSP)
|
135 |
|
|
|
136 |
|
|
$(CRT0): $(srcdir)/crt0.S $(srcdir)/asm.h $(srcdir)/slite.h
|
137 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $(srcdir)/crt0.S
|
138 |
|
|
|
139 |
|
|
$(930_BSP) $(931_BSP) $(934_BSP) $(86X_BSP): $(OBJS) $(SLITE_OBJS)
|
140 |
|
|
@rm -f $@
|
141 |
|
|
${AR} ${AR_FLAGS} $@ $(OBJS) $(SLITE_OBJS)
|
142 |
|
|
${RANLIB} $@
|
143 |
|
|
|
144 |
|
|
$(701_BSP): $(701_OBJS)
|
145 |
|
|
@rm -f $@
|
146 |
|
|
${AR} ${AR_FLAGS} $@ $(701_OBJS)
|
147 |
|
|
${RANLIB} $@
|
148 |
|
|
|
149 |
|
|
erc32-crt0.o: $(srcdir)/erc32-crt0.S $(srcdir)/asm.h $(srcdir)/slite.h
|
150 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $(srcdir)/erc32-crt0.S
|
151 |
|
|
|
152 |
|
|
liberc32.a: $(OBJS) $(ERC32_OBJS)
|
153 |
|
|
@rm -f $@
|
154 |
|
|
${AR} ${AR_FLAGS} $@ $(OBJS) $(ERC32_OBJS)
|
155 |
|
|
${RANLIB} $@
|
156 |
|
|
|
157 |
|
|
crt0-701.o: crt0-701.S
|
158 |
|
|
sysc-701.o: sysc-701.c
|
159 |
|
|
salib-701.o: salib-701.c
|
160 |
|
|
sparclet-stub.o: sparclet-stub.c
|
161 |
|
|
cygmon-salib.o: cygmon-salib.c
|
162 |
|
|
$(CC) -DTARGET_CPU_$(CPU) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $(srcdir)/cygmon-salib.c
|
163 |
|
|
cache.o: $(srcdir)/cache.c
|
164 |
|
|
salib.o: $(srcdir)/salib.c
|
165 |
|
|
win.o: $(srcdir)/win.S
|
166 |
|
|
syscalls.o: $(srcdir)/syscalls.c
|
167 |
|
|
sparcl-stub.o: $(srcdir)/sparcl-stub.c $(srcdir)/../debug.h $(srcdir)/../debug.c
|
168 |
|
|
erc32-stub.o: $(srcdir)/erc32-stub.c $(srcdir)/../debug.h $(srcdir)/../debug.c
|
169 |
|
|
fixctors.o : $(srcdir)/fixctors.c
|
170 |
|
|
|
171 |
|
|
$(objdir)/cygmon.ld: @CYGMONLDSCRIPTTEMPL@
|
172 |
|
|
sed 's/TARGET_OBJ_FORMAT/$($(CPU)_OBJ_FORMAT)/g;s/TARGET_RAM_START/$($(CPU)_RAM_START)/g;' < $(<) > $(objdir)/cygmon.ld
|
173 |
|
|
|
174 |
|
|
install: $($(CPU)_INSTALL)
|
175 |
|
|
$(INSTALL_DATA) $(CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CRT0)
|
176 |
|
|
|
177 |
|
|
sparc-install:
|
178 |
|
|
$(INSTALL_DATA) $(CYGMON_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
179 |
|
|
$(INSTALL_DATA) $(CYGMON_OBJS) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
180 |
|
|
$(INSTALL_DATA) $(objdir)/cygmon.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
181 |
|
|
$(INSTALL_DATA) $(CYGMON_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
182 |
|
|
|
183 |
|
|
slite-install:
|
184 |
|
|
$(INSTALL_DATA) $(930_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(930_BSP)
|
185 |
|
|
$(INSTALL_DATA) $(931_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(931_BSP)
|
186 |
|
|
$(INSTALL_DATA) $(934_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(934_BSP)
|
187 |
|
|
$(INSTALL_DATA) $(86X_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(86X_BSP)
|
188 |
|
|
$(INSTALL_DATA) $(srcdir)/ex930.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
189 |
|
|
$(INSTALL_DATA) $(srcdir)/ex931.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
190 |
|
|
$(INSTALL_DATA) $(srcdir)/ex934.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
191 |
|
|
$(INSTALL_DATA) $(srcdir)/sparc86x.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
192 |
|
|
$(INSTALL_DATA) $(srcdir)/elfsim.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
193 |
|
|
$(INSTALL_DATA) $(ERC32_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
194 |
|
|
$(INSTALL_DATA) $(ERC32_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
195 |
|
|
$(INSTALL_DATA) $(objdir)/traps.o $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
196 |
|
|
$(INSTALL_DATA) $(CYGMON_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
197 |
|
|
$(INSTALL_DATA) $(CYGMON_OBJS) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
198 |
|
|
$(INSTALL_DATA) $(objdir)/cygmon.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
199 |
|
|
$(INSTALL_DATA) $(CYGMON_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
200 |
|
|
|
201 |
|
|
splet-install:
|
202 |
|
|
$(INSTALL_DATA) $(701_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(701_CRT0)
|
203 |
|
|
$(INSTALL_DATA) $(701_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(701_BSP)
|
204 |
|
|
$(INSTALL_DATA) $(srcdir)/tsc701.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
|
205 |
|
|
|
206 |
|
|
# Make a simple test case to test the linker script, startup code, and
|
207 |
|
|
# I/O code
|
208 |
|
|
#
|
209 |
|
|
test: ex930-test.x ex931-test.x erc32-test.x
|
210 |
|
|
@echo Done...
|
211 |
|
|
|
212 |
|
|
# compile a fully linked binary. The -N option is for a.out, so the
|
213 |
|
|
# base address will be zero, rather than the default of 0x2020. The
|
214 |
|
|
# -Wl,-T*.ld is for the linker script. By using -Wl, the linker script
|
215 |
|
|
# is put on the proper place in the comand line for ld, and all the
|
216 |
|
|
# symbols will get fully resolved.
|
217 |
|
|
|
218 |
|
|
erc32-test.x: test.o ${ERC32_CRT0} ${srcdir}/erc32.ld Makefile ${ERC32_BSP}
|
219 |
|
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
220 |
|
|
-N -Wl,-Terc32.ld -Wl,-Map -Wl,erc32.map -nostdlib
|
221 |
|
|
erc32-test.srec: erc32-test.x
|
222 |
|
|
$(OBJCOPY) -O srec erc32-test.x $@
|
223 |
|
|
erc32-test.dis: erc32-test.x
|
224 |
|
|
@rm -fr erc32-test.dis
|
225 |
|
|
$(OBJDUMP) -d erc32-test.x > $@
|
226 |
|
|
erc32-test: erc32-test.srec erc32-test.dis
|
227 |
|
|
|
228 |
|
|
ex930-test.x: test.o ${CRT0} ${srcdir}/ex930.ld Makefile ${930_BSP}
|
229 |
|
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
230 |
|
|
-N -Wl,-Tex930.ld -nostdlib
|
231 |
|
|
ex930-test.srec: ex930-test.x
|
232 |
|
|
$(OBJCOPY) -O srec ex930-test.x $@
|
233 |
|
|
ex930-test.dis: ex930-test.x
|
234 |
|
|
@rm -fr ex930-test.dis
|
235 |
|
|
$(OBJDUMP) -d ex930-test.x > $@
|
236 |
|
|
ex930-test: ex930-test.srec ex930-test.dis
|
237 |
|
|
|
238 |
|
|
ex931-test.x: test.o ${CRT0} ${srcdir}/ex931.ld Makefile ${931_BSP}
|
239 |
|
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
240 |
|
|
-N -Wl,-Tex931.ld -nostdlib
|
241 |
|
|
ex931-test.srec: ex931-test.x
|
242 |
|
|
$(OBJCOPY) -O srec ex931-test.x $@
|
243 |
|
|
ex931-test.dis: ex931-test.x
|
244 |
|
|
@rm -fr ex931-test.dis
|
245 |
|
|
$(OBJDUMP) -d ex931-test.x > $@
|
246 |
|
|
ex931-test: ex931-test.srec ex931-test.dis
|
247 |
|
|
|
248 |
|
|
ex934-test.x: test.o ${CRT0} ${srcdir}/ex934.ld Makefile ${934_BSP}
|
249 |
|
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
250 |
|
|
-N -Wl,-Tex934.ld -nostdlib
|
251 |
|
|
ex934-test.srec: ex934-test.x
|
252 |
|
|
$(OBJCOPY) -O srec ex934-test.x $@
|
253 |
|
|
ex934-test.dis: ex934-test.x
|
254 |
|
|
@rm -fr ex934-test.dis
|
255 |
|
|
$(OBJDUMP) -d ex934-test.x > $@
|
256 |
|
|
ex934-test: ex934-test.srec ex934-test.dis
|
257 |
|
|
|
258 |
|
|
# a C++ test case
|
259 |
|
|
dtor.o: $(srcdir)/dtor.C
|
260 |
|
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $?
|
261 |
|
|
dtor.dis: dtor.x
|
262 |
|
|
@rm -fr dtor.dis
|
263 |
|
|
$(OBJDUMP) -d dtor.x > $@
|
264 |
|
|
dtor.x: dtor.o ${ERC32_CRT0} ${srcdir}/erc32.ld Makefile ${ERC32_BSP}
|
265 |
|
|
${CC} -L${srcdir} -L${objdir} dtor.o -o $@ $(LIBS_FOR_TARGET) \
|
266 |
|
|
-N -Wl,-Terc32.ld
|
267 |
|
|
|
268 |
|
|
# target specific makefile fragment comes in here.
|
269 |
|
|
@target_makefile_frag@
|
270 |
|
|
|
271 |
|
|
clean mostlyclean:
|
272 |
|
|
rm -f *.o *.a *.map *.x
|
273 |
|
|
|
274 |
|
|
distclean maintainer-clean realclean: clean
|
275 |
|
|
rm -f Makefile config.cache config.log config.status
|
276 |
|
|
|
277 |
|
|
.PHONY: info dvi doc install-info clean-info
|
278 |
|
|
info doc dvi:
|
279 |
|
|
install-info:
|
280 |
|
|
clean-info:
|
281 |
|
|
|
282 |
|
|
Makefile: Makefile.in config.status @host_makefile_frag_path@ \
|
283 |
|
|
@target_makefile_frag_path@
|
284 |
|
|
$(SHELL) config.status
|
285 |
|
|
|
286 |
|
|
config.status: configure
|
287 |
|
|
$(SHELL) config.status --recheck
|