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