2 # libgloss Makefile.in for CRIS. Copied and modified from mcore long ago.
9 srcroot
= $(srcdir)/..
/..
10 objroot
= $(objdir
)/..
/..
13 exec_prefix = @
exec_prefix@
15 host_alias
= @host_alias@
16 target_alias
= @target_alias@
20 tooldir
= $(exec_prefix)/$(target_alias
)
23 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
24 INSTALL_DATA
= @INSTALL_DATA@
26 # Multilib support variables.
27 # TOP is used instead of MULTI{BUILD,SRC}TOP.
33 mkinstalldirs
= $(SHELL
) $(srcroot
)/mkinstalldirs
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`
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
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.
65 SIM_CRT0
= $(LIN_CRT0
)
66 SIM_OBJS
= $(LIN_OBJS
)
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
75 LIN_BSP
= libsyslinux.a
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}
83 LIN_INSTALL
= install-lin
85 # In (over)due time, here will be all stuff necessary for a development
91 BSP_OBJS
= ${OBJS} setup.o irqtable.o
94 BSP_INSTALL
= install-bsp
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.
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}
119 ${BSP_BSP}: ${BSP_OBJS}
120 ${AR} ${ARFLAGS} ${BSP_BSP} ${BSP_OBJS}
123 ${LIN_BSP}: ${LIN_OBJS}
124 ${AR} ${ARFLAGS} ${LIN_BSP} ${LIN_OBJS}
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.
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
143 $(objroot
)/newlib
/%: %
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.
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} \
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
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 \
183 cp
-p
$< $@
; st
=$$?
;; \
187 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) $(CFLAGS
) -c
-xassembler-with-cpp
$(srcdir)/crt0.S
;; \
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
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
208 ${mkinstalldirs} ${DESTDIR}${tooldir}/lib
${MULTISUBDIR}
209 case
"${MULTISUBDIR}" in \
212 for x in
${BSP_CRT0} ${BSP_BSP} ${BSP_SCRIPTS}; do \
213 ${INSTALL_DATA} $$x $(DESTDIR
)${tooldir}/lib
${MULTISUBDIR}/$$x; \
218 ${mkinstalldirs} ${DESTDIR}${tooldir}/lib
${MULTISUBDIR}
220 for x in
${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do \
221 ${INSTALL_DATA} $$x $(DESTDIR
)${tooldir}/lib
${MULTISUBDIR}/$$x; \
225 ${mkinstalldirs} ${DESTDIR}${tooldir}/lib
${MULTISUBDIR}
226 case
"${MULTISUBDIR}" in \
228 ${INSTALL_DATA} ${LIN_CRT0} $(DESTDIR
)${tooldir}/lib
${MULTISUBDIR}/crt0.o
; \
230 for x in
${LIN_BSP} ${LIN_SCRIPTS}; do \
231 ${INSTALL_DATA} $$x $(DESTDIR
)${tooldir}/lib
${MULTISUBDIR}/$$x; \
235 for x in
${LIN_BSP} ${LIN_SCRIPTS} ${LIN_EXTRA}; do \
236 ${INSTALL_DATA} $$x $(DESTDIR
)${tooldir}/lib
${MULTISUBDIR}/$$x; \
245 Makefile
: Makefile.in ..
/config.status
246 cd ..
&& $(SHELL
) config.status
248 $(SYSCALL_CFILES
): syscalls.stamp
250 syscalls.stamp
: gensyscalls
251 $(SHELL
) $(srcdir)/gensyscalls
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
278 irqtable.o
: irqtable.S