1#
2#
3
4VPATH = @srcdir@ @srcdir@/..
5srcdir = @srcdir@
6objdir = .
7srcroot = $(srcdir)/../..
8objroot = $(objdir)/../..
9
10prefix = @prefix@
11exec_prefix = @exec_prefix@
12
13host_alias = @host_alias@
14target_alias = @target_alias@
15
16bindir = @bindir@
17libdir = @libdir@
18tooldir = $(exec_prefix)/$(target_alias)
19
20INSTALL = @INSTALL@
21INSTALL_PROGRAM = @INSTALL_PROGRAM@
22INSTALL_DATA = @INSTALL_DATA@
23
24# Multilib support variables.
25# TOP is used instead of MULTI{BUILD,SRC}TOP.
26MULTIDIRS =
27MULTISUBDIR =
28
29SHELL =	/bin/sh
30
31CC = @CC@
32
33AS = @AS@
34AR = @AR@
35LD = @LD@
36RANLIB = @RANLIB@
37
38# Yuk.
39OBJCOPY = $(subst ranlib,objcopy,$(RANLIB))
40
41OBJS		= isatty.o
42CFLAGS		= -g -O2
43ASFLAGS		= --gdwarf2
44SCRIPTS		=
45CRT		= crt0.o crti.o crtn.o
46
47# Here is all of the simulator stuff
48SIM_SCRIPTS	= sim_high.ld sim_rom.ld
49SIM_LDFLAGS	=
50SIM_BSP		= libsim.a
51SIM_OBJS	= syscalls.o sim_malloc_start.o
52
53# Here is stuff for building apps for GDB on the EVA board
54EVA_APP_BSP     = libeva_app.a
55EVA_APP_OBJS    = close.o fstat.o getpid.o kill.o lseek.o open.o \
56                  stat.o unlink.o eva_app.o
57EVA_APP_SCRIPTS = eva_app.ld
58
59# Stub stuff
60EVA_STUB_HEX    = eva_stub.hex
61EVA_STUB        = eva_stub.elf
62EVA_STUB_OBJS   = xstormy16_stub.o crt0_stub.o
63
64# Host specific makefile fragment comes in here.
65@host_makefile_frag@
66
67#
68# build a test program for each target board. Just trying to get
69# it to link is a good test, so we ignore all the errors for now.
70#
71# all: ${MON_CRT0} ${MON_BSP}
72all: ${CRT} ${SIM_BSP} ${EVA_APP_BSP} ${EVA_STUB_HEX}
73
74#
75# here's where we build the board support packages for each target
76#
77${SIM_BSP}: ${OBJS} ${SIM_OBJS}
78	${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS}
79	${RANLIB} ${SIM_BSP}
80
81${EVA_APP_BSP}: ${OBJS} ${EVA_APP_OBJS}
82	${AR} ${ARFLAGS} ${EVA_APP_BSP} ${EVA_APP_OBJS} ${OBJS}
83	${RANLIB} ${EVA_APP_BSP}
84
85${EVA_STUB_HEX}: ${EVA_STUB}
86	${OBJCOPY} -O ihex $< $@
87
88${EVA_STUB}: ${EVA_STUB_OBJS} ${srcdir}/eva_stub.ld
89	${CC} -g -Os -nostartfiles -T${srcdir}/eva_stub.ld ${EVA_STUB_OBJS} -o $@
90
91
92#
93# here's where we build the test programs for each target
94#
95.PHONY: test
96test:
97	true
98
99#
100#
101#
102.c.S:
103	${CC} ${CFLAGS_FOR_TARGET} -c $<
104
105clean mostlyclean:
106	rm -f a.out core *.i *.o *-test *.srec *.dis *.x *.hex $(SIM_BSP) $(EVA_APP_BSP) $(EVA_STUB}
107
108distclean maintainer-clean realclean: clean
109	rm -f Makefile config.status *~
110
111.PHONY: install info install-info clean-info
112install:
113	set -e; for x in ${SIM_BSP} ${CRT} ${EVA_APP_BSP} ${EVA_STUB_HEX} ${EVA_STUB} ; do\
114	  ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; \
115	done
116	@for script in ${SCRIPTS} ${SIM_SCRIPTS} ${EVA_APP_SCRIPTS}; do\
117	  ${INSTALL_DATA} ${srcdir}/$${script} ${tooldir}/lib${MULTISUBDIR}/$${script}; \
118	done
119
120
121doc:
122info:
123install-info:
124clean-info:
125
126Makefile: Makefile.in config.status @host_makefile_frag_path@
127	$(SHELL) config.status
128
129config.status: configure
130	$(SHELL) config.status --recheck
131