Makefile revision 1.44
1#	$NetBSD: Makefile,v 1.44 1998/07/31 23:44:41 perry 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 memcpy(3), build one out of bcopy(3).
64.if empty(SRCS:Mmemmove.S)
65OBJS+=	memmove.o
66memmove.o: bcopy.c
67	@echo ${COMPILE.c:Q} -DMEMMOVE ${.ALLSRC} -o ${.TARGET}
68	@${COMPILE.c} -DMEMMOVE ${.ALLSRC} -o ${.TARGET}.o
69	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
70	@rm -f ${.TARGET}.o
71
72memmove.po: bcopy.c
73	@echo ${COMPILE.c:Q} -DMEMMOVE -pg ${.ALLSRC} -o ${.TARGET}
74	@${COMPILE.c} -DMEMMOVE -pg ${.ALLSRC} -o ${.TARGET}.o
75	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
76	@rm -f ${.TARGET}.o
77
78memmove.so: bcopy.c
79	@echo ${COMPILE.c:Q} -DMEMMOVE ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}
80	@${COMPILE.c} -DMEMMOVE ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}.o
81	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
82	@rm -f ${.TARGET}.o
83
84LOBJS+= memmove.ln
85memmove.ln: bcopy.c
86	${LINT} -DMEMMOVE ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
87	    ${.ALLSRC}
88.endif
89
90# if no machine specific strchr(3), build one out of index(3).
91.if empty(SRCS:Mstrchr.S)
92OBJS+=	strchr.o
93strchr.o: index.c
94	@echo ${COMPILE.c:Q} -DSTRCHR ${.ALLSRC} -o ${.TARGET}
95	@${COMPILE.c} -DSTRCHR ${.ALLSRC} -o ${.TARGET}.o
96	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
97	@rm -f ${.TARGET}.o
98
99strchr.po: index.c
100	@echo ${COMPILE.c:Q} -DSTRCHR -pg ${.ALLSRC} -o ${.TARGET}
101	@${COMPILE.c} -DSTRCHR -pg ${.ALLSRC} -o ${.TARGET}.o
102	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
103	@rm -f ${.TARGET}.o
104
105strchr.so: index.c
106	@echo ${COMPILE.c:Q} -DSTRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}
107	@${COMPILE.c} -DSTRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}.o
108	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
109	@rm -f ${.TARGET}.o
110
111LOBJS+= strchr.ln
112strchr.ln: index.c
113	${LINT} -DSTRCHR ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
114	    ${.ALLSRC}
115.endif
116
117# if no machine specific strrchr(3), build one out of rindex(3).
118.if empty(SRCS:Mstrrchr.S)
119OBJS+=	strrchr.o
120strrchr.o: rindex.c
121	@echo ${COMPILE.c:Q} -DSTRRCHR ${.ALLSRC} -o ${.TARGET}
122	@${COMPILE.c} -DSTRRCHR ${.ALLSRC} -o ${.TARGET}.o
123	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
124	@rm -f ${.TARGET}.o
125
126strrchr.po: rindex.c
127	@echo ${COMPILE.c:Q} -DSTRRCHR -pg ${.ALLSRC} -o ${.TARGET}
128	@${COMPILE.c} -DSTRRCHR -pg ${.ALLSRC} -o ${.TARGET}.o
129	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
130	@rm -f ${.TARGET}.o
131
132strrchr.so: rindex.c
133	@echo ${COMPILE.c:Q} -DSTRRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}
134	@${COMPILE.c} -DSTRRCHR ${CPICFLAGS} ${.ALLSRC} -o ${.TARGET}.o
135	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
136	@rm -f ${.TARGET}.o
137
138LOBJS+= strrchr.ln
139strrchr.ln: rindex.c
140	${LINT} -DSTRRCHR ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
141	    ${.ALLSRC}
142.endif
143
144POBJS+=	${OBJS:.o=.po} mcount.po
145
146# only needed during build
147libinstall::
148
149.include <bsd.lib.mk>
150
151lib${LIB}.o:: ${OBJS}
152	@echo building standard ${LIB} library
153	@rm -f lib${LIB}.o
154	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
155
156lib${LIB}.po:: ${POBJS}
157	@echo building profiled ${LIB} library
158	@rm -f lib${LIB}.po
159	@${LD} -r -o lib${LIB}.po `NM=${NM} ${LORDER} ${POBJS} | ${TSORT}`
160