1*3f351f34Skre# $NetBSD: Makefile.libkern,v 1.55 2024/01/20 11:04:53 kre Exp $ 259f8fc8fSpooka 359f8fc8fSpooka# 459f8fc8fSpooka# Variable definitions for libkern. 559f8fc8fSpooka# 659f8fc8fSpooka# Before including this, you _must_ set 759f8fc8fSpooka# KERNDIR: location of sys/lib/libkern 859f8fc8fSpooka# 959f8fc8fSpooka# You *may* set: 1059f8fc8fSpooka# LIBKERN_ARCH: architecture subdir to be used 1159f8fc8fSpooka# KERNCPPFLAGS: see Makefile.inc 122b801a94Spooka# KERNMISCCPPFLAGS: see Makefile.inc 1359f8fc8fSpooka# 1459f8fc8fSpooka 1559f8fc8fSpooka.include <bsd.own.mk> 1659f8fc8fSpooka 1759f8fc8fSpooka.if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \ 1859f8fc8fSpooka exists(${KERNDIR}/arch/${LIBKERN_ARCH}) 1959f8fc8fSpookaARCHSUBDIR= ${LIBKERN_ARCH} 2059f8fc8fSpooka.elif defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \ 2159f8fc8fSpooka exists(${KERNDIR}/arch/${MACHINE_ARCH}) 2259f8fc8fSpookaARCHSUBDIR= ${MACHINE_ARCH} 2359f8fc8fSpooka.elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \ 2459f8fc8fSpooka exists(${KERNDIR}/arch/${MACHINE_CPU}) 2559f8fc8fSpookaARCHSUBDIR= ${MACHINE_CPU} 2659f8fc8fSpooka.endif 2759f8fc8fSpooka 2859f8fc8fSpookaM= ${KERNDIR}/arch/${ARCHSUBDIR} 2959f8fc8fSpooka 3059f8fc8fSpookaCPPFLAGS+= -I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS} 3159f8fc8fSpooka 3259f8fc8fSpooka.include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc" 3359f8fc8fSpooka.include "${.PARSEDIR}/../../../common/lib/libutil/Makefile.inc" 3459f8fc8fSpooka.include "${.PARSEDIR}/../../../common/lib/libprop/Makefile.inc" 3599432646Sdyoung.include "${.PARSEDIR}/../../../common/lib/libppath/Makefile.inc" 3659f8fc8fSpooka 3759f8fc8fSpookaCPPFLAGS+= -I${KERNDIR}/../../../common/include 38*3f351f34SkreCPPFLAGS+= -I${KERNDIR}/../../../common/include/libc 395084c1b5SriastradhCPPFLAGS+= -I${KERNDIR}/../../../common/libc/hash/sha3 4059f8fc8fSpooka 4159f8fc8fSpooka.PATH.c: ${KERNDIR} 4259f8fc8fSpooka.if exists ($M/Makefile.inc) 4359f8fc8fSpooka.PATH.c: $M 4459f8fc8fSpooka.PATH.S: $M 4559f8fc8fSpooka.include "$M/Makefile.inc" 4659f8fc8fSpooka.endif 4759f8fc8fSpooka 481ee7f81fSpooka.if !defined(RUMPKERNEL) 4965c6ea68Sjmcneill.include "${.PARSEDIR}/Makefile.compiler-rt" 501ee7f81fSpooka.endif 5159f8fc8fSpooka 5259f8fc8fSpooka# Other stuff 53654415b2SpookaSRCS+= kern_assert.c __main.c 54714fe696SjoergSRCS+= cpuset.c inet_addr.c intoa.c 55e3ac1d93Suebayasi.if empty(SRCS:Mbyte_swap_8.*) 56eaf64f1bSdslSRCS+= bswap64.c 57e3ac1d93Suebayasi.endif 5896999894SriastradhSRCS+= md4c.c md5c.c rmd160.c sha1.c sha2.c sha3.c keccak.c murmurhash.c 59f989f962SryoSRCS+= pmatch.c mcount.c crc32.c 6077507b12SthorpejSRCS+= strlist.c 6159f8fc8fSpooka 6299432646SdyoungSRCS+= ppath_kmem_alloc.c 6399432646Sdyoung 64ca08b3e7SmaxvSRCS+= copystr.c 656f5236b4SdslSRCS+= strsep.c strstr.c 666f5236b4SdslSRCS+= strlcpy.c strlcat.c 67eaf64f1bSdsl 6882a15b88SriastradhSRCS+= imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c 6949d47d88SchristosSRCS+= memmove.c 706f5236b4SdslSRCS+= strchr.c strrchr.c 714231a89cSchristosSRCS+= memcmp.c memmem.c 7249d47d88Schristos 7349d47d88SchristosSRCS+= memcpy.c 74e3ac1d93Suebayasi.if empty(SRCS:Mmemset2.*) 75e3ac1d93SuebayasiSRCS+= memset.c 76e3ac1d93Suebayasi.endif 77ab495c9fSchristos 786f5236b4SdslSRCS+= popcount32.c popcount64.c 79c4a02e0aSlnetoSRCS+= strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c 80d36e0de1SchristosSRCS+= strtoi.c strtou.c 81ee17f398SchristosSRCS+= strnvisx.c 8259f8fc8fSpooka 83eaf64f1bSdslSRCS+= scanc.c skpc.c 84eaf64f1bSdslSRCS+= random.c 853afd44cfStlsSRCS+= rngtest.c 86eaf64f1bSdsl 87eaf64f1bSdslSRCS+= memchr.c 884ab4902eSlnetoSRCS+= strcat.c strcmp.c strcpy.c strcspn.c strlen.c strnlen.c 894ab4902eSlnetoSRCS+= strncat.c strncmp.c strncpy.c strpbrk.c strspn.c 90eaf64f1bSdslSRCS+= strcasecmp.c strncasecmp.c 9159f8fc8fSpooka 9259f8fc8fSpookaSRCS+= xlat_mbr_fstype.c 9359f8fc8fSpooka 940c2afd29SadSRCS+= heapsort.c ptree.c radixtree.c rb.c rpst.c 9559f8fc8fSpooka 964a1f5c48SchristosSRCS+= hexdump.c 974a1f5c48Schristos 988588929dSdrochner# for crypto 9982db4b98SriastradhSRCS+= explicit_memset.c consttime_memequal.c 1008588929dSdrochner 1015084c1b5SriastradhSRCS+= entpool.c 1025084c1b5Sriastradh 1037de9d97fSmrgSRCS+= dkcksum.c 1047de9d97fSmrgSRCS+= disklabel_swap.c 1057de9d97fSmrg 106b37dea26Srhialto.PATH: ${.PARSEDIR}/../../../common/lib/libc/cdb 107aceb2135SjoergSRCS+= cdbr.c 108aceb2135SjoergSRCS+= mi_vector_hash.c 109aceb2135Sjoerg 11059f8fc8fSpooka# Files to clean up 11159f8fc8fSpookaCLEANFILES+= lib${LIB}.o lib${LIB}.po 11259f8fc8fSpooka 1136f5236b4Sdsl# Remove from SRCS the .c files for any .S files added by the MD makefiles, 114eaf64f1bSdsl# also remove from SRCS the .c files for the .c files in NO_SRCS. 115eaf64f1bSdsl# (Unlike libc, we don't worry about lint) 11659f8fc8fSpooka 1176f5236b4Sdsl.for check_file in ${SRCS:M*.S} ${NO_SRCS} 1186f5236b4Sdslunwanted_file := ${SRCS:M${check_file:.S=.c}} 1196f5236b4Sdsl.if "${unwanted_file}" != "" 1206f5236b4SdslSRCS := ${SRCS:N${unwanted_file}} 12159f8fc8fSpooka.endif 1226f5236b4Sdsl.endfor 123