1# $NetBSD: Makefile,v 1.69 2002/11/23 23:35:50 fvdl Exp $ 2 3LIB= kern 4NOPIC= # defined 5LLIBS= # defined 6 7.include <bsd.own.mk> 8 9.if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \ 10 exists(${KERNDIR}/arch/${LIBKERN_ARCH}) 11ARCHSUBDIR= ${LIBKERN_ARCH} 12.elif defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \ 13 exists(${KERNDIR}/arch/${MACHINE_ARCH}) 14ARCHSUBDIR= ${MACHINE_ARCH} 15.elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \ 16 exists(${KERNDIR}/arch/${MACHINE_CPU}) 17ARCHSUBDIR= ${MACHINE_CPU} 18.else 19.BEGIN: 20 @echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU} 21 @false 22.endif 23 24M= ${KERNDIR}/arch/${ARCHSUBDIR} 25 26CPPFLAGS= -I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS} 27 28.PATH.c: ${KERNDIR} 29.if exists ($M/Makefile.inc) 30.PATH.c: $M 31.PATH.S: $M 32.include "$M/Makefile.inc" 33.endif 34 35.if (${MACHINE_ARCH} != "alpha") 36# Quad support 37SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 38 lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 39 subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 40.endif 41 42# Other stuff 43SRCS+= __cmsg_alignbytes.c inet_addr.c intoa.c md4c.c md5c.c sha1.c pmatch.c 44SRCS+= _que.c arc4random.c 45 46SRCS+= strstr.c 47 48# Files to clean up 49CLEANFILES+= lib${LIB}.o lib${LIB}.po 50 51# 52# Special rules for certain objects 53# 54 55# mcount cannot be compiled with profiling 56mcount.po: mcount.o 57 cp mcount.o mcount.po 58 59# XXX these stub builds should be cleaned up even further. 60 61# if no machine specific memcpy(3), build one out of bcopy(3) based stub. 62.if empty(SRCS:Mmemcpy.S) 63SRCS+= memcpy.c 64.endif 65 66# if no machine specific memmove(3), build one out of bcopy(3) based stub. 67.if empty(SRCS:Mmemmove.S) 68SRCS+= memmove.c 69.endif 70 71# if no machine specific strchr(3), build one out of index(3) based stub. 72.if empty(SRCS:Mstrchr.S) 73SRCS+= strchr.c 74.endif 75 76# if no machine specific strrchr(3), build one out of rindex(3) based stub. 77.if empty(SRCS:Mstrrchr.S) 78SRCS+= strrchr.c 79.endif 80 81POBJS+= mcount.po 82 83# only needed during build 84libinstall:: 85 86.undef DESTDIR 87.include <bsd.lib.mk> 88 89lib${LIB}.o:: ${OBJS} 90 @echo building standard ${LIB} library 91 @rm -f lib${LIB}.o 92 @${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}` 93 94lib${LIB}.po:: ${POBJS} 95 @echo building profiled ${LIB} library 96 @rm -f lib${LIB}.po 97 @${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}` 98 99showsources: ${SRCS} 100 @echo ${.ALLSRC} 101