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