Makefile revision 1.38
1#	$NetBSD: Makefile,v 1.38 1998/01/21 21:23:18 cgd 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
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 strchr(3), build one out of index(3).
37.if empty(SRCS:Mstrchr.S)
38OBJS+=	strchr.o
39strchr.o: index.c
40	${COMPILE.c} -DSTRCHR ${.ALLSRC} -o ${.TARGET}
41	@${LD} -x -r ${.TARGET}
42	@mv a.out ${.TARGET}
43
44strchr.po: index.c
45	${COMPILE.c} -DSTRCHR -p ${.ALLSRC} -o ${.TARGET}
46	@${LD} -X -r ${.TARGET}
47	@mv a.out ${.TARGET}
48
49strchr.so: index.c
50	${COMPILE.c} ${PICFLAG} -DPIC -DSTRCHR ${.ALLSRC} -o ${.TARGET}
51
52LOBJS+= strchr.ln
53strchr.ln: index.c
54	${LINT} -DSTRCHR ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
55	    ${.ALLSRC}
56.endif
57
58# if no machine specific strrchr(3), build one out of rindex(3).
59.if empty(SRCS:Mstrrchr.S)
60OBJS+=	strrchr.o
61strrchr.o: rindex.c
62	${COMPILE.c} -DSTRRCHR ${.ALLSRC} -o ${.TARGET}
63	@${LD} -x -r ${.TARGET}
64	@mv a.out ${.TARGET}
65
66strrchr.po: rindex.c
67	${COMPILE.c} -DSTRRCHR -p ${.ALLSRC} -o ${.TARGET}
68	@${LD} -X -r ${.TARGET}
69	@mv a.out ${.TARGET}
70
71strrchr.so: rindex.c
72	${COMPILE.c} ${PICFLAG} -DPIC -DSTRRCHR ${.ALLSRC} -o ${.TARGET}
73
74LOBJS+= strrchr.ln
75strrchr.ln: rindex.c
76	${LINT} -DSTRRCHR ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i -o ${.TARGET} \
77	    ${.ALLSRC}
78.endif
79
80# only needed during build
81libinstall::
82
83.include <bsd.lib.mk>
84
85lib${LIB}.o:: ${OBJS}
86	@echo building standard ${LIB} library
87	@rm -f lib${LIB}.o
88	@${LD} -r -o lib${LIB}.o `NM=${NM} ${LORDER} ${OBJS} | ${TSORT}`
89
90POBJS+=	${OBJS:.o=.po} mcount.po
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