1 # Copyright (c) 1995, 1996, 1997 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 # Makefile for libgloss/sparc. This is the board support
14 # code for the various sparc targets.
19 srcroot
= $(srcdir)/..
/..
20 objroot
= $(objdir
)/..
/..
23 exec_prefix = @
exec_prefix@
25 host_alias
= @host_alias@
26 target_alias
= @target_alias@
30 tooldir
= $(exec_prefix)/$(target_alias
)
32 # Multilib support variables.
33 # TOP is used instead of MULTI{BUILD,SRC}TOP.
40 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
41 INSTALL_DATA
= @INSTALL_DATA@
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`
60 CYGMON_CRT0
= cygmon-crt0.o
61 CYGMON_BSP
= libcygmon.a
62 CYGMON_OBJS
= cygmon-salib.o
65 701_BSP
= libsplet701.a
66 701_OBJS
= sysc-701.o salib-701.o sparclet-stub.o
68 930_BSP
= libslite930.a
69 931_BSP
= libslite931.a
70 934_BSP
= libslite934.a
71 86X_BSP
= libslite86x.a
73 # for the time being, built the stub without hardware breakpoint support
74 SLITE_OBJS
= salib.o sparcl-stub.o cache.o
76 # ERC32: SIS simulator, see sim/erc32.
77 ERC32_CRT0
= erc32-crt0.o
78 ERC32_BSP
= liberc32.a
79 ERC32_OBJS
= erc32-io.o traps.o erc32-stub.o debug.o fixctors.o
80 ERC32_ALL
= $(ERC32_CRT0
) $(ERC32_BSP
)
83 OBJS
= close.o fstat.o getpid.o isatty.o kill.o \
84 lseek.o open.o
print.o putnum.o read.o sbrk.o stat.o \
87 # This is set to one of SPARC, SLITE, or SPLET by configure.
88 # It's not clear what to do here.
89 # One could certainly build everything. The assembler supports all cpu
90 # variants (via runtime switches). However, the compiler [currently] doesn't.
91 # Of course, it may be the case that there isn't any cpu specific code in
92 # C source files, but there might be in the future.
95 # sparc stuff (not sparclite or sparclet)
96 SPARC_ALL
= $(CYGMON_BSP
) $(CYGMON_CRT0
) $(objdir
)/cygmon.
ld
97 SPARC_INSTALL
= sparc-install
98 SPARC_OBJ_FORMAT
= sparc
99 SPARC_RAM_START
= 0x4000
102 SPARC64_ALL
= $(CYGMON_BSP
) $(CYGMON_CRT0
) $(objdir
)/cygmon.
ld
103 SPARC64_INSTALL
= sparc-install
104 SPARC64_OBJ_FORMAT
= sparc
:v9
105 SPARC64_RAM_START
= 0x4000
108 SLITE_ALL
= $(930_BSP
) $(931_BSP
) $(CYGMON_BSP
) $(CYGMON_CRT0
) $(objdir
)/cygmon.
ld $(934_BSP
) $(86X_BSP
)
109 SLITE_INSTALL
= slite-install
110 SLITE_OBJ_FORMAT
= sparc
111 SLITE_RAM_START
= 0x40050000
114 SPLET_ALL
= $(701_CRT0
) $(701_BSP
)
115 SPLET_INSTALL
= splet-install
117 #### Host specific Makefile fragment comes in here.
120 all: ${CRT0} $($(CPU
)_ALL
) $(ERC32_ALL
)
122 $(CYGMON_CRT0
): cygmon-crt0.S
123 $(CC
) $(CFLAGS_FOR_TARGET
) $(CFLAGS
) -DTARGET_CPU_
$(CPU
) $(INCLUDES
) -o
$@
-c
$(srcdir)/cygmon-crt0.S
125 $(CYGMON_BSP
): $(CYGMON_OBJS
)
127 ${AR} ${AR_FLAGS} $@
$(CYGMON_OBJS
)
130 #$(STUBLIBS): $(OBJS) $(SLITE_OBJS) $(CRT0)
131 # ${CC} -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(930_BSP)
132 # ${CC} -DSL931 -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(931_BSP)
133 # ${CC} -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(934_BSP)
135 $(CRT0
): $(srcdir)/crt0.S
$(srcdir)/asm.h
$(srcdir)/slite.h
136 $(CC
) $(CFLAGS_FOR_TARGET
) $(CFLAGS
) $(INCLUDES
) -o
$@
-c
$(srcdir)/crt0.S
138 $(930_BSP
) $(931_BSP
) $(934_BSP
) $(86X_BSP
): $(OBJS
) $(SLITE_OBJS
)
140 ${AR} ${AR_FLAGS} $@
$(OBJS
) $(SLITE_OBJS
)
143 $(701_BSP
): $(701_OBJS
)
145 ${AR} ${AR_FLAGS} $@
$(701_OBJS
)
148 erc32-crt0.o
: $(srcdir)/erc32-crt0.S
$(srcdir)/asm.h
$(srcdir)/slite.h
149 $(CC
) $(CFLAGS_FOR_TARGET
) $(CFLAGS
) $(INCLUDES
) -o
$@
-c
$(srcdir)/erc32-crt0.S
151 liberc32.a
: $(OBJS
) $(ERC32_OBJS
)
153 ${AR} ${AR_FLAGS} $@
$(OBJS
) $(ERC32_OBJS
)
156 crt0-701.o
: crt0-701.S
157 sysc-701.o
: sysc-701.c
158 salib-701.o
: salib-701.c
159 sparclet-stub.o
: sparclet-stub.c
160 cygmon-salib.o
: cygmon-salib.c
161 $(CC
) -DTARGET_CPU_
$(CPU
) $(CFLAGS_FOR_TARGET
) $(CFLAGS
) $(INCLUDES
) -o
$@
-c
$(srcdir)/cygmon-salib.c
162 cache.o
: $(srcdir)/cache.c
163 salib.o
: $(srcdir)/salib.c
164 win.o
: $(srcdir)/win.S
165 syscalls.o
: $(srcdir)/syscalls.c
166 sparcl-stub.o
: $(srcdir)/sparcl-stub.c
$(srcdir)/..
/debug.h
$(srcdir)/..
/debug.c
167 erc32-stub.o
: $(srcdir)/erc32-stub.c
$(srcdir)/..
/debug.h
$(srcdir)/..
/debug.c
168 fixctors.o
: $(srcdir)/fixctors.c
170 $(objdir
)/cygmon.
ld: @CYGMONLDSCRIPTTEMPL@
171 sed
's/TARGET_OBJ_FORMAT/$($(CPU)_OBJ_FORMAT)/g;s/TARGET_RAM_START/$($(CPU)_RAM_START)/g;' < $(<) > $(objdir
)/cygmon.
ld
173 install: $($(CPU
)_INSTALL
)
174 $(INSTALL_DATA
) $(CRT0
) $(tooldir
)/lib
${MULTISUBDIR}/$(CRT0
)
177 $(INSTALL_DATA
) $(CYGMON_BSP
) $(tooldir
)/lib
${MULTISUBDIR}
178 $(INSTALL_DATA
) $(CYGMON_OBJS
) $(tooldir
)/lib
${MULTISUBDIR}
179 $(INSTALL_DATA
) $(objdir
)/cygmon.
ld $(tooldir
)/lib
${MULTISUBDIR}
180 $(INSTALL_DATA
) $(CYGMON_CRT0
) $(tooldir
)/lib
${MULTISUBDIR}
183 $(INSTALL_DATA
) $(930_BSP
) $(tooldir
)/lib
${MULTISUBDIR}/$(930_BSP
)
184 $(INSTALL_DATA
) $(931_BSP
) $(tooldir
)/lib
${MULTISUBDIR}/$(931_BSP
)
185 $(INSTALL_DATA
) $(934_BSP
) $(tooldir
)/lib
${MULTISUBDIR}/$(934_BSP
)
186 $(INSTALL_DATA
) $(86X_BSP
) $(tooldir
)/lib
${MULTISUBDIR}/$(86X_BSP
)
187 $(INSTALL_DATA
) $(srcdir)/ex930.
ld $(tooldir
)/lib
${MULTISUBDIR}
188 $(INSTALL_DATA
) $(srcdir)/ex931.
ld $(tooldir
)/lib
${MULTISUBDIR}
189 $(INSTALL_DATA
) $(srcdir)/ex934.
ld $(tooldir
)/lib
${MULTISUBDIR}
190 $(INSTALL_DATA
) $(srcdir)/sparc86x.
ld $(tooldir
)/lib
${MULTISUBDIR}
191 $(INSTALL_DATA
) $(srcdir)/elfsim.
ld $(tooldir
)/lib
${MULTISUBDIR}
192 $(INSTALL_DATA
) $(ERC32_CRT0
) $(tooldir
)/lib
${MULTISUBDIR}
193 $(INSTALL_DATA
) $(ERC32_BSP
) $(tooldir
)/lib
${MULTISUBDIR}
194 $(INSTALL_DATA
) $(objdir
)/traps.o
$(tooldir
)/lib
${MULTISUBDIR}
195 $(INSTALL_DATA
) $(CYGMON_BSP
) $(tooldir
)/lib
${MULTISUBDIR}
196 $(INSTALL_DATA
) $(CYGMON_OBJS
) $(tooldir
)/lib
${MULTISUBDIR}
197 $(INSTALL_DATA
) $(objdir
)/cygmon.
ld $(tooldir
)/lib
${MULTISUBDIR}
198 $(INSTALL_DATA
) $(CYGMON_CRT0
) $(tooldir
)/lib
${MULTISUBDIR}
201 $(INSTALL_DATA
) $(701_CRT0
) $(tooldir
)/lib
${MULTISUBDIR}/$(701_CRT0
)
202 $(INSTALL_DATA
) $(701_BSP
) $(tooldir
)/lib
${MULTISUBDIR}/$(701_BSP
)
203 $(INSTALL_DATA
) $(srcdir)/tsc701.
ld $(tooldir
)/lib
${MULTISUBDIR}
205 # Make a simple test case to test the linker script, startup code, and
208 test: ex930-test.x ex931-test.x erc32-test.x
211 # compile a fully linked binary. The -N option is for a.out, so the
212 # base address will be zero, rather than the default of 0x2020. The
213 # -Wl,-T*.ld is for the linker script. By using -Wl, the linker script
214 # is put on the proper place in the comand line for ld, and all the
215 # symbols will get fully resolved.
217 erc32-test.x
: test.o
${ERC32_CRT0} ${srcdir}/erc32.
ld Makefile
${ERC32_BSP}
218 ${CC} -L
${srcdir} -L
${objdir} test.o
-o
$@
$(LDFLAGS_FOR_TARGET
) \
219 -N
-Wl
,-Terc32.
ld -Wl
,-Map
-Wl
,erc32.map
-nostdlib
220 erc32-test.srec
: erc32-test.x
221 $(OBJCOPY
) -O srec erc32-test.x
$@
222 erc32-test.dis
: erc32-test.x
223 @
rm -fr erc32-test.dis
224 $(OBJDUMP
) -d erc32-test.x
> $@
225 erc32-test
: erc32-test.srec erc32-test.dis
227 ex930-test.x
: test.o
${CRT0} ${srcdir}/ex930.
ld Makefile
${930_BSP}
228 ${CC} -L
${srcdir} -L
${objdir} test.o
-o
$@
$(LDFLAGS_FOR_TARGET
) \
229 -N
-Wl
,-Tex930.
ld -nostdlib
230 ex930-test.srec
: ex930-test.x
231 $(OBJCOPY
) -O srec ex930-test.x
$@
232 ex930-test.dis
: ex930-test.x
233 @
rm -fr ex930-test.dis
234 $(OBJDUMP
) -d ex930-test.x
> $@
235 ex930-test
: ex930-test.srec ex930-test.dis
237 ex931-test.x
: test.o
${CRT0} ${srcdir}/ex931.
ld Makefile
${931_BSP}
238 ${CC} -L
${srcdir} -L
${objdir} test.o
-o
$@
$(LDFLAGS_FOR_TARGET
) \
239 -N
-Wl
,-Tex931.
ld -nostdlib
240 ex931-test.srec
: ex931-test.x
241 $(OBJCOPY
) -O srec ex931-test.x
$@
242 ex931-test.dis
: ex931-test.x
243 @
rm -fr ex931-test.dis
244 $(OBJDUMP
) -d ex931-test.x
> $@
245 ex931-test
: ex931-test.srec ex931-test.dis
247 ex934-test.x
: test.o
${CRT0} ${srcdir}/ex934.
ld Makefile
${934_BSP}
248 ${CC} -L
${srcdir} -L
${objdir} test.o
-o
$@
$(LDFLAGS_FOR_TARGET
) \
249 -N
-Wl
,-Tex934.
ld -nostdlib
250 ex934-test.srec
: ex934-test.x
251 $(OBJCOPY
) -O srec ex934-test.x
$@
252 ex934-test.dis
: ex934-test.x
253 @
rm -fr ex934-test.dis
254 $(OBJDUMP
) -d ex934-test.x
> $@
255 ex934-test
: ex934-test.srec ex934-test.dis
258 dtor.o
: $(srcdir)/dtor.C
259 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) -o
$@
-c
$?
262 $(OBJDUMP
) -d dtor.x
> $@
263 dtor.x
: dtor.o
${ERC32_CRT0} ${srcdir}/erc32.
ld Makefile
${ERC32_BSP}
264 ${CC} -L
${srcdir} -L
${objdir} dtor.o
-o
$@
$(LIBS_FOR_TARGET
) \
267 # target specific makefile fragment comes in here.
268 @target_makefile_frag@
271 rm -f
*.o
*.a
*.map
*.x
273 distclean maintainer-clean
realclean: clean
274 rm -f Makefile config.cache config.log config.status
276 .PHONY
: info dvi doc install-info clean-info
281 Makefile
: Makefile.in config.status @host_makefile_frag_path@ \
282 @target_makefile_frag_path@
283 $(SHELL
) config.status
285 config.status
: configure
286 $(SHELL
) config.status
--recheck