source: trunk/libs/newlib/src/libgloss/cris/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: 8.9 KB
Line 
1#
2# libgloss Makefile.in for CRIS.  Copied and modified from mcore long ago.
3#
4
5DESTDIR =
6VPATH = @srcdir@
7srcdir = @srcdir@
8objdir = .
9srcroot = $(srcdir)/../..
10objroot = $(objdir)/../..
11
12prefix = @prefix@
13exec_prefix = @exec_prefix@
14
15host_alias = @host_alias@
16target_alias = @target_alias@
17
18bindir = @bindir@
19libdir = @libdir@
20tooldir = $(exec_prefix)/$(target_alias)
21
22INSTALL = @INSTALL@
23INSTALL_PROGRAM = @INSTALL_PROGRAM@
24INSTALL_DATA = @INSTALL_DATA@
25
26# Multilib support variables.
27# TOP is used instead of MULTI{BUILD,SRC}TOP.
28MULTIDIRS =
29MULTISUBDIR =
30
31SHELL = /bin/sh
32
33CC = @CC@
34
35AS = @AS@
36AR = @AR@
37LD = @LD@
38RANLIB = @RANLIB@
39
40OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
41        then echo ${objroot}/../binutils/objdump ; \
42        else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
43OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
44        then echo ${objroot}/../binutils/objcopy ; \
45        else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
46
47CFLAGS          = -g
48SCRIPTS         =
49
50OBJS = outbyte.o
51
52# Beware: GNU make construct used (shell call).  Since GCC at the time
53# of this writing requires GNU make >= 3.79.1, this should pose no
54# problem.
55SYSCALL_CFILES := $(shell sed -ne 's/^cat > \([^ ]*\).*/\1/p' < $(srcdir)/gensyscalls)
56
57# Here is all of the simulator stuff.
58# Actually, now it's just the GNU/Linux stuff, as that's also the
59# simulator ABI.  The name of the library is different, though.
60SIM_SCRIPTS     =
61SIM_LDFLAGS     =
62SIM_BSP         = libsyssim.a
63SIM_CRT0        = $(LIN_CRT0)
64SIM_OBJS        = $(LIN_OBJS)
65SIM_TEST        = sim-test
66SIM_INSTALL     = install-sim
67
68# Here is all of the GNU/Linux stuff.  At present we don't build newlib
69# and libgloss for cris*-linux-gnu*, but it's nice to keep that as an
70# option.
71LIN_PREFIX      =
72LIN_LDFLAGS     =
73LIN_BSP         = libsyslinux.a
74LIN_CRT0        = lcrt0.o
75LIN_EXTRA       = crti.o crtn.o crt1.o
76LIN_OBJS        = close.o execve.o exit.o fcntl.o fork.o fstat.o getpid.o \
77 gettod.o isatty.o kill.o link.o lseek.o open.o read.o \
78 rename.o sbrk.o stat.o times.o unlink.o wait.o write.o ${OBJS}
79LIN_SCRIPTS     =
80LIN_TEST        =
81LIN_INSTALL     = install-lin
82
83# In (over)due time, here will be all stuff necessary for a development
84# board.
85BSP_PREFIX      =
86BSP_LDFLAGS     =
87BSP_BSP         = libbsp.a
88BSP_CRT0        = crt0.o
89BSP_OBJS        = ${OBJS} setup.o irqtable.o
90BSP_SCRIPTS     =
91BSP_TEST        =
92BSP_INSTALL     = install-bsp
93
94ALL_INSTALL_FILES = \
95 ${SIM_CRT0} ${SIM_EXTRA} ${SIM_BSP} \
96 ${LIN_CRT0} ${LIN_EXTRA} ${LIN_BSP} \
97 ${BSP_CRT0} ${BSP_EXTRA} ${BSP_BSP}
98
99ALL_INSTALL_FILES_NEWLIB_COPY = \
100 $(sort ${ALL_INSTALL_FILES:%=$(objroot)/newlib/%}) $(objroot)/newlib/libnosys.a
101
102# Host specific makefile fragment comes in here.
103@host_makefile_frag@
104
105# Need to augment the definition from host_makefile_frag above.
106INCLUDES += -I$(srcdir)
107
108all: ${ALL_INSTALL_FILES} ${ALL_INSTALL_FILES_NEWLIB_COPY} libnosys.a
109
110#
111# Here's where we build the board support packages for each target.
112#
113${SIM_BSP}: ${SIM_OBJS}
114        ${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS}
115        ${RANLIB} ${SIM_BSP}
116
117${BSP_BSP}: ${BSP_OBJS}
118        ${AR} ${ARFLAGS} ${BSP_BSP} ${BSP_OBJS}
119        ${RANLIB} ${BSP_BSP}
120
121${LIN_BSP}: ${LIN_OBJS}
122        ${AR} ${ARFLAGS} ${LIN_BSP} ${LIN_OBJS}
123        ${RANLIB} ${LIN_BSP}
124
125# We need a link to libnosys.a in this directory, since this is the
126# directory used when test-compiling for configuration for other parts and
127# when running the testsuite.  By using a symbolic link, it does not
128# matter whether libnosys.a is built yet when the rule is executed.
129libnosys.a:
130        ln -s ../libnosys/libnosys.a
131
132# Toplevel build rules for various other libraries have gcc -B options
133# applied so the newlib build directory is reached, but not the target
134# libgloss directory (whose name is unknown to the toplevel configury
135# anyway).  Configury tests that check for a successful link therefore
136# fail; they can't find crt0.o and non-libc.a+libm.a libraries.  We copy
137# over all files we would install to the neighboring newlib directory.
138# Only the default crt0.o and libraries are needed, but we do them all for
139# completeness.  They're however installed from here, not from the newlib
140# build directory.
141$(objroot)/newlib/%: %
142        cp -p $^ $@
143
144# This rule, being more specific, overrides the pattern rule above.
145$(objroot)/newlib/libnosys.a:
146        ln -s ../libgloss/libnosys/libnosys.a $(objroot)/newlib
147
148#
149# Build a test program for each target board. Just trying to get
150# it to link is a good test, so we ignore all the errors for now.
151#
152#
153# Here's where we build the test programs for each target.
154#
155.PHONY: test
156test:   ${SIM_TEST} ${BSP_TEST}
157
158sim-test:       sim-test.x sim-test.dis
159
160sim-test.x:     test.o ${SIM_CRT0} ${SIM_BSP}
161        ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \
162        ${SIM_CRT0} test.o \
163        -o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP}
164
165sim-test.dis:   sim-test.x
166        ${OBJDUMP} -d sim-test.x > sim-test.dis
167
168
169test.o: ${srcdir}/m68k/test.c
170
171# Debug usage.
172.c.S:
173        ${CC} ${CFLAGS_FOR_TARGET} $(INCLUDES) $(CFLAGS) -c $<
174
175# Caveat: for the -melinux multilib in cris-axis-aout, crt0.o is the
176# same as lcrt0.o, while elsewhere (other cris-axis-aout multilib and
177# cris-axis-elf) it's crt0.c compiled.
178crt0.o: lcrt0.o crt0.S
179        case "${MULTISUBDIR}" in \
180          */elinux) \
181           cp -p $< $@; st=$$?;; \
182          *) \
183           case "$?" in \
184            *crt0.S) \
185             $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c -xassembler-with-cpp $(srcdir)/crt0.S;; \
186            *) touch $@;; \
187            esac; \
188           st=$$?;; \
189        esac; exit $$st
190
191crt1.o: lcrt0.o
192        cp -p $< $@
193
194clean mostlyclean:
195        rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(BSP_BSP) $(LIN_BSP) libnosys.a
196
197distclean maintainer-clean realclean: clean
198        rm -f Makefile config.status *~
199
200.PHONY: install info install-info clean-info
201install: ${SIM_INSTALL} ${BSP_INSTALL} ${LIN_INSTALL}
202
203# Note that bsp and elinux objects are exclusive: do not overlap
204# installed files.
205install-bsp:
206        case "${MULTISUBDIR}" in \
207          */elinux) ;; \
208          *) set -e; \
209             for x in ${BSP_CRT0} ${BSP_BSP} ${BSP_SCRIPTS}; do \
210                ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
211             done;; \
212        esac
213
214install-sim:
215        set -e; \
216        for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do \
217          ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
218        done
219
220install-lin:
221        case "${MULTISUBDIR}" in \
222          */elinux) \
223            ${INSTALL_DATA} ${LIN_CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/crt0.o; \
224            set -e; \
225            for x in ${LIN_BSP} ${LIN_SCRIPTS}; do \
226              ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
227            done;; \
228          *) \
229            set -e; \
230            for x in ${LIN_BSP} ${LIN_SCRIPTS} ${LIN_EXTRA}; do \
231              ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; \
232            done;; \
233        esac
234
235doc:
236info:
237install-info:
238clean-info:
239
240Makefile: Makefile.in config.status @host_makefile_frag_path@
241        $(SHELL) config.status
242
243config.status: configure
244        $(SHELL) config.status --recheck
245
246$(SYSCALL_CFILES): syscalls.stamp
247
248syscalls.stamp: gensyscalls
249        $(SHELL) $(srcdir)/gensyscalls
250        touch $@
251
252# Dependencies that could and should be auto-generated.
253close.o: close.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
254execve.o: execve.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
255exit.o: exit.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
256fork.o: fork.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
257fstat.o: fstat.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
258fcntl.o: fcntl.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
259getpid.o: getpid.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
260gettod.o: gettod.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
261isatty.o: isatty.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
262kill.o: kill.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
263link.o: link.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
264lseek.o: lseek.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
265open.o: open.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
266read.o: read.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
267rename.o: rename.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
268sbrk.o: sbrk.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
269stat.o: stat.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
270times.o: times.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
271unlink.o: unlink.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
272wait.o: wait.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
273write.o: write.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
274lcrt0.o: lcrt0.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
275setup.o: setup.S
276irqtable.o: irqtable.S
277crti.o: crti.c
278crtn.o: crtn.c
Note: See TracBrowser for help on using the repository browser.