Makefile.libkern revision 1.48
11.48Sriastrad#	$NetBSD: Makefile.libkern,v 1.48 2020/04/30 03:28:19 riastradh 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.1Spooka
601.14SdyoungSRCS+=	ppath_kmem_alloc.c
611.14Sdyoung
621.4SdslSRCS+=	strsep.c strstr.c
631.4SdslSRCS+=	strlcpy.c strlcat.c
641.5Sdsl
651.43SriastradSRCS+=	imax.c imin.c lmax.c lmin.c uimax.c uimin.c ulmax.c ulmin.c
661.20SchristosSRCS+=	memmove.c
671.4SdslSRCS+=	strchr.c strrchr.c
681.42SchristosSRCS+=	memcmp.c memmem.c
691.20Schristos
701.20SchristosSRCS+=	memcpy.c
711.8Suebayasi.if empty(SRCS:Mmemset2.*)
721.47SriastradSRCS+=	memset.c
731.8Suebayasi.endif
741.23Schristos
751.4SdslSRCS+=	popcount32.c popcount64.c
761.27SlnetoSRCS+=	strtoul.c strtoll.c strtoull.c strtoimax.c strtoumax.c
771.37SchristosSRCS+=	strtoi.c strtou.c
781.39SchristosSRCS+=	strnvisx.c
791.5Sdsl
801.5SdslSRCS+=	scanc.c skpc.c
811.5SdslSRCS+=	random.c
821.15StlsSRCS+=	rngtest.c
831.1Spooka
841.5SdslSRCS+=	memchr.c
851.34SlnetoSRCS+=	strcat.c strcmp.c strcpy.c strcspn.c strlen.c strnlen.c
861.34SlnetoSRCS+=	strncat.c strncmp.c strncpy.c strpbrk.c strspn.c
871.5SdslSRCS+=	strcasecmp.c strncasecmp.c
881.1Spooka
891.1SpookaSRCS+=	xlat_mbr_fstype.c
901.1Spooka
911.44SadSRCS+=	heapsort.c ptree.c radixtree.c rb.c rpst.c
921.1Spooka
931.41SchristosSRCS+=	hexdump.c
941.41Schristos
951.18Sdrochner# for crypto
961.24SriastradSRCS+=	explicit_memset.c consttime_memequal.c
971.18Sdrochner
981.48SriastradSRCS+=	entpool.c
991.48Sriastrad
1001.28Sjoerg.PATH:	${NETBSDSRCDIR}/common/lib/libc/cdb
1011.28SjoergSRCS+=	cdbr.c
1021.28SjoergSRCS+=	mi_vector_hash.c
1031.28Sjoerg
1041.1Spooka# Files to clean up
1051.1SpookaCLEANFILES+= lib${LIB}.o lib${LIB}.po
1061.1Spooka
1071.4Sdsl# Remove from SRCS the .c files for any .S files added by the MD makefiles,
1081.5Sdsl# also remove from SRCS the .c files for the .c files in NO_SRCS.
1091.5Sdsl# (Unlike libc, we don't worry about lint)
1101.4Sdsl
1111.4Sdsl.for check_file in ${SRCS:M*.S} ${NO_SRCS}
1121.4Sdslunwanted_file := ${SRCS:M${check_file:.S=.c}}
1131.4Sdsl.if "${unwanted_file}" != ""
1141.4SdslSRCS := ${SRCS:N${unwanted_file}}
1151.1Spooka.endif
1161.4Sdsl.endfor
117