Move popcount et al to src/common and add popcount32/popcount64.
[netbsd-mini2440.git] / sys / lib / libkern / Makefile.libkern
blob0e24721f481c1e07868fb1715a7dcf5fa6323ed4
1 #       $NetBSD: Makefile.libkern,v 1.2 2009/03/25 01:26:13 darran Exp $
3
4 # Variable definitions for libkern.  
6 # Before including this, you _must_ set
7 #   KERNDIR: location of sys/lib/libkern
9 # You *may* set:
10 #   LIBKERN_ARCH: architecture subdir to be used
11 #   KERNCPPFLAGS: see Makefile.inc
12 #   KERNMICPPFLAGS: see Makefile.inc
15 .include <bsd.own.mk>
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
28 M= ${KERNDIR}/arch/${ARCHSUBDIR}
30 CPPFLAGS+=      -I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS}
32 .include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc"
33 .include "${.PARSEDIR}/../../../common/lib/libutil/Makefile.inc"
34 .include "${.PARSEDIR}/../../../common/lib/libprop/Makefile.inc"
36 CPPFLAGS+=      -I${KERNDIR}/../../../common/include
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
45 .if (${MACHINE_ARCH} != "alpha")
46 # Quad support
47 SRCS+=  adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
48         lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
49         subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
50 .endif
52 # Other stuff
53 SRCS+=  __cmsg_alignbytes.c cpuset.c inet_addr.c intoa.c
54 SRCS+=  md4c.c md5c.c rmd160.c sha1.c sha2.c
55 SRCS+=  pmatch.c arc4random.c bcd.c mcount.c mertwist.c crc32.c
57 SRCS+=  strsep.c strstr.c strlcpy.c strlcat.c
59 SRCS+=  strtoll.c strtoull.c strtoumax.c
61 SRCS+=  xlat_mbr_fstype.c
63 SRCS+=  heapsort.c ptree.c rb.c
65 # Files to clean up
66 CLEANFILES+= lib${LIB}.o lib${LIB}.po
68 # XXX these stub builds should be cleaned up even further.
70 # if no machine specific memcpy(3), build one out of bcopy(3) based stub.
71 .if empty(SRCS:Mmemcpy.S)
72 SRCS+=  memcpy.c
73 .endif
75 # if no machine specific memmove(3), build one out of bcopy(3) based stub.
76 .if empty(SRCS:Mmemmove.S)
77 SRCS+=  memmove.c
78 .endif
80 # if no machine specific strchr(3), build one out of index(3) based stub.
81 .if empty(SRCS:Mstrchr.S)
82 SRCS+=  strchr.c
83 .endif
85 # if no machine specific strrchr(3), build one out of rindex(3) based stub.
86 .if empty(SRCS:Mstrrchr.S)
87 SRCS+=  strrchr.c
88 .endif
90 # if no machine specific popcount32(3), build generic version
91 .if empty(SRCS:Mpopcount32.S)
92 SRCS+=  popcount32.c
93 .endif
95 # if no machine specific popcount64(3), build generic version
96 .if empty(SRCS:Mpopcount64.S)
97 SRCS+=  popcount64.c
98 .endif