1 # $NetBSD: Makefile,v 1.81.2.1 2006/11/18 21:39:27 ad 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 .include "${.PARSEDIR}/../../../common/lib/libprop/Makefile.inc" 30 31 CPPFLAGS+= -I${KERNDIR}/../../../common/include 32 33 .PATH.c: ${KERNDIR} 34 .if exists ($M/Makefile.inc) 35 .PATH.c: $M 36 .PATH.S: $M 37 .include "$M/Makefile.inc" 38 .endif 39 40 .if (${MACHINE_ARCH} != "alpha") 41 # Quad support 42 SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 43 lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 44 subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 45 .endif 46 47 # Other stuff 48 SRCS+= __cmsg_alignbytes.c inet_addr.c intoa.c 49 SRCS+= md4c.c md5c.c rmd160.c sha1.c sha2.c 50 SRCS+= pmatch.c _que.c arc4random.c bcd.c mcount.c 51 52 SRCS+= strsep.c strstr.c strlcpy.c strlcat.c 53 54 SRCS+= strtoll.c strtoull.c strtoumax.c 55 56 SRCS+= xlat_mbr_fstype.c 57 58 # Files to clean up 59 CLEANFILES+= lib${LIB}.o lib${LIB}.po 60 61 # XXX these stub builds should be cleaned up even further. 62 63 # if no machine specific memcpy(3), build one out of bcopy(3) based stub. 64 .if empty(SRCS:Mmemcpy.S) 65 SRCS+= memcpy.c 66 .endif 67 68 # if no machine specific memmove(3), build one out of bcopy(3) based stub. 69 .if empty(SRCS:Mmemmove.S) 70 SRCS+= memmove.c 71 .endif 72 73 # if no machine specific strchr(3), build one out of index(3) based stub. 74 .if empty(SRCS:Mstrchr.S) 75 SRCS+= strchr.c 76 .endif 77 78 # if no machine specific strrchr(3), build one out of rindex(3) based stub. 79 .if empty(SRCS:Mstrrchr.S) 80 SRCS+= strrchr.c 81 .endif 82 83 # only needed during build 84 libinstall:: 85 86 .undef DESTDIR 87 .include <bsd.lib.mk> 88 89 lib${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 94 lib${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 99 showsources: ${SRCS} 100 @echo ${.ALLSRC} 101