Makefile revision 1.42
1#	$NetBSD: Makefile,v 1.42 1998/06/21 18:43:35 christos Exp $
2
3LIB=	kern
4NOPIC=
5
6M=	${.CURDIR}/arch/${MACHINE_ARCH}
7
8CPPFLAGS=	-I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS}
9
10.if exists ($M/Makefile.inc)
11.PATH:	$M
12.include "$M/Makefile.inc"
13.endif
14
15.if (${MACHINE_ARCH} != "alpha")
16# Quad support
17SRCS+=	adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
18	lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \
19	subdi3.c  ucmpdi2.c udivdi3.c umoddi3.c xordi3.c
20.endif
21
22# Other stuff
23SRCS+=	md5c.c sha1.c pmatch.c
24
25# Files to clean up
26CLEANFILES+= lib${LIB}.o lib${LIB}.po
27
28#
29# Special rules for certain objects
30#
31
32# mcount cannot be compiled with profiling
33mcount.po: mcount.o
34	cp mcount.o mcount.po
35
36# if no machine specific memcpy(3), build one out of bcopy(3).
37.if empty(SRCS:Mmemcpy.S)
38OBJS+=	memcpy.o
39memcpy.o: bcopy.c
40	@echo ${COMPILE.c:Q} -DMEMCOPY ${.ALLSRC} -o ${.TARGET}
41	@${COMPILE.c} -DMEMCOPY ${.ALLSRC} -o ${.TARGET}.o
42	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
43	@rm -f ${.TARGET}.o
44
45memcpy.po: bcopy.c
46	@echo ${COMPILE.c:Q} -DMEMCOPY -pg ${.ALLSRC} -o ${.TARGET}
47	@${COMPILE.c} -DMEMCOPY -pg ${.ALLSRC} -o ${.TARGET}.o
48	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
49	@rm -f ${.TARGET}.o
50
51memcpy.so: bcopy.c
52	@echo ${COMPILE.c:Q} -DMEMCOPY ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}
53	@${COMPILE.c} -DMEMCOPY ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}.o
54	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
55	@rm -f ${.TARGET}.o
56
57LOBJS+= memcpy.ln
58memcpy.ln: bcopy.c
59	${LINT} -DMEMCOPY ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
60	    ${.ALLSRC}
61.endif
62
63# if no machine specific strchr(3), build one out of index(3).
64.if empty(SRCS:Mstrchr.S)
65OBJS+=	strchr.o
66strchr.o: index.c
67	@echo ${COMPILE.c:Q} -DSTRCHR ${.ALLSRC} -o ${.TARGET}
68	@${COMPILE.c} -DSTRCHR ${.ALLSRC} -o ${.TARGET}.o
69	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
70	@rm -f ${.TARGET}.o
71
72strchr.po: index.c
73	@echo ${COMPILE.c:Q} -DSTRCHR -pg ${.ALLSRC} -o ${.TARGET}
74	@${COMPILE.c} -DSTRCHR -pg ${.ALLSRC} -o ${.TARGET}.o
75	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
76	@rm -f ${.TARGET}.o
77
78strchr.so: index.c
79	@echo ${COMPILE.c:Q} -DSTRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}
80	@${COMPILE.c} -DSTRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}.o
81	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
82	@rm -f ${.TARGET}.o
83
84LOBJS+= strchr.ln
85strchr.ln: index.c
86	${LINT} -DSTRCHR ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
87	    ${.ALLSRC}
88.endif
89
90# if no machine specific strrchr(3), build one out of rindex(3).
91.if empty(SRCS:Mstrrchr.S)
92OBJS+=	strrchr.o
93strrchr.o: rindex.c
94	@echo ${COMPILE.c:Q} -DSTRRCHR ${.ALLSRC} -o ${.TARGET}
95	@${COMPILE.c} -DSTRRCHR ${.ALLSRC} -o ${.TARGET}.o
96	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
97	@rm -f ${.TARGET}.o
98
99strrchr.po: rindex.c
100	@echo ${COMPILE.c:Q} -DSTRRCHR -pg ${.ALLSRC} -o ${.TARGET}
101	@${COMPILE.c} -DSTRRCHR -pg ${.ALLSRC} -o ${.TARGET}.o
102	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
103	@rm -f ${.TARGET}.o
104
105strrchr.so: rindex.c
106	@echo ${COMPILE.c:Q} -DSTRRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}
107	@${COMPILE.c} -DSTRRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}.o
108	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
109	@rm -f ${.TARGET}.o
110
111LOBJS+= strrchr.ln
112strrchr.ln: rindex.c
113	${LINT} -DSTRRCHR ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
114	    ${.ALLSRC}
115.endif
116
117# only needed during build
118libinstall::
119
120.include <bsd.lib.mk>
121
122lib${LIB}.o:: ${OBJS}
123	@echo building standard ${LIB} library
124	@rm -f lib${LIB}.o
125	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
126
127POBJS+=	${OBJS:.o=.po} mcount.po
128lib${LIB}.po:: ${POBJS}
129	@echo building profiled ${LIB} library
130	@rm -f lib${LIB}.po
131	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
132