#	@(#)Makefile	5.4 (Berkeley) 6/23/90
#

LIB=	fp
CFLAGS=	-w -O

CFLAGS+=-I${.CURDIR}/emulfp -I${.CURDIR}/genfp
.PATH:	${.CURDIR}/emulfp ${.CURDIR}/genfp

CFILES=	xxFPkill.s xxFPgetpid.s xFPE_bscalb.c
CFILES+=fpgen.c fpops.c general.c fpa1gen.c f881gen.c emulgen.c fpa2gen.c

# the following binaries are the only ones that should be cleaned
#
COBJS=	${CFILES:S/.c$/.o/g:S/.f$/.o/g:S/.s$/.o/g}
CPOBJS=	${COBJS:.o=.po}

# WARNING! The following are available only in binary form.
# 		DO NOT REMOVE THEM!!!!!
#
OFILES+=${.CURDIR}/emulfp/xFP0.o ${.CURDIR}/emulfp/xFP1.o \
	${.CURDIR}/emulfp/xFP2.o ${.CURDIR}/emulfp/xFP3.o \
	${.CURDIR}/emulfp/xFP4.o ${.CURDIR}/emulfp/xFP5.o \
	${.CURDIR}/emulfp/xFP6.o ${.CURDIR}/emulfp/xFP7.o \
	${.CURDIR}/emulfp/xFP8.o ${.CURDIR}/emulfp/xFP9.o \
	${.CURDIR}/emulfp/xFPscalb.o ${.CURDIR}/emulfp/xFPvect.o \
	${.CURDIR}/emulfp/xFPemul.o ${.CURDIR}/emulfp/fpfpx1.o \
	${.CURDIR}/emulfp/fpfpx3.o ${.CURDIR}/emulfp/xFPexception.o \
	${.CURDIR}/emulfp/xFPB.o

SRCS=	${CFILES} ${OFILES}
NOMAN=

# do not, I repeat DO NOT remove the objects in emulfp!
#    --no sources are shipped!
#
clean:
	rm -f a.out Errs errs mklog core ${CLEANFILES} ${COBJS} ${CPOBJS} \
	    profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln

cleandir:
	rm -f a.out Errs errs mklog core ${CLEANFILES} ${COBJS} ${CPOBJS} \
	    profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
	rm -f ${MANALL} ${.CURDIR}/tags .depend

.include <bsd.lib.mk>

# N.B. -R switch below is so that floating point emulator and the .s files 
#      it depends on are in text segment only, to be linked into the kernel.
#      The profiled version, however, should NOT use -R!
#
.c.o:
	${CC} -R ${CFLAGS} -c ${.IMPSRC} 
	@${LD} -x -r ${.TARGET}
	@mv a.out ${.TARGET}

.c.po:
	${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
	@${LD} -X -r ${.TARGET}
	@mv a.out ${.TARGET}

.s.o:
	${CPP} -E ${.IMPSRC} | \
	    ${AS} -R -o ${.TARGET}
	@${LD} -x -r ${.TARGET}
	@mv a.out ${.TARGET}

.s.po:
	${CPP} -E -DPROF ${.IMPSRC} | \
	    ${AS} -o ${.TARGET}
	@${LD} -X -r ${.TARGET}
	@mv a.out ${.TARGET}
