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