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