Makefile.libkern revision 1.51
11.51Smrg#	$NetBSD: Makefile.libkern,v 1.51 2021/05/17 08:50:36 mrg Exp $
21.1Spooka
31.47Sriastrad#
41.47Sriastrad# Variable definitions for libkern.
51.1Spooka#
61.1Spooka# Before including this, you _must_ set
71.1Spooka#   KERNDIR: location of sys/lib/libkern
81.1Spooka#
91.1Spooka# You *may* set:
101.1Spooka#   LIBKERN_ARCH: architecture subdir to be used
111.1Spooka#   KERNCPPFLAGS: see Makefile.inc
121.10Spooka#   KERNMISCCPPFLAGS: see Makefile.inc
131.1Spooka#
141.1Spooka
151.1Spooka.include <bsd.own.mk>
161.1Spooka
171.1Spooka.if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \
181.1Spooka    exists(${KERNDIR}/arch/${LIBKERN_ARCH})
191.1SpookaARCHSUBDIR=     ${LIBKERN_ARCH}
201.1Spooka.elif defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \
211.1Spooka    exists(${KERNDIR}/arch/${MACHINE_ARCH})
221.1SpookaARCHSUBDIR=     ${MACHINE_ARCH}
231.1Spooka.elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \
241.1Spooka    exists(${KERNDIR}/arch/${MACHINE_CPU})
251.1SpookaARCHSUBDIR=     ${MACHINE_CPU}
261.1Spooka.endif
271.1Spooka
281.1SpookaM= ${KERNDIR}/arch/${ARCHSUBDIR}
291.1Spooka
301.1SpookaCPPFLAGS+=	-I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS}
311.1Spooka
321.1Spooka.include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc"
331.1Spooka.include "${.PARSEDIR}/../../../common/lib/libutil/Makefile.inc"
341.1Spooka.include "${.PARSEDIR}/../../../common/lib/libprop/Makefile.inc"
351.14Sdyoung.include "${.PARSEDIR}/../../../common/lib/libppath/Makefile.inc"
361.1Spooka
371.1SpookaCPPFLAGS+=	-I${KERNDIR}/../../../common/include
381.48SriastradCPPFLAGS+=	-I${KERNDIR}/../../../common/libc/hash/sha3
391.1Spooka
401.1Spooka.PATH.c: ${KERNDIR}
411.1Spooka.if exists ($M/Makefile.inc)
421.1Spooka.PATH.c: $M
431.1Spooka.PATH.S: $M
441.1Spooka.include "$M/Makefile.inc"
451.1Spooka.endif
461.1Spooka
471.32Spooka.if !defined(RUMPKERNEL)
481.33Sjmcneill.include "${.PARSEDIR}/Makefile.compiler-rt"
491.32Spooka.endif
501.1Spooka
511.1Spooka# Other stuff
521.9SpookaSRCS+=	kern_assert.c __main.c
531.16SjoergSRCS+=	cpuset.c inet_addr.c intoa.c
541.8Suebayasi.if empty(SRCS:Mbyte_swap_8.*)
551.5SdslSRCS+=	bswap64.c
561.8Suebayasi.endif
571.40SriastradSRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c sha3.c keccak.c murmurhash.c
581.46SriastradSRCS+=	pmatch.c mcount.c crc32.c
591.50SthorpejSRCS+=	strlist.c
601.1Spooka
611.14SdyoungSRCS+=	ppath_kmem_alloc.c
621.14Sdyoung
631.49SmaxvSRCS+=	copystr.c
641.4SdslSRCS+=	strsep.c strstr.c
651.4SdslSRCS+=	strlcpy.c strlcat.c
661.5Sdsl
671.43SriastradSRCS+=	imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c
681.20SchristosSRCS+=	memmove.c
691.4SdslSRCS+=	strchr.c strrchr.c
701.42SchristosSRCS+=	memcmp.c memmem.c
711.20Schristos
721.20SchristosSRCS+=	memcpy.c
731.8Suebayasi.if empty(SRCS:Mmemset2.*)
741.47SriastradSRCS+=	memset.c
751.8Suebayasi.endif
761.23Schristos
771.4SdslSRCS+=	popcount32.c popcount64.c
781.27SlnetoSRCS+=	strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c
791.37SchristosSRCS+=	strtoi.c strtou.c
801.39SchristosSRCS+=	strnvisx.c
811.5Sdsl
821.5SdslSRCS+=	scanc.c skpc.c
831.5SdslSRCS+=	random.c
841.15StlsSRCS+=	rngtest.c
851.1Spooka
861.5SdslSRCS+=	memchr.c
871.34SlnetoSRCS+=	strcat.c strcmp.c strcpy.c strcspn.c strlen.c strnlen.c
881.34SlnetoSRCS+=	strncat.c strncmp.c strncpy.c strpbrk.c strspn.c
891.5SdslSRCS+=	strcasecmp.c strncasecmp.c
901.1Spooka
911.1SpookaSRCS+=	xlat_mbr_fstype.c
921.1Spooka
931.44SadSRCS+=	heapsort.c ptree.c radixtree.c rb.c rpst.c
941.1Spooka
951.41SchristosSRCS+=	hexdump.c
961.41Schristos
971.18Sdrochner# for crypto
981.24SriastradSRCS+=	explicit_memset.c consttime_memequal.c
991.18Sdrochner
1001.48SriastradSRCS+=	entpool.c
1011.48Sriastrad
1021.51SmrgSRCS+=	dkcksum.c
1031.51SmrgSRCS+=	disklabel_swap.c
1041.51Smrg
1051.28Sjoerg.PATH:	${NETBSDSRCDIR}/common/lib/libc/cdb
1061.28SjoergSRCS+=	cdbr.c
1071.28SjoergSRCS+=	mi_vector_hash.c
1081.28Sjoerg
1091.1Spooka# Files to clean up
1101.1SpookaCLEANFILES+= lib${LIB}.o lib${LIB}.po
1111.1Spooka
1121.4Sdsl# Remove from SRCS the .c files for any .S files added by the MD makefiles,
1131.5Sdsl# also remove from SRCS the .c files for the .c files in NO_SRCS.
1141.5Sdsl# (Unlike libc, we don't worry about lint)
1151.4Sdsl
1161.4Sdsl.for check_file in ${SRCS:M*.S} ${NO_SRCS}
1171.4Sdslunwanted_file := ${SRCS:M${check_file:.S=.c}}
1181.4Sdsl.if "${unwanted_file}" != ""
1191.4SdslSRCS := ${SRCS:N${unwanted_file}}
1201.1Spooka.endif
1211.4Sdsl.endfor
122