1 # $NetBSD: Makefile,v 1.65 2002/06/18 23:46:53 wrstuden 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 # Files to clean up 43 CLEANFILES+= lib${LIB}.o lib${LIB}.po 44 45 # 46 # Special rules for certain objects 47 # 48 49 # mcount cannot be compiled with profiling 50 mcount.po: mcount.o 51 cp mcount.o mcount.po 52 53 # XXX these stub builds should be cleaned up even further. 54 55 # if no machine specific memcpy(3), build one out of bcopy(3) based stub. 56 .if empty(SRCS:Mmemcpy.S) 57 SRCS+= memcpy.c 58 .endif 59 60 # if no machine specific memmove(3), build one out of bcopy(3) based stub. 61 .if empty(SRCS:Mmemmove.S) 62 SRCS+= memmove.c 63 .endif 64 65 # if no machine specific strchr(3), build one out of index(3) based stub. 66 .if empty(SRCS:Mstrchr.S) 67 SRCS+= strchr.c 68 .endif 69 70 # if no machine specific strrchr(3), build one out of rindex(3) based stub. 71 .if empty(SRCS:Mstrrchr.S) 72 SRCS+= strrchr.c 73 .endif 74 75 POBJS+= mcount.po 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