1 |
207 |
jeremybenn |
#
|
2 |
|
|
# libgloss Makefile.in for CRIS. Copied and modified from mcore long ago.
|
3 |
|
|
#
|
4 |
|
|
|
5 |
|
|
DESTDIR =
|
6 |
|
|
VPATH = @srcdir@
|
7 |
|
|
srcdir = @srcdir@
|
8 |
|
|
objdir = .
|
9 |
|
|
srcroot = $(srcdir)/../..
|
10 |
|
|
objroot = $(objdir)/../..
|
11 |
|
|
|
12 |
|
|
prefix = @prefix@
|
13 |
|
|
exec_prefix = @exec_prefix@
|
14 |
|
|
|
15 |
|
|
host_alias = @host_alias@
|
16 |
|
|
target_alias = @target_alias@
|
17 |
|
|
|
18 |
|
|
bindir = @bindir@
|
19 |
|
|
libdir = @libdir@
|
20 |
|
|
tooldir = $(exec_prefix)/$(target_alias)
|
21 |
|
|
|
22 |
|
|
INSTALL = @INSTALL@
|
23 |
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
24 |
|
|
INSTALL_DATA = @INSTALL_DATA@
|
25 |
|
|
|
26 |
|
|
# Multilib support variables.
|
27 |
|
|
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
28 |
|
|
MULTIDIRS =
|
29 |
|
|
MULTISUBDIR =
|
30 |
|
|
|
31 |
|
|
SHELL = /bin/sh
|
32 |
|
|
|
33 |
|
|
CC = @CC@
|
34 |
|
|
|
35 |
|
|
AS = @AS@
|
36 |
|
|
AR = @AR@
|
37 |
|
|
LD = @LD@
|
38 |
|
|
RANLIB = @RANLIB@
|
39 |
|
|
|
40 |
|
|
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
41 |
|
|
then echo ${objroot}/../binutils/objdump ; \
|
42 |
|
|
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
43 |
|
|
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
44 |
|
|
then echo ${objroot}/../binutils/objcopy ; \
|
45 |
|
|
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
46 |
|
|
|
47 |
|
|
CFLAGS = -g
|
48 |
|
|
SCRIPTS =
|
49 |
|
|
|
50 |
|
|
OBJS = 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.
|
55 |
|
|
SYSCALL_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.
|
60 |
|
|
SIM_SCRIPTS =
|
61 |
|
|
SIM_LDFLAGS =
|
62 |
|
|
SIM_BSP = libsyssim.a
|
63 |
|
|
SIM_CRT0 = $(LIN_CRT0)
|
64 |
|
|
SIM_OBJS = $(LIN_OBJS)
|
65 |
|
|
SIM_TEST = sim-test
|
66 |
|
|
SIM_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.
|
71 |
|
|
LIN_PREFIX =
|
72 |
|
|
LIN_LDFLAGS =
|
73 |
|
|
LIN_BSP = libsyslinux.a
|
74 |
|
|
LIN_CRT0 = lcrt0.o
|
75 |
|
|
LIN_EXTRA = crti.o crtn.o crt1.o
|
76 |
|
|
LIN_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}
|
79 |
|
|
LIN_SCRIPTS =
|
80 |
|
|
LIN_TEST =
|
81 |
|
|
LIN_INSTALL = install-lin
|
82 |
|
|
|
83 |
|
|
# In (over)due time, here will be all stuff necessary for a development
|
84 |
|
|
# board.
|
85 |
|
|
BSP_PREFIX =
|
86 |
|
|
BSP_LDFLAGS =
|
87 |
|
|
BSP_BSP = libbsp.a
|
88 |
|
|
BSP_CRT0 = crt0.o
|
89 |
|
|
BSP_OBJS = ${OBJS} setup.o irqtable.o
|
90 |
|
|
BSP_SCRIPTS =
|
91 |
|
|
BSP_TEST =
|
92 |
|
|
BSP_INSTALL = install-bsp
|
93 |
|
|
|
94 |
|
|
ALL_INSTALL_FILES = \
|
95 |
|
|
${SIM_CRT0} ${SIM_EXTRA} ${SIM_BSP} \
|
96 |
|
|
${LIN_CRT0} ${LIN_EXTRA} ${LIN_BSP} \
|
97 |
|
|
${BSP_CRT0} ${BSP_EXTRA} ${BSP_BSP}
|
98 |
|
|
|
99 |
|
|
ALL_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.
|
106 |
|
|
INCLUDES += -I$(srcdir)
|
107 |
|
|
|
108 |
|
|
all: ${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.
|
129 |
|
|
libnosys.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
|
156 |
|
|
test: ${SIM_TEST} ${BSP_TEST}
|
157 |
|
|
|
158 |
|
|
sim-test: sim-test.x sim-test.dis
|
159 |
|
|
|
160 |
|
|
sim-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 |
|
|
|
165 |
|
|
sim-test.dis: sim-test.x
|
166 |
|
|
${OBJDUMP} -d sim-test.x > sim-test.dis
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
test.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.
|
178 |
|
|
crt0.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 |
|
|
|
191 |
|
|
crt1.o: lcrt0.o
|
192 |
|
|
cp -p $< $@
|
193 |
|
|
|
194 |
|
|
clean mostlyclean:
|
195 |
|
|
rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(BSP_BSP) $(LIN_BSP) libnosys.a
|
196 |
|
|
|
197 |
|
|
distclean maintainer-clean realclean: clean
|
198 |
|
|
rm -f Makefile config.status *~
|
199 |
|
|
|
200 |
|
|
.PHONY: install info install-info clean-info
|
201 |
|
|
install: ${SIM_INSTALL} ${BSP_INSTALL} ${LIN_INSTALL}
|
202 |
|
|
|
203 |
|
|
# Note that bsp and elinux objects are exclusive: do not overlap
|
204 |
|
|
# installed files.
|
205 |
|
|
install-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 |
|
|
|
214 |
|
|
install-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 |
|
|
|
220 |
|
|
install-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 ${tooldir}/lib${MULTISUBDIR}/$$x; \
|
232 |
|
|
done;; \
|
233 |
|
|
esac
|
234 |
|
|
|
235 |
|
|
doc:
|
236 |
|
|
info:
|
237 |
|
|
install-info:
|
238 |
|
|
clean-info:
|
239 |
|
|
|
240 |
|
|
Makefile: Makefile.in config.status @host_makefile_frag_path@
|
241 |
|
|
$(SHELL) config.status
|
242 |
|
|
|
243 |
|
|
config.status: configure
|
244 |
|
|
$(SHELL) config.status --recheck
|
245 |
|
|
|
246 |
|
|
$(SYSCALL_CFILES): syscalls.stamp
|
247 |
|
|
|
248 |
|
|
syscalls.stamp: gensyscalls
|
249 |
|
|
$(SHELL) $(srcdir)/gensyscalls
|
250 |
|
|
touch $@
|
251 |
|
|
|
252 |
|
|
# Dependencies that could and should be auto-generated.
|
253 |
|
|
close.o: close.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
254 |
|
|
execve.o: execve.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
255 |
|
|
exit.o: exit.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
256 |
|
|
fork.o: fork.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
257 |
|
|
fstat.o: fstat.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
258 |
|
|
fcntl.o: fcntl.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
259 |
|
|
getpid.o: getpid.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
260 |
|
|
gettod.o: gettod.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
261 |
|
|
isatty.o: isatty.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
262 |
|
|
kill.o: kill.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
263 |
|
|
link.o: link.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
264 |
|
|
lseek.o: lseek.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
265 |
|
|
open.o: open.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
266 |
|
|
read.o: read.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
267 |
|
|
rename.o: rename.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
268 |
|
|
sbrk.o: sbrk.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
269 |
|
|
stat.o: stat.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
270 |
|
|
times.o: times.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
271 |
|
|
unlink.o: unlink.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
272 |
|
|
wait.o: wait.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
273 |
|
|
write.o: write.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
274 |
|
|
lcrt0.o: lcrt0.c linunistd.h $(objdir)/../libnosys/config.h $(srcdir)/../libnosys/warning.h
|
275 |
|
|
setup.o: setup.S
|
276 |
|
|
irqtable.o: irqtable.S
|
277 |
|
|
crti.o: crti.c
|
278 |
|
|
crtn.o: crtn.c
|