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