1#	$NetBSD: Makefile,v 1.16 2008/10/19 22:05:21 apb Exp $
2
3#	MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
4#	M68000 Hi-Performance Microprocessor Division
5#	M68040 Software Package 
6#
7#	M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
8#	All rights reserved.
9#
10#	THE SOFTWARE is provided on an "AS IS" basis and without warranty.
11#	To the maximum extent permitted by applicable law,
12#	MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
13#	INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
14#	PARTICULAR PURPOSE and any warranty against infringement with
15#	regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
16#	and any accompanying written materials. 
17#
18#	To the maximum extent permitted by applicable law,
19#	IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
20#	(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
21#	PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
22#	OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
23#	SOFTWARE.  Motorola assumes no responsibility for the maintenance
24#	and support of the SOFTWARE.  
25#
26#	You are hereby granted a copyright license to use, modify, and
27#	distribute the SOFTWARE so long as this entire notice is retained
28#	without alteration in any modified and/or redistributed versions,
29#	and that such modified versions are clearly identified as such.
30#	No licenses are granted by implication, estoppel or otherwise
31#	under any patents or trademarks of Motorola, Inc.
32
33#
34#	Makefile 3.3 3/27/91
35#
36#	Makefile for 68040 Floating Point Software Package
37#
38
39.include <bsd.prog.mk>
40
41TARGET = fpsp
42
43CPPFLAGS=	${FPSPCPPFLAGS} ${FPSPMISCCPPFLAGS}
44.SUFFIXES:	.o .s .sa .defs .h
45
46.PATH.h: ${FPSPDIR}
47.PATH.s: ${FPSPDIR}
48.PATH.sa: ${FPSPDIR}
49
50AS?		= as
51LD?		= ld
52AFLAGS		= -x assembler-with-cpp -m68040
53
54#
55# For the Library Version:
56#
57AR?		= ar
58LIB_FILTER 	= ${TOOL_SED} 's/fpsp.defs/l_fpsp.defs/'
59LIB_TARGET	= lib$(TARGET).a
60#
61# SYS selects the template set to use
62#	templates are supplied for R3V6, CI5 and GEN(generic)
63# PREFIX is a string that begins a temporary label in the assembler
64#	R3V6 uses 'L%', CI5 likes '.L'
65#
66#SYS		= R3V6
67#PREFIX		= L%%
68#
69#SYS		= CI5
70#PREFIX		= .L
71#
72#SYS		= GEN
73#PREFIX		= L_
74#
75SYS		= GCC
76PREFIX		= L_
77
78.sa.s:
79	SED=${TOOL_SED:Q} ${HOST_SH} ${FPSPDIR}/asm2gas ${.IMPSRC} >${.TARGET}
80.h.defs:
81	SED=${TOOL_SED:Q} ${HOST_SH} ${FPSPDIR}/asm2gas ${.IMPSRC} >${.TARGET}
82.s.o:
83	${CC} ${AFLAGS} ${CPPFLAGS} -c -o ${.TARGET} ${.IMPSRC}
84
85H_FILES = \
86	fpsp.defs \
87	l_fpsp.defs
88
89O_FILES = \
90	copyright.o \
91	netbsd.o \
92	bindec.o \
93	binstr.o \
94	decbin.o \
95	do_func.o \
96	gen_except.o \
97	get_op.o \
98	kernel_ex.o \
99	res_func.o \
100	round.o \
101	sacos.o \
102	sasin.o \
103	satan.o \
104	satanh.o \
105	scosh.o \
106	setox.o \
107	sgetem.o \
108	sint.o \
109	slogn.o \
110	slog2.o \
111	smovecr.o \
112	srem_mod.o \
113	scale.o \
114	ssin.o \
115	ssinh.o \
116	stan.o \
117	stanh.o \
118	sto_res.o \
119	stwotox.o \
120	tbldo.o \
121	util.o \
122	x_bsun.o \
123	x_fline.o \
124	x_operr.o \
125	x_ovfl.o \
126	x_snan.o \
127	x_store.o \
128	x_unfl.o \
129	x_unimp.o \
130	x_unsupp.o \
131	bugfix.o
132
133LIB_O_FILES	= \
134	l_copyright.o \
135	l_entry.o \
136	l_do_func.o \
137	l_round.o \
138	l_sacos.o \
139	l_sasin.o \
140	l_satan.o \
141	l_satanh.o \
142	l_scale.o \
143	l_scosh.o \
144	l_setox.o \
145	l_sgetem.o \
146	l_sint.o \
147	l_slog2.o \
148	l_slogn.o \
149	l_srem_mod.o \
150	l_ssin.o \
151	l_ssinh.o \
152	l_stan.o \
153	l_stanh.o \
154	l_stwotox.o \
155	l_support.o
156
157S_FILES = \
158	netbsd.s \
159	bindec.s \
160	binstr.s \
161	decbin.s \
162	do_func.s \
163	get_op.s \
164	gen_except.s \
165	kernel_ex.s \
166	res_func.s \
167	round.s \
168	sacos.s \
169	sasin.s \
170	satan.s \
171	satanh.s \
172	scosh.s \
173	setox.s \
174	sgetem.s \
175	sint.s \
176	slogn.s \
177	slog2.s \
178	smovecr.s \
179	srem_mod.s \
180	scale.s \
181	ssin.s \
182	ssinh.s \
183	stan.s \
184	stanh.s \
185	sto_res.s \
186	stwotox.s \
187	tbldo.s \
188	util.s \
189	x_bsun.s \
190	x_fline.s \
191	x_operr.s \
192	x_ovfl.s \
193	x_snan.s \
194	x_store.s \
195	x_unfl.s \
196	x_unimp.s \
197	x_unsupp.s \
198	bugfix.s
199
200LIB_S_FILES	= \
201	l_entry.sa l_entry.s \
202	l_do_func.s \
203	l_round.s \
204	l_sacos.s \
205	l_sasin.s \
206	l_satan.s \
207	l_satanh.s \
208	l_scale.s \
209	l_scosh.s \
210	l_setox.s \
211	l_sgetem.s \
212	l_sint.s \
213	l_slog2.s \
214	l_slogn.s \
215	l_srem_mod.s \
216	l_ssin.s \
217	l_ssinh.s \
218	l_stan.s \
219	l_stanh.s \
220	l_stwotox.s \
221	l_support.s
222
223#
224#	Build the target object.  The linkfile is created on the fly.
225#	Change the SEG directives to suit your system.
226#
227$(TARGET).o:	$(O_FILES)
228	$(LD) -r -o $(TARGET).o $(O_FILES)
229
230#
231#	Just about every file needs fpsp.h so:
232#
233$(O_FILES):	fpsp.defs
234
235#
236#-----------------------------------------------------------------------
237#
238#	For making a library version of the FPSP:
239#
240library:	$(LIB_TARGET)
241
242$(LIB_TARGET):	$(LIB_O_FILES)
243	rm -f $(LIB_TARGET)
244	$(AR) crv $(LIB_TARGET) $(LIB_O_FILES)
245
246$(LIB_O_FILES): l_fpsp.defs
247
248#
249# The entry points to the library version are created here
250# by using two template files an awk script and a list of
251# the entry routines for each function.
252#
253l_entry.sa: L_ENTRY.AWK L_LIST MONADIC.$(SYS) DYADIC.$(SYS) l_fpsp.h
254	${TOOL_AWK} -f L_ENTRY.AWK SYS=$(SYS) PREFIX=$(PREFIX) - \
255	    <L_LIST | ${HOST_SH} >l_entry.sa
256
257#
258# Do_func.sa and round.sa need special editing to remove references that
259# aren't needed in the library version.  Beware that changes in
260# the source code may cause this editing to break....
261#
262l_do_func.s: do_func.s 
263	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
264	echo '/global.*do_func/,/^	rts/d' >.SCRIPT
265	echo 'g/smovcr/d' >>.SCRIPT
266	echo 'g/tblpre/d' >>.SCRIPT
267	echo 'w' >>.SCRIPT
268	echo 'q' >>.SCRIPT
269	ed - ${.TARGET} <.SCRIPT
270	rm .SCRIPT
271
272l_round.s: round.s 
273	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
274	echo '/^not_E3:/-6,/^not_E3:/d' >.SCRIPT
275	echo 'w' >>.SCRIPT
276	echo 'q' >>.SCRIPT
277	ed - ${.TARGET} <.SCRIPT
278	rm .SCRIPT
279
280l_copyright.s: copyright.s 
281	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
282
283l_sacos.s: sacos.s 
284	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
285
286l_sasin.s: sasin.s 
287	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
288
289l_satan.s: satan.s 
290	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
291
292l_satanh.s: satanh.s 
293	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
294
295l_scale.s: scale.s 
296	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
297
298l_scosh.s: scosh.s 
299	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
300
301l_setox.s: setox.s 
302	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
303
304l_sgetem.s: sgetem.s 
305	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
306
307l_sint.s: sint.s 
308	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
309
310l_slog2.s: slog2.s 
311	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
312
313l_slogn.s: slogn.s 
314	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
315
316l_srem_mod.s: srem_mod.s 
317	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
318
319l_ssin.s: ssin.s 
320	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
321
322l_ssinh.s: ssinh.s 
323	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
324
325l_stan.s: stan.s 
326	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
327
328l_stanh.s: stanh.s 
329	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
330
331l_stwotox.s: stwotox.s 
332	$(LIB_FILTER) ${.ALLSRC} >${.TARGET}
333
334#
335#	Extract all files from SCCS directory
336#
337clean:
338	rm -f $(H_FILES)
339	rm -f $(S_FILES)
340	rm -f $(O_FILES)
341	rm -f $(TARGET).o
342	rm -f $(LIB_S_FILES)
343	rm -f $(LIB_O_FILES)
344	rm -f $(LIB_TARGET)
345
346clobber:	clean
347