Makefile.libkern revision 1.48
1# $NetBSD: Makefile.libkern,v 1.48 2020/04/30 03:28:19 riastradh 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 38CPPFLAGS+= -I${KERNDIR}/../../../common/libc/hash/sha3 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 !defined(RUMPKERNEL) 48.include "${.PARSEDIR}/Makefile.compiler-rt" 49.endif 50 51# Other stuff 52SRCS+= kern_assert.c __main.c 53SRCS+= cpuset.c inet_addr.c intoa.c 54.if empty(SRCS:Mbyte_swap_8.*) 55SRCS+= bswap64.c 56.endif 57SRCS+= md4c.c md5c.c rmd160.c sha1.c sha2.c sha3.c keccak.c murmurhash.c 58SRCS+= pmatch.c mcount.c crc32.c 59 60SRCS+= ppath_kmem_alloc.c 61 62SRCS+= strsep.c strstr.c 63SRCS+= strlcpy.c strlcat.c 64 65SRCS+= imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c 66SRCS+= memmove.c 67SRCS+= strchr.c strrchr.c 68SRCS+= memcmp.c memmem.c 69 70SRCS+= memcpy.c 71.if empty(SRCS:Mmemset2.*) 72SRCS+= memset.c 73.endif 74 75SRCS+= popcount32.c popcount64.c 76SRCS+= strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c 77SRCS+= strtoi.c strtou.c 78SRCS+= strnvisx.c 79 80SRCS+= scanc.c skpc.c 81SRCS+= random.c 82SRCS+= rngtest.c 83 84SRCS+= memchr.c 85SRCS+= strcat.c strcmp.c strcpy.c strcspn.c strlen.c strnlen.c 86SRCS+= strncat.c strncmp.c strncpy.c strpbrk.c strspn.c 87SRCS+= strcasecmp.c strncasecmp.c 88 89SRCS+= xlat_mbr_fstype.c 90 91SRCS+= heapsort.c ptree.c radixtree.c rb.c rpst.c 92 93SRCS+= hexdump.c 94 95# for crypto 96SRCS+= explicit_memset.c consttime_memequal.c 97 98SRCS+= entpool.c 99 100.PATH: ${NETBSDSRCDIR}/common/lib/libc/cdb 101SRCS+= cdbr.c 102SRCS+= mi_vector_hash.c 103 104# Files to clean up 105CLEANFILES+= lib${LIB}.o lib${LIB}.po 106 107# Remove from SRCS the .c files for any .S files added by the MD makefiles, 108# also remove from SRCS the .c files for the .c files in NO_SRCS. 109# (Unlike libc, we don't worry about lint) 110 111.for check_file in ${SRCS:M*.S} ${NO_SRCS} 112unwanted_file := ${SRCS:M${check_file:.S=.c}} 113.if "${unwanted_file}" != "" 114SRCS := ${SRCS:N${unwanted_file}} 115.endif 116.endfor 117