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