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