Annotation of src/share/mk/bsd.lib.mk, Revision 1.23
1.23 ! mycroft 1: # from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
! 2: # $Id: $
1.1 cgd 3:
4: .if exists(${.CURDIR}/../Makefile.inc)
5: .include "${.CURDIR}/../Makefile.inc"
6: .endif
7:
8: LIBDIR?= /usr/lib
9: LINTLIBDIR?= /usr/libdata/lint
10: LIBGRP?= bin
11: LIBOWN?= bin
12: LIBMODE?= 444
13:
1.23 ! mycroft 14: STRIP?= -s
1.1 cgd 15:
16: BINGRP?= bin
17: BINOWN?= bin
18: BINMODE?= 555
19:
20: .MAIN: all
21:
22: # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
23: .SUFFIXES:
1.17 mycroft 24: .SUFFIXES: .out .o .po .s .c .cc .C .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0
1.1 cgd 25:
26: .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:
27: nroff -mandoc ${.IMPSRC} > ${.TARGET}
28:
29: .c.o:
30: ${CC} ${CFLAGS} -c ${.IMPSRC}
31: @${LD} -x -r ${.TARGET}
32: @mv a.out ${.TARGET}
33:
34: .c.po:
35: ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
1.17 mycroft 36: @${LD} -X -r ${.TARGET}
37: @mv a.out ${.TARGET}
38:
1.18 mycroft 39: .cc.o .C.o:
1.17 mycroft 40: ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
41: @${LD} -x -r ${.TARGET}
42: @mv a.out ${.TARGET}
43:
1.18 mycroft 44: .cc.po .C.po:
1.17 mycroft 45: ${CXX} -p ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
1.1 cgd 46: @${LD} -X -r ${.TARGET}
47: @mv a.out ${.TARGET}
48:
49: .s.o:
50: ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
51: ${AS} -o ${.TARGET}
52: @${LD} -x -r ${.TARGET}
53: @mv a.out ${.TARGET}
54:
55: .s.po:
56: ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
57: ${AS} -o ${.TARGET}
58: @${LD} -X -r ${.TARGET}
59: @mv a.out ${.TARGET}
60:
1.10 mycroft 61: .if !defined(NOMAN)
1.1 cgd 62: MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
1.10 mycroft 63: .endif
1.1 cgd 64:
65: .if !defined(NOPROFILE)
66: _LIBS=lib${LIB}.a lib${LIB}_p.a
67: .else
68: _LIBS=lib${LIB}.a
69: .endif
70:
71: all: ${_LIBS} ${MANALL}# llib-l${LIB}.ln
72:
1.21 mycroft 73: OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
1.1 cgd 74:
75: lib${LIB}.a:: ${OBJS}
76: @echo building standard ${LIB} library
77: @rm -f lib${LIB}.a
1.16 mycroft 78: @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
1.13 cgd 79: ${RANLIB} lib${LIB}.a
1.1 cgd 80:
81: POBJS+= ${OBJS:.o=.po}
82: lib${LIB}_p.a:: ${POBJS}
83: @echo building profiled ${LIB} library
84: @rm -f lib${LIB}_p.a
1.16 mycroft 85: @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
1.13 cgd 86: ${RANLIB} lib${LIB}_p.a
1.1 cgd 87:
88: llib-l${LIB}.ln: ${SRCS}
89: ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
90:
91: .if !target(clean)
92: clean:
1.9 cgd 93: rm -f a.out Errs errs mklog core ${CLEANFILES}
94: rm -f ${OBJS}
95: rm -f ${POBJS} profiled/*.o
96: rm -f lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
1.1 cgd 97: .endif
98:
99: .if !target(cleandir)
1.23 ! mycroft 100: cleandir: clean
1.1 cgd 101: rm -f ${MANALL} ${.CURDIR}/tags .depend
102: .endif
103:
1.23 ! mycroft 104: .include <bsd.dep.mk>
! 105: afterdepend:
1.1 cgd 106: @(TMP=/tmp/_depend$$$$; \
1.14 cgd 107: sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po:/' < .depend > $$TMP; \
1.1 cgd 108: mv $$TMP .depend)
109:
110: .if !target(install)
111: .if !target(beforeinstall)
112: beforeinstall:
1.22 mycroft 113: @install -d -o root -g wheel -m 755 ${DESTDIR}${LIBDIR}
1.1 cgd 114: .endif
115:
1.11 mycroft 116: realinstall:
1.13 cgd 117: # ranlib lib${LIB}.a
1.8 cgd 118: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
1.1 cgd 119: ${DESTDIR}${LIBDIR}
120: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12 cgd 121: .if !defined(NOPROFILE)
1.13 cgd 122: # ranlib lib${LIB}_p.a
1.8 cgd 123: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1 cgd 124: lib${LIB}_p.a ${DESTDIR}${LIBDIR}
125: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.12 cgd 126: .endif
1.8 cgd 127: # install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1 cgd 128: # llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
129: .if defined(LINKS) && !empty(LINKS)
130: @set ${LINKS}; \
131: while test $$# -ge 2; do \
132: l=${DESTDIR}$$1; \
133: shift; \
134: t=${DESTDIR}$$1; \
135: shift; \
136: echo $$t -\> $$l; \
137: rm -f $$t; \
138: ln $$l $$t; \
139: done; true
140: .endif
141:
1.11 mycroft 142: install: maninstall
143: maninstall: afterinstall
144: afterinstall: realinstall
145: realinstall: beforeinstall
1.1 cgd 146: .endif
147:
148: .if !target(lint)
149: lint:
150: .endif
151:
152: .if !target(tags)
153: tags: ${SRCS}
154: -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \
155: sed "s;\${.CURDIR}/;;" > tags
156: .endif
157:
1.10 mycroft 158: .if !defined(NOMAN)
1.1 cgd 159: .include <bsd.man.mk>
1.10 mycroft 160: .endif
161:
1.22 mycroft 162: .include <bsd.obj.mk>
CVSweb <webmaster@jp.NetBSD.org>