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