1 # $NetBSD: Makefile.libkern,v 1.36 2014/11/20 16:25:16 christos 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 37 CPPFLAGS+= -I${KERNDIR}/../../../common/include 38 39 .PATH.c: ${KERNDIR} 40 .if exists ($M/Makefile.inc) 41 .PATH.c: $M 42 .PATH.S: $M 43 .include "$M/Makefile.inc" 44 .endif 45 46 .if !defined(RUMPKERNEL) 47 .include "${.PARSEDIR}/Makefile.compiler-rt" 48 .endif 49 50 # Other stuff 51 SRCS+= kern_assert.c __main.c 52 SRCS+= cpuset.c inet_addr.c intoa.c 53 .if empty(SRCS:Mbyte_swap_8.*) 54 SRCS+= bswap64.c 55 .endif 56 SRCS+= md4c.c md5c.c rmd160.c sha1.c sha2.c murmurhash.c 57 SRCS+= pmatch.c mcount.c mertwist.c crc32.c 58 59 SRCS+= ppath_kmem_alloc.c 60 61 SRCS+= strsep.c strstr.c 62 SRCS+= strlcpy.c strlcat.c 63 64 SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c 65 SRCS+= memmove.c 66 SRCS+= strchr.c strrchr.c 67 SRCS+= memcmp.c 68 69 SRCS+= memcpy.c 70 .if empty(SRCS:Mmemset2.*) 71 SRCS+= memset.c 72 .endif 73 74 SRCS+= popcount32.c popcount64.c 75 SRCS+= strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c 76 77 SRCS+= scanc.c skpc.c 78 SRCS+= random.c 79 SRCS+= rngtest.c 80 81 SRCS+= memchr.c 82 SRCS+= strcat.c strcmp.c strcpy.c strcspn.c strlen.c strnlen.c 83 SRCS+= strncat.c strncmp.c strncpy.c strpbrk.c strspn.c 84 SRCS+= strcasecmp.c strncasecmp.c 85 86 SRCS+= xlat_mbr_fstype.c 87 88 SRCS+= heapsort.c ptree.c rb.c 89 90 # for crypto 91 SRCS+= explicit_memset.c consttime_memequal.c 92 93 .PATH: ${NETBSDSRCDIR}/common/lib/libc/cdb 94 SRCS+= cdbr.c 95 SRCS+= mi_vector_hash.c 96 97 #.PATH: ${NETBSDSRCDIR}/external/bsd/liblzf/dist 98 #SRCS+= lzf_c.c lzf_d.c 99 100 # Files to clean up 101 CLEANFILES+= lib${LIB}.o lib${LIB}.po 102 103 # Remove from SRCS the .c files for any .S files added by the MD makefiles, 104 # also remove from SRCS the .c files for the .c files in NO_SRCS. 105 # (Unlike libc, we don't worry about lint) 106 107 .for check_file in ${SRCS:M*.S} ${NO_SRCS} 108 unwanted_file := ${SRCS:M${check_file:.S=.c}} 109 .if "${unwanted_file}" != "" 110 SRCS := ${SRCS:N${unwanted_file}} 111 .endif 112 .endfor 113 114 .if ${HAVE_GCC:U} == "45" && ${MACHINE_CPU} == "hppa" 115 COPTS.md5c.c += ${${ACTIVE_CC} == "gcc" :? -O0 :} 116 .endif 117