1 # $NetBSD: Makefile,v 1.60.2.6 2002/10/18 02:44:59 nathanw Exp $ 2 3 LIB= kern 4 NOPIC= # defined 5 6 .include <bsd.own.mk> 7 8 .if defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \ 9 exists(${KERNDIR}/arch/${MACHINE_ARCH}) 10 ARCHSUBDIR= ${MACHINE_ARCH} 11 .elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \ 12 exists(${KERNDIR}/arch/${MACHINE_CPU}) 13 ARCHSUBDIR= ${MACHINE_CPU} 14 .else 15 .BEGIN: 16 @echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU} 17 @false 18 .endif 19 20 M= ${KERNDIR}/arch/${ARCHSUBDIR} 21 22 CPPFLAGS= -I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS} 23 24 .PATH.c: ${KERNDIR} 25 .if exists ($M/Makefile.inc) 26 .PATH.c: $M 27 .PATH.S: $M 28 .include "$M/Makefile.inc" 29 .endif 30 31 .if (${MACHINE_ARCH} != "alpha") 32 # Quad support 33 SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 34 lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 35 subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 36 .endif 37 38 # Other stuff 39 SRCS+= __cmsg_alignbytes.c inet_addr.c intoa.c md4c.c md5c.c sha1.c pmatch.c 40 SRCS+= _que.c arc4random.c 41 42 SRCS+= strstr.c 43 44 # Files to clean up 45 CLEANFILES+= lib${LIB}.o lib${LIB}.po 46 47 # 48 # Special rules for certain objects 49 # 50 51 # mcount cannot be compiled with profiling 52 mcount.po: mcount.o 53 cp mcount.o mcount.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 POBJS+= mcount.po 78 79 # only needed during build 80 libinstall:: 81 82 .undef DESTDIR 83 .include <bsd.lib.mk> 84 85 lib${LIB}.o:: ${OBJS} 86 @echo building standard ${LIB} library 87 @rm -f lib${LIB}.o 88 @${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}` 89 90 lib${LIB}.po:: ${POBJS} 91 @echo building profiled ${LIB} library 92 @rm -f lib${LIB}.po 93 @${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}` 94 95 showsources: ${SRCS} 96 @echo ${.ALLSRC} 97