Makefile revision 1.66
1#	$NetBSD: Makefile,v 1.66 2002/10/04 18:39:52 junyoung Exp $
2
3LIB=	kern
4NOPIC=	# defined
5
6.include <bsd.own.mk>
7
8.if defined(MACHINE_ARCH) && !empty(MACHINE_ARCH) && \
9    exists(${KERNDIR}/arch/${MACHINE_ARCH})
10ARCHSUBDIR=     ${MACHINE_ARCH}
11.elif defined(MACHINE_CPU) && !empty(MACHINE_CPU) && \
12    exists(${KERNDIR}/arch/${MACHINE_CPU}) 
13ARCHSUBDIR=     ${MACHINE_CPU}
14.else
15.BEGIN:
16	@echo no ARCHSUBDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
17	@false
18.endif
19
20M= ${KERNDIR}/arch/${ARCHSUBDIR}
21
22CPPFLAGS=	-I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS}
23
24.PATH.c: ${KERNDIR}
25.if exists ($M/Makefile.inc)
26.PATH.c: $M
27.PATH.S: $M
28.include "$M/Makefile.inc"
29.endif
30
31.if (${MACHINE_ARCH} != "alpha")
32# Quad support
33SRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
34	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
35	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
36.endif
37
38# Other stuff
39SRCS+=	__cmsg_alignbytes.c inet_addr.c intoa.c md4c.c md5c.c sha1.c pmatch.c
40SRCS+=	_que.c arc4random.c
41
42.if (${MACHINE_ARCH} == "i386")
43SRCS+=	strstr.c
44.endif
45
46# Files to clean up
47CLEANFILES+= lib${LIB}.o lib${LIB}.po
48
49#
50# Special rules for certain objects
51#
52
53# mcount cannot be compiled with profiling
54mcount.po: mcount.o
55	cp mcount.o mcount.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
79POBJS+=	mcount.po
80
81# only needed during build
82libinstall::
83
84.undef DESTDIR
85.include <bsd.lib.mk>
86
87lib${LIB}.o:: ${OBJS}
88	@echo building standard ${LIB} library
89	@rm -f lib${LIB}.o
90	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
91
92lib${LIB}.po:: ${POBJS}
93	@echo building profiled ${LIB} library
94	@rm -f lib${LIB}.po
95	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
96
97showsources: ${SRCS}
98	@echo ${.ALLSRC}
99