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