1 # Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 Cygnus Support
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
17 srcroot
= $(srcdir)/..
/..
18 objroot
= $(objdir
)/..
/..
21 exec_prefix = @
exec_prefix@
23 host_alias
= @host_alias@
24 target_alias
= @target_alias@
25 program_transform_name
= @program_transform_name@
29 tooldir
= $(exec_prefix)/$(target_alias
)
31 # Multilib support variables.
32 # TOP is used instead of MULTI{BUILD,SRC}TOP.
39 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
40 INSTALL_DATA
= @INSTALL_DATA@
47 AS
= `if [ -f ${objroot}/../gas/as.new ] ; \
48 then echo ${objroot}/../gas/as.new ; \
54 LD
= `if [ -f ${objroot}/../ld/ld.new ] ; \
55 then echo ${objroot}/../ld/ld.new ; \
60 OBJDUMP
= `if [ -f ${objroot}/../binutils/objdump ] ; \
61 then echo ${objroot}/../binutils/objdump ; \
62 else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
63 OBJCOPY
= `if [ -f ${objroot}/../binutils/objcopy ] ; \
64 then echo ${objroot}/../binutils/objcopy ; \
65 else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
69 GENOBJS
= syscalls.o fstat.o getpid.o isatty.o kill.o \
70 lseek.o
print.o putnum.o stat.o unlink.o
71 GENOBJS2
= open.o close.o read.o write.o
72 IDTOBJS
= idtmon.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS}
73 PMONOBJS
= pmon.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS}
74 LSIOBJS
= lsipmon.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS}
75 DVEOBJS
= dvemon.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS} ${GENOBJS2}
76 JMR3904OBJS
= jmr3904-io.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS} ${GENOBJS2}
77 CFEOBJS
= cfe.o cfe_api.o cfe_mem.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS} ${GENOBJS2}
78 CYGMONOBJS
= open.o close.o cygmon.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS}
80 # Nullmon cannot support read and write, but the test cases pull them in via libs
81 NULLMONOBJS
= nullmon.o @MIPS_PART_SPECIFIC_OBJ@
${GENOBJS}
85 GCC_LDFLAGS
= `if [ -d ${objroot}/../gcc ] ; \
86 then echo -L${objroot}/../gcc ; fi`
88 SCRIPTS
= @MIPS_SCRIPT_LIST@
91 PART_SPECIFIC_DEFINES
= @MIPS_PART_SPECIFIC_DEFINES@
93 # Host specific makefile fragment comes in here.
97 # build a test program for each target board. Just trying to get
98 # it to link is a good test, so we ignore all the errors for now.
101 all: ${CRT0} ${PCRT0} test.o
${BSP}
104 # here's where we build the board support packages for each target
106 mipsidt.o
: $(IDTOBJS
)
107 ${LD} -r
$(IDTOBJS
) -o
$@
109 mipspmon.o
: $(PMONOBJS
)
110 ${LD} -r
$(PMONOBJS
) -o
$@
112 mipslsi.o
: $(PMONOBJS
)
113 ${LD} -r
$(LSIOBJS
) -o
$@
116 ${AR} ${ARFLAGS} $@
$(IDTOBJS
)
119 libpmon.a
: $(PMONOBJS
)
120 ${AR} ${ARFLAGS} $@
$(PMONOBJS
)
124 ${AR} ${ARFLAGS} $@
$(LSIOBJS
)
128 ${AR} ${ARFLAGS} $@
$(DVEOBJS
)
131 libjmr3904.a
: $(JMR3904OBJS
)
132 ${AR} ${ARFLAGS} $@
$(JMR3904OBJS
)
135 libcygmon.a
: $(CYGMONOBJS
)
136 ${AR} ${ARFLAGS} $@
$(CYGMONOBJS
)
140 ${AR} ${ARFLAGS} $@
$(CFEOBJS
)
143 # nullmon.a , This is what you want if you want crt0 but NO mon services
144 # Supports GDB sim testing, board bringups, ICE operation.
145 libnullmon.a
: $(NULLMONOBJS
)
146 ${AR} ${ARFLAGS} $@
$(NULLMONOBJS
)
150 # compile a fully linked binary. The -Wl,-T*.ld is for the linker
151 # script. By using -Wl, the linker script is put on the proper place
152 # in the comand line for ld, and all the symbols will get fully
155 test: $(OBJS
) ${BSP} pmon-test idt-test cfe-test
158 dtor.o
: $(srcdir)/dtor.C
159 $(CC
) $(CFLAGS_FOR_TARGET
) $(INCLUDES
) -o
$@
-c
$<
160 dtor.x
: dtor.o
${CRT0} ${srcdir}/pmon.
ld Makefile libpmon.a
161 ${CC} $(CFLAGS_FOR_TARGET
) -L
${srcdir} -L
${objdir} \
162 dtor.o
-o
$@
$(NEWLIB_LDFLAGS
) -N
-Wl
,-Tpmon.
ld
164 pmon-test.x
: test.o
${CRT0} Makefile libpmon.a
165 ${CC} $(CFLAGS_FOR_TARGET
) -L
${srcdir} -L
${objdir} \
166 test.o
-o
$@
$(NEWLIB_LDFLAGS
) -Wl
,-Tpmon.
ld
167 pmon-test.srec
: pmon-test.x
168 $(OBJCOPY
) -O srec pmon-test.x
$@
169 pmon-test.dis
: pmon-test.x
170 @
rm -fr pmon-test.dis
171 $(OBJDUMP
) -d pmon-test.x
> $@
172 pmon-test
: pmon-test.srec pmon-test.dis
174 idt-test.x
: test.o
${CRT0} Makefile libidt.a
175 ${CC} $(CFLAGS_FOR_TARGET
) -L
${srcdir} -L
${objdir} \
176 test.o
-o
$@
$(NEWLIB_LDFLAGS
) -Wl
,-Tidt.
ld
177 idt-test.srec
: idt-test.x
178 $(OBJCOPY
) -O srec idt-test.x
$@
179 idt-test.dis
: idt-test.x
181 $(OBJDUMP
) -d idt-test.x
> $@
182 idt-test
: idt-test.srec idt-test.dis
184 cfe-test.x
: test.o
${CRT0} Makefile libcfe.a
185 ${CC} $(CFLAGS_FOR_TARGET
) -L
${srcdir} -L
${objdir} \
186 test.o
-o
$@
$(NEWLIB_LDFLAGS
) -Wl
,-Tcfe.
ld
187 cfe-test.srec
: cfe-test.x
188 $(OBJCOPY
) -O srec cfe-test.x
$@
189 cfe-test.dis
: cfe-test.x
191 $(OBJDUMP
) -d cfe-test.x
> $@
192 cfe-test
: cfe-test.srec cfe-test.dis
197 rm -f a.out core
*.i
*~
*.o
*-test *.srec
*.dis
*.map
*.x
199 distclean maintainer-clean
realclean: clean
200 rm -f Makefile config.status a.out
202 .PHONY
: install info install-info clean-info
204 mkdir
-p
$(DESTDIR
)$(tooldir
)/lib
${MULTISUBDIR}
205 @for file in
$(CRT0
) $(PCRT0
) $(BSP
); do \
206 $(INSTALL_DATA
) $${file} $(DESTDIR
)$(tooldir
)/lib
${MULTISUBDIR}/$${file}; \
208 @for script in
${SCRIPTS}; do\
209 $(INSTALL_DATA
) ${srcdir}/$${script}.
ld $(DESTDIR
)$(tooldir
)/lib
${MULTISUBDIR}/$${script}.
ld; \
216 test.o
: ${srcdir}/test.c
218 # these are for the BSPs
219 crt0.o
: ${srcdir}/crt0.S
220 pcrt0.o
: ${srcdir}/crt0.S
221 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) -DGCRT0
${srcdir}/crt0.S
-o
${PCRT0}
222 crt0_cfe.o
: ${srcdir}/crt0_cfe.S
223 crt0_cygmon.o
: ${srcdir}/crt0_cygmon.S
224 idtmon.o
: ${srcdir}/idtmon.S
225 pmon.o
: ${srcdir}/pmon.S
226 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) $(PART_SPECIFIC_DEFINES
) ${srcdir}/pmon.S
-o pmon.o
227 vr4300.o
: ${srcdir}/vr4300.S
228 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) ${srcdir}/vr4300.S
229 vr5xxx.o
: ${srcdir}/vr5xxx.S
230 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) ${srcdir}/vr5xxx.S
231 lsipmon.o
: $(srcdir)/lsipmon.S
$(srcdir)/pmon.S
232 jmr3904-io.o
: ${srcdir}/jmr3904-io.c
233 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) ${srcdir}/jmr3904-io.c
-o
$@
234 cfe.o
: ${srcdir}/cfe.c
${srcdir}/cfe_api.h
235 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) ${srcdir}/cfe.c
-o
$@
236 cfe_api.o
: ${srcdir}/cfe_api.c
${srcdir}/cfe_api.h
${srcdir}/cfe_api_int.h
237 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) ${srcdir}/cfe_api.c
-o
$@
238 cfe_mem.o
: ${srcdir}/cfe_mem.c
${srcdir}/cfe_api.h
239 $(CC
) -c
$(CFLAGS_FOR_TARGET
) $(CFLAGS
) ${srcdir}/cfe_mem.c
-o
$@
241 # cma101 can not be compiled mips16, if a mips16 version is needed then
242 # it will have to be built, then this rule can be scrapped, allowing
243 # the implicit rule to run.
244 cma101.o
: ${srcdir}/cma101.c
245 $(CC
) -c
$(CFLAGS_FOR_TARGET
) -O2
$(INCLUDES
) $(CFLAGS
) -mno-mips16
${srcdir}/cma101.c
247 # cygmon can not be compiled as mips16 since it uses the syscall instruction
248 cygmon.o
: ${srcdir}/cygmon.c
249 $(CC
) -c
$(CFLAGS_FOR_TARGET
) -O2
$(INCLUDES
) $(CFLAGS
) -mno-mips16
${srcdir}/cygmon.c
251 syscalls.o
: ${srcdir}/syscalls.c
253 # target specific makefile fragment comes in here.
254 @target_makefile_frag@
256 Makefile
: Makefile.in ..
/config.status
257 cd ..
&& $(SHELL
) config.status