source: trunk/libs/newlib/src/libgloss/sparc/Makefile.in @ 514

Last change on this file since 514 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 9.7 KB
Line 
1# 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
16DESTDIR =
17VPATH = @srcdir@
18srcdir = @srcdir@
19objdir = .
20srcroot = $(srcdir)/../..
21objroot = $(objdir)/../..
22
23prefix = @prefix@
24exec_prefix = @exec_prefix@
25
26host_alias = @host_alias@
27target_alias = @target_alias@
28
29bindir = @bindir@
30libdir = @libdir@
31tooldir = $(exec_prefix)/$(target_alias)
32
33# Multilib support variables.
34# TOP is used instead of MULTI{BUILD,SRC}TOP.
35MULTIDIRS =
36MULTISUBDIR =
37MULTIDO = true
38MULTICLEAN = true
39
40INSTALL = @INSTALL@
41INSTALL_PROGRAM = @INSTALL_PROGRAM@
42INSTALL_DATA = @INSTALL_DATA@
43
44SHELL = /bin/sh
45
46CC = @CC@
47
48AS = @AS@
49AR = @AR@
50LD = @LD@
51RANLIB = @RANLIB@
52AR_FLAGS = qrv
53
54OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
55        then echo ${objroot}/../binutils/objdump ; \
56        else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
57OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
58        then echo ${objroot}/../binutils/objcopy ; \
59        else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
60
61CYGMON_CRT0 = cygmon-crt0.o
62CYGMON_BSP = libcygmon.a
63CYGMON_OBJS = cygmon-salib.o
64
65701_CRT0 = crt0-701.o
66701_BSP = libsplet701.a
67701_OBJS = sysc-701.o salib-701.o sparclet-stub.o
68
69930_BSP = libslite930.a
70931_BSP = libslite931.a
71934_BSP = libslite934.a
7286X_BSP = libslite86x.a
73
74# for the time being, built the stub without hardware breakpoint support
75SLITE_OBJS = salib.o sparcl-stub.o cache.o
76
77# ERC32: SIS simulator, see sim/erc32.
78ERC32_CRT0 = erc32-crt0.o
79ERC32_BSP = liberc32.a
80ERC32_OBJS = erc32-io.o traps.o erc32-stub.o debug.o fixctors.o
81ERC32_ALL = $(ERC32_CRT0) $(ERC32_BSP)
82
83CRT0 = crt0.o
84OBJS = 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.
94CPU = @CPU@
95
96# sparc stuff (not sparclite or sparclet)
97SPARC_ALL = $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld
98SPARC_INSTALL = sparc-install
99SPARC_OBJ_FORMAT = sparc
100SPARC_RAM_START = 0x4000
101
102# sparc 64 stuff
103SPARC64_ALL = $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld
104SPARC64_INSTALL = sparc-install
105SPARC64_OBJ_FORMAT = sparc:v9
106SPARC64_RAM_START = 0x4000
107
108# sparclite stuff
109SLITE_ALL = $(930_BSP) $(931_BSP) $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld $(934_BSP) $(86X_BSP)
110SLITE_INSTALL = slite-install
111SLITE_OBJ_FORMAT = sparc
112SLITE_RAM_START = 0x40050000
113
114# sparclet stuff
115SPLET_ALL = $(701_CRT0) $(701_BSP)
116SPLET_INSTALL = splet-install
117
118#### Host specific Makefile fragment comes in here.
119@host_makefile_frag@
120
121all: ${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
149erc32-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
152liberc32.a: $(OBJS) $(ERC32_OBJS)
153        @rm -f $@
154        ${AR} ${AR_FLAGS} $@ $(OBJS) $(ERC32_OBJS)
155        ${RANLIB} $@
156
157crt0-701.o: crt0-701.S
158sysc-701.o: sysc-701.c
159salib-701.o: salib-701.c
160sparclet-stub.o: sparclet-stub.c
161cygmon-salib.o: cygmon-salib.c
162        $(CC) -DTARGET_CPU_$(CPU) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $(srcdir)/cygmon-salib.c
163cache.o: $(srcdir)/cache.c
164salib.o: $(srcdir)/salib.c
165win.o: $(srcdir)/win.S
166syscalls.o: $(srcdir)/syscalls.c
167sparcl-stub.o: $(srcdir)/sparcl-stub.c $(srcdir)/../debug.h $(srcdir)/../debug.c
168erc32-stub.o: $(srcdir)/erc32-stub.c $(srcdir)/../debug.h $(srcdir)/../debug.c
169fixctors.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
174install: $($(CPU)_INSTALL)
175        $(INSTALL_DATA) $(CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CRT0)
176
177sparc-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
183slite-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
201splet-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#
209test: 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
218erc32-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
221erc32-test.srec: erc32-test.x
222        $(OBJCOPY) -O srec erc32-test.x $@
223erc32-test.dis: erc32-test.x
224        @rm -fr erc32-test.dis
225        $(OBJDUMP) -d erc32-test.x > $@
226erc32-test: erc32-test.srec erc32-test.dis
227
228ex930-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
231ex930-test.srec: ex930-test.x
232        $(OBJCOPY) -O srec ex930-test.x $@
233ex930-test.dis: ex930-test.x
234        @rm -fr ex930-test.dis
235        $(OBJDUMP) -d ex930-test.x > $@
236ex930-test: ex930-test.srec ex930-test.dis
237
238ex931-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
241ex931-test.srec: ex931-test.x
242        $(OBJCOPY) -O srec ex931-test.x $@
243ex931-test.dis: ex931-test.x
244        @rm -fr ex931-test.dis
245        $(OBJDUMP) -d ex931-test.x > $@
246ex931-test: ex931-test.srec ex931-test.dis
247
248ex934-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
251ex934-test.srec: ex934-test.x
252        $(OBJCOPY) -O srec ex934-test.x $@
253ex934-test.dis: ex934-test.x
254        @rm -fr ex934-test.dis
255        $(OBJDUMP) -d ex934-test.x > $@
256ex934-test: ex934-test.srec ex934-test.dis
257
258# a C++ test case
259dtor.o:  $(srcdir)/dtor.C
260        $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $?
261dtor.dis: dtor.x
262        @rm -fr dtor.dis
263        $(OBJDUMP) -d dtor.x > $@
264dtor.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
271clean mostlyclean:
272        rm -f *.o *.a *.map *.x
273
274distclean maintainer-clean realclean: clean
275        rm -f Makefile config.cache config.log config.status
276
277.PHONY: info dvi doc install-info clean-info
278info doc dvi:
279install-info:
280clean-info:
281
282Makefile: Makefile.in config.status @host_makefile_frag_path@ \
283        @target_makefile_frag_path@
284        $(SHELL) config.status
285
286config.status: configure
287        $(SHELL) config.status --recheck
Note: See TracBrowser for help on using the repository browser.