xref: /netbsd-src/sys/lib/libkern/Makefile.libkern (revision abb0f93cd77b67f080613360c65701f85e5f5cfe)
1#	$NetBSD: Makefile.libkern,v 1.7 2009/11/21 13:37:18 uebayasi 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#   KERNMICPPFLAGS: 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
36CPPFLAGS+=	-I${KERNDIR}/../../../common/include
37
38.PATH.c: ${KERNDIR}
39.if exists ($M/Makefile.inc)
40.PATH.c: $M
41.PATH.S: $M
42.include "$M/Makefile.inc"
43.endif
44
45.if (${MACHINE_ARCH} != "alpha") && \
46    (${MACHINE_ARCH} != "mips64eb") && \
47    (${MACHINE_ARCH} != "mips64el") && \
48    (${MACHINE_ARCH} != "powerpc64") && \
49    (${MACHINE_ARCH} != "sparc64") && \
50    (${MACHINE_ARCH} != "x86_64")
51# Quad support
52SRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
53	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
54	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
55.endif
56
57# Other stuff
58SRCS+=	__assert.c __main.c
59SRCS+=	__cmsg_alignbytes.c cpuset.c inet_addr.c intoa.c
60SRCS+=	bswap64.c
61SRCS+=	md4c.c md5c.c rmd160.c sha1.c sha2.c
62SRCS+=	pmatch.c arc4random.c bcd.c mcount.c mertwist.c crc32.c
63
64SRCS+=	strsep.c strstr.c
65SRCS+=	strlcpy.c strlcat.c
66
67SRCS+=	imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c
68SRCS+=	memcpy.c memmove.c
69SRCS+=	strchr.c strrchr.c
70SRCS+=	memcmp.c memset.c
71SRCS+=	popcount32.c popcount64.c
72SRCS+=	strtoul.c strtoll.c strtoull.c strtoumax.c
73
74SRCS+=	scanc.c skpc.c
75SRCS+=	random.c
76
77SRCS+=	memchr.c
78SRCS+=	strcat.c strcmp.c strcpy.c strlen.c
79SRCS+=	strncmp.c strncpy.c
80SRCS+=	strcasecmp.c strncasecmp.c
81
82SRCS+=	xlat_mbr_fstype.c
83
84SRCS+=	heapsort.c ptree.c rb.c
85
86# Files to clean up
87CLEANFILES+= lib${LIB}.o lib${LIB}.po
88
89# Remove from SRCS the .c files for any .S files added by the MD makefiles,
90# also remove from SRCS the .c files for the .c files in NO_SRCS.
91# (Unlike libc, we don't worry about lint)
92
93.for check_file in ${SRCS:M*.S} ${NO_SRCS}
94unwanted_file := ${SRCS:M${check_file:.S=.c}}
95.if "${unwanted_file}" != ""
96SRCS := ${SRCS:N${unwanted_file}}
97.endif
98.endfor
99
100