Makefile revision 1.60
1#	$NetBSD: Makefile,v 1.60 2001/02/18 22:38:50 enami Exp $
2
3LIB=	kern
4MKPIC=	no
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
40
41# Files to clean up
42CLEANFILES+= lib${LIB}.o lib${LIB}.po
43
44#
45# Special rules for certain objects
46#
47
48# mcount cannot be compiled with profiling
49mcount.po: mcount.o
50	cp mcount.o mcount.po
51
52# XXX these stub builds should be cleaned up even further.
53
54# if no machine specific memcpy(3), build one out of bcopy(3) based stub.
55.if empty(SRCS:Mmemcpy.S)
56SRCS+=	memcpy.c
57.endif
58
59# if no machine specific memmove(3), build one out of bcopy(3) based stub.
60.if empty(SRCS:Mmemmove.S)
61SRCS+=	memmove.c
62.endif
63
64# if no machine specific strchr(3), build one out of index(3) based stub.
65.if empty(SRCS:Mstrchr.S)
66SRCS+=	strchr.c
67.endif
68
69# if no machine specific strrchr(3), build one out of rindex(3) based stub.
70.if empty(SRCS:Mstrrchr.S)
71SRCS+=	strrchr.c
72.endif
73
74POBJS+=	mcount.po
75
76# only needed during build
77libinstall::
78
79.include <bsd.lib.mk>
80
81lib${LIB}.o:: ${OBJS}
82	@echo building standard ${LIB} library
83	@rm -f lib${LIB}.o
84	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
85
86lib${LIB}.po:: ${POBJS}
87	@echo building profiled ${LIB} library
88	@rm -f lib${LIB}.po
89	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
90