1# $NetBSD: Makefile.libkern,v 1.30 2014/01/15 21:12:57 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.if ${HAVE_LIBGCC} == "no" 47.include ".${PARSEDIR}/Makefile.compiler-rt" 48.else 49.if (${MACHINE_ARCH} != "alpha") && \ 50 (${MACHINE_ARCH} != "mips64eb" || !empty(CFLAGS:M-mabi=32)) && \ 51 (${MACHINE_ARCH} != "mips64el" || !empty(CFLAGS:M-mabi=32)) && \ 52 (${MACHINE_ARCH} != "powerpc64") && \ 53 (${MACHINE_ARCH} != "sparc64") && \ 54 (${MACHINE_ARCH} != "x86_64" || !empty(CFLAGS:M-m32)) 55# Quad support 56SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ 57 lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ 58 subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c 59.endif 60.endif 61 62# Other stuff 63SRCS+= kern_assert.c __main.c 64SRCS+= cpuset.c inet_addr.c intoa.c 65.if empty(SRCS:Mbyte_swap_8.*) 66SRCS+= bswap64.c 67.endif 68SRCS+= md4c.c md5c.c rmd160.c sha1.c sha2.c murmurhash.c 69SRCS+= pmatch.c arc4random.c bcd.c mcount.c mertwist.c crc32.c 70 71SRCS+= ppath_kmem_alloc.c 72 73SRCS+= strsep.c strstr.c 74SRCS+= strlcpy.c strlcat.c 75 76SRCS+= imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c 77SRCS+= memmove.c 78SRCS+= strchr.c strrchr.c 79SRCS+= memcmp.c 80 81SRCS+= memcpy.c 82.if empty(SRCS:Mmemset2.*) 83SRCS+= memset.c 84.endif 85 86SRCS+= popcount32.c popcount64.c 87SRCS+= strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c 88 89SRCS+= scanc.c skpc.c 90SRCS+= random.c 91SRCS+= rngtest.c 92 93SRCS+= memchr.c 94SRCS+= strcat.c strcmp.c strcpy.c strlen.c strnlen.c 95SRCS+= strncat.c strncmp.c strncpy.c 96SRCS+= strcasecmp.c strncasecmp.c 97 98SRCS+= xlat_mbr_fstype.c 99 100SRCS+= heapsort.c ptree.c rb.c 101 102# for crypto 103SRCS+= explicit_memset.c consttime_memequal.c 104 105.PATH: ${NETBSDSRCDIR}/common/lib/libc/cdb 106SRCS+= cdbr.c 107SRCS+= mi_vector_hash.c 108 109# Files to clean up 110CLEANFILES+= lib${LIB}.o lib${LIB}.po 111 112# Remove from SRCS the .c files for any .S files added by the MD makefiles, 113# also remove from SRCS the .c files for the .c files in NO_SRCS. 114# (Unlike libc, we don't worry about lint) 115 116.for check_file in ${SRCS:M*.S} ${NO_SRCS} 117unwanted_file := ${SRCS:M${check_file:.S=.c}} 118.if "${unwanted_file}" != "" 119SRCS := ${SRCS:N${unwanted_file}} 120.endif 121.endfor 122 123.if ${HAVE_GCC:U} == "45" && ${MACHINE_CPU} == "hppa" 124COPTS.md5c.c += ${${ACTIVE_CC} == "gcc" :? -O0 :} 125.endif 126