1 # $NetBSD: Makefile.libkern,v 1.15 2011/11/19 22:51:25 tls Exp $ 2 3 # 4 # Variable definitions for libkern. 5 # 6 # Before including this, you _must_ set 7 # KERNDIR: location of sys/lib/libkern 8 # 9 # You *may* set: 10 # LIBKERN_ARCH: architecture subdir to be used 11 # KERNCPPFLAGS: see Makefile.inc 12 # KERNMISCCPPFLAGS: see Makefile.inc 13 # 14 15 .include <bsd.own.mk> 16 17 .if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \ 18 exists(${KERNDIR}/arch/${LIBKERN_ARCH}) 19 ARCHSUBDIR= ${LIBKERN_ARCH} 20 .elif defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \ 21 exists(${KERNDIR}/arch/${MACHINE_ARCH}) 22 ARCHSUBDIR= ${MACHINE_ARCH} 23 .elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \ 24 exists(${KERNDIR}/arch/${MACHINE_CPU}) 25 ARCHSUBDIR= ${MACHINE_CPU} 26 .endif 27 28 M= ${KERNDIR}/arch/${ARCHSUBDIR} 29 30 CPPFLAGS+= -I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS} 31 32 .include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc" 33 .include "${.PARSEDIR}/../../../common/lib/libutil/Makefile.inc" 34 .include "${.PARSEDIR}/../../../common/lib/libprop/Makefile.inc" 35 .include "${.PARSEDIR}/../../../common/lib/libppath/Makefile.inc" 36 .include "${.PARSEDIR}/../../../common/lib/libquota/Makefile.inc" 37 38 CPPFLAGS+= -I${KERNDIR}/../../../common/include 39 40 .PATH.c: ${KERNDIR} 41 .if exists ($M/Makefile.inc) 42 .PATH.c: $M 43 .PATH.S: $M 44 .include "$M/Makefile.inc" 45 .endif 46 47 .if (${MACHINE_ARCH} != "alpha") && \ 48 (${MACHINE_ARCH} != "mips64eb" || !empty(CFLAGS:M-mabi=32)) && \ 49 (${MACHINE_ARCH} != "mips64el" || !empty(CFLAGS:M-mabi=32)) && \ 50 (${MACHINE_ARCH} != "powerpc64") && \ 51 (${MACHINE_ARCH} != "sparc64") && \ 52 (${MACHINE_ARCH} != "x86_64" || !empty(CFLAGS:M-m32)) 53 # Quad support 54 SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 55 lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 56 subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 57 .endif 58 59 # Other stuff 60 SRCS+= kern_assert.c __main.c 61 SRCS+= __cmsg_alignbytes.c cpuset.c inet_addr.c intoa.c 62 .if empty(SRCS:Mbyte_swap_8.*) 63 SRCS+= bswap64.c 64 .endif 65 SRCS+= md4c.c md5c.c rmd160.c sha1.c sha2.c 66 SRCS+= pmatch.c arc4random.c bcd.c mcount.c mertwist.c crc32.c 67 68 SRCS+= ppath_kmem_alloc.c 69 70 SRCS+= strsep.c strstr.c 71 SRCS+= strlcpy.c strlcat.c 72 73 SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c 74 SRCS+= memcpy.c memmove.c 75 SRCS+= strchr.c strrchr.c 76 SRCS+= memcmp.c 77 .if empty(SRCS:Mmemset2.*) 78 SRCS+= memset.c 79 .endif 80 SRCS+= popcount32.c popcount64.c 81 SRCS+= strtoul.c strtoll.c strtoull.c strtoumax.c 82 83 SRCS+= scanc.c skpc.c 84 SRCS+= random.c 85 SRCS+= rngtest.c 86 87 SRCS+= memchr.c 88 SRCS+= strcat.c strcmp.c strcpy.c strlen.c 89 SRCS+= strncmp.c strncpy.c 90 SRCS+= strcasecmp.c strncasecmp.c 91 92 SRCS+= xlat_mbr_fstype.c 93 94 SRCS+= heapsort.c ptree.c rb.c 95 96 # Files to clean up 97 CLEANFILES+= lib${LIB}.o lib${LIB}.po 98 99 # Remove from SRCS the .c files for any .S files added by the MD makefiles, 100 # also remove from SRCS the .c files for the .c files in NO_SRCS. 101 # (Unlike libc, we don't worry about lint) 102 103 .for check_file in ${SRCS:M*.S} ${NO_SRCS} 104 unwanted_file := ${SRCS:M${check_file:.S=.c}} 105 .if "${unwanted_file}" != "" 106 SRCS := ${SRCS:N${unwanted_file}} 107 .endif 108 .endfor 109