#	@(#)Makefile	7.9 (Berkeley) 6/1/93

LIB=	kern
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/..
.if (${MACHINE} == "rt")
# XXX: we aren't compiling the kernel with gcc yet.
SRCS=	bcmp.c ffs.c locc.c random.c rindex.c scanc.c \
	skpc.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c strncpy.c 
.else
SRCS=	adddi3.c anddi3.c ashldi3.c ashrdi3.c bcmp.c cmpdi2.c divdi3.c \
	ffs.c iordi3.c locc.c lshldi3.c lshrdi3.c mcount.c moddi3.c \
	muldi3.c negdi2.c notdi2.c qdivrem.c random.c rindex.c scanc.c \
	skpc.c strcat.c strcmp.c strcpy.c strlen.c strncpy.c subdi3.c \
	ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
.endif

.if exists(${.CURDIR}/${MACHINE}/Makefile.inc)
.PATH: ${.CURDIR}/${MACHINE}
.include "${.CURDIR}/${MACHINE}/Makefile.inc"
.endif

# If no machine specific bzero(3), build one out of memset(3).
.if empty(SRCS:Mbzero.s)
OBJS+=	bzero.o
bzero.o: memset.c
	${CC} -DBZERO ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}
	@${LD} -x -r ${.TARGET}
	@mv a.out ${.TARGET}

bzero.po: memset.c
	${CC} -DBZERO ${CFLAGS} -c -p ${.ALLSRC} -o ${.TARGET}
	@${LD} -X -r ${.TARGET}
	@mv a.out ${.TARGET}
.endif

# mcount cannot be compiled with profiling
mcount.po: mcount.o
	cp mcount.o mcount.po

.include <bsd.lib.mk>
