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