1# The authors hereby grant permission to use, copy, modify, distribute,
2# and license this software and its documentation for any purpose, provided
3# that existing copyright notices are retained in all copies and that this
4# notice is included verbatim in any distributions. No written agreement,
5# license, or royalty fee is required for any of the authorized uses.
6# Modifications to this software may be copyrighted by their authors
7# and need not follow the licensing terms described here, provided that
8# the new terms are clearly indicated on the first page of each file where
9# they apply.
10#
11
12srcdir = @srcdir@
13objdir = .
14srcroot = $(srcdir)/../..
15objroot = $(objdir)/../..
16
17VPATH = $(srcdir) $(srcdir)/..
18
19prefix = @prefix@
20exec_prefix = @exec_prefix@
21
22host_alias = @host_alias@
23target_alias = @target_alias@
24program_transform_name = @program_transform_name@
25
26bindir = @bindir@
27libdir = @libdir@
28tooldir = $(exec_prefix)/$(target_alias)
29
30# Multilib support variables.
31# TOP is used instead of MULTI{BUILD,SRC}TOP.
32MULTIDIRS =
33MULTISUBDIR =
34MULTIDO = true
35MULTICLEAN = true
36
37INSTALL = @INSTALL@
38INSTALL_PROGRAM = @INSTALL_PROGRAM@
39INSTALL_DATA = @INSTALL_DATA@
40
41SHELL =	/bin/sh
42
43CC = @CC@
44
45AS = @AS@
46AR = @AR@
47LD = @LD@
48RANLIB = @RANLIB@
49AR_FLAGS = qv
50
51OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
52	then echo ${objroot}/../binutils/objdump ; \
53	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
54OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
55	then echo ${objroot}/../binutils/objcopy ; \
56	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
57
58SCRIPTS =
59
60OBJS =    getpid.o kill.o print.o sbrk.o syscalls.o time.o fork.o sleep.o
61
62CFLAGS_FOR_TARGET = -fomit-frame-pointer -Os
63
64CFLAGS = -fomit-frame-pointer -Os
65
66CRT0 = crt0.o
67
68IO = crt_io.o
69
70
71
72
73
74
75#
76# here's all the generic target stuff
77#
78GEN_LDFLAGS=	-L${srcdir}
79BSP=	libbcc.a
80
81# Host specific makefile fragment comes in here.
82@host_makefile_frag@
83
84#
85# build a test program for each target board. Just trying to get
86# it to link is a good test, so we ignore all the errors for now.
87#
88all: ${CRT0} ${IO} ${BSP}
89
90#
91# here's where we build the board support packages for each target
92#
93${BSP}: $(OBJS)
94	${AR} ${ARFLAGS} $@ $(OBJS)
95	${RANLIB} $@
96
97
98
99
100
101.PHONY: install info dvi doc install-info clean-info
102
103clean mostlyclean:
104	rm -f a.out core *.[oais] *-test *.srec *.dis *.x syscall.h
105
106distclean maintainer-clean realclean: clean
107	rm -f Makefile config.status *~
108
109.PHONY: install info install-info clean-info
110install:	install-scripts
111	$(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
112	$(INSTALL_PROGRAM) $(IO) $(tooldir)/lib${MULTISUBDIR}/$(IO)
113	@for bsp in ${BSP}; do\
114	 $(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \
115	done
116
117# Install the linker script in the correct place.
118install-scripts:
119	if [ -f ${objroot}/../binutils/objdump ] ; then \
120	   objdump="${objroot}/../binutils/objdump"; \
121	else \
122	   t='$(program_transform_name)'; \
123	   objdump=`echo objdump | sed -e $$t`; \
124	fi ; \
125	name=`$$objdump -f $(CRT0) | sed '/^$$/d'`;
126	name=`$$objdump -f $(IO) | sed '/^$$/d'`;
127
128doc:
129info:
130install-info:
131clean-info:
132
133Makefile: Makefile.in config.status @host_makefile_frag_path@
134	$(SHELL) config.status
135
136config.status: configure
137	$(SHELL) config.status --recheck
138
139.c.o:
140	$(CC) $(CFLAGS_FOR_TARGET)  $(INCLUDES) -c $(CFLAGS) -fomit-frame-pointer -ffunction-sections -fdata-sections $<
141
142