Makefile revision 1.79
1#	$NetBSD: Makefile,v 1.79 2006/04/22 15:33:33 thorpej Exp $
2
3LIB=		kern
4NOPIC=		# defined
5LLIBS=		# defined
6
7.include <bsd.own.mk>
8
9.if defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \
10    exists(${KERNDIR}/arch/${LIBKERN_ARCH})
11ARCHSUBDIR=     ${LIBKERN_ARCH}
12.elif defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \
13    exists(${KERNDIR}/arch/${MACHINE_ARCH})
14ARCHSUBDIR=     ${MACHINE_ARCH}
15.elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \
16    exists(${KERNDIR}/arch/${MACHINE_CPU})
17ARCHSUBDIR=     ${MACHINE_CPU}
18.else
19.BEGIN:
20	@echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
21	@false
22.endif
23
24M= ${KERNDIR}/arch/${ARCHSUBDIR}
25
26CPPFLAGS=	-I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS}
27
28.include "${.PARSEDIR}/../../../common/lib/libc/Makefile.inc"
29
30.PATH.c: ${KERNDIR}
31.if exists ($M/Makefile.inc)
32.PATH.c: $M
33.PATH.S: $M
34.include "$M/Makefile.inc"
35.endif
36
37.if (${MACHINE_ARCH} != "alpha")
38# Quad support
39SRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
40	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
41	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
42.endif
43
44# Other stuff
45SRCS+=	__cmsg_alignbytes.c inet_addr.c intoa.c md4c.c md5c.c sha1.c pmatch.c
46SRCS+=	_que.c arc4random.c bcd.c mcount.c
47
48SRCS+=	strstr.c strlcpy.c strlcat.c
49
50SRCS+=	strtoumax.c
51
52SRCS+=	xlat_mbr_fstype.c
53
54# Files to clean up
55CLEANFILES+= lib${LIB}.o lib${LIB}.po
56
57# XXX these stub builds should be cleaned up even further.
58
59# if no machine specific memcpy(3), build one out of bcopy(3) based stub.
60.if empty(SRCS:Mmemcpy.S)
61SRCS+=	memcpy.c
62.endif
63
64# if no machine specific memmove(3), build one out of bcopy(3) based stub.
65.if empty(SRCS:Mmemmove.S)
66SRCS+=	memmove.c
67.endif
68
69# if no machine specific strchr(3), build one out of index(3) based stub.
70.if empty(SRCS:Mstrchr.S)
71SRCS+=	strchr.c
72.endif
73
74# if no machine specific strrchr(3), build one out of rindex(3) based stub.
75.if empty(SRCS:Mstrrchr.S)
76SRCS+=	strrchr.c
77.endif
78
79# only needed during build
80libinstall::
81
82.undef DESTDIR
83.include <bsd.lib.mk>
84
85lib${LIB}.o:: ${OBJS}
86	@echo building standard ${LIB} library
87	@rm -f lib${LIB}.o
88	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
89
90lib${LIB}.po:: ${POBJS}
91	@echo building profiled ${LIB} library
92	@rm -f lib${LIB}.po
93	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
94
95showsources: ${SRCS}
96	@echo ${.ALLSRC}
97