Annotation of src/share/mk/bsd.lib.mk, Revision 1.61
1.61 ! cgd 1: # $NetBSD: bsd.lib.mk,v 1.60 1995/06/27 20:37:29 cgd Exp $
1.50 cgd 2: # @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
1.1 cgd 3:
4: .if exists(${.CURDIR}/../Makefile.inc)
5: .include "${.CURDIR}/../Makefile.inc"
6: .endif
1.54 cgd 7:
8: .include <bsd.own.mk> # for 'NOPIC' definition
1.1 cgd 9:
1.35 pk 10: .if exists(${.CURDIR}/shlib_version)
1.37 cgd 11: SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
12: SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
1.35 pk 13: .endif
14:
1.1 cgd 15: .MAIN: all
16:
1.58 cgd 17: # prefer .S to a .c, add .po, remove stuff not used in the BSD libraries.
18: # .so used for PIC object files. .ln used for lint output files.
1.1 cgd 19: .SUFFIXES:
1.58 cgd 20: .SUFFIXES: .out .o .po .so .S .s .c .cc .C .f .y .l .ln .m4
1.1 cgd 21:
22: .c.o:
1.55 mycroft 23: ${COMPILE.c} ${.IMPSRC}
1.1 cgd 24: @${LD} -x -r ${.TARGET}
25: @mv a.out ${.TARGET}
26:
27: .c.po:
1.55 mycroft 28: ${COMPILE.c} -p ${.IMPSRC} -o ${.TARGET}
1.17 mycroft 29: @${LD} -X -r ${.TARGET}
30: @mv a.out ${.TARGET}
31:
1.27 pk 32: .c.so:
1.55 mycroft 33: ${COMPILE.c} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}
1.44 mycroft 34: @${LD} -x -r ${.TARGET}
35: @mv a.out ${.TARGET}
1.27 pk 36:
1.58 cgd 37: .c.ln:
38: ${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} -i ${.IMPSRC}
39:
1.18 mycroft 40: .cc.o .C.o:
1.55 mycroft 41: ${COMPILE.cc} ${.IMPSRC}
1.17 mycroft 42: @${LD} -x -r ${.TARGET}
43: @mv a.out ${.TARGET}
44:
1.18 mycroft 45: .cc.po .C.po:
1.55 mycroft 46: ${COMPILE.cc} -p ${.IMPSRC} -o ${.TARGET}
1.28 cgd 47: @${LD} -X -r ${.TARGET}
48: @mv a.out ${.TARGET}
49:
50: .cc.so .C.so:
1.55 mycroft 51: ${COMPILE.cc} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}
1.44 mycroft 52: @${LD} -x -r ${.TARGET}
53: @mv a.out ${.TARGET}
1.1 cgd 54:
1.40 cgd 55: .S.o .s.o:
1.52 mycroft 56: ${CPP} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
1.1 cgd 57: ${AS} -o ${.TARGET}
58: @${LD} -x -r ${.TARGET}
59: @mv a.out ${.TARGET}
60:
1.40 cgd 61: .S.po .s.po:
1.52 mycroft 62: ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
1.1 cgd 63: ${AS} -o ${.TARGET}
64: @${LD} -X -r ${.TARGET}
65: @mv a.out ${.TARGET}
66:
1.40 cgd 67: .S.so .s.so:
1.52 mycroft 68: ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
1.27 pk 69: ${AS} -k -o ${.TARGET}
1.44 mycroft 70: @${LD} -x -r ${.TARGET}
71: @mv a.out ${.TARGET}
1.27 pk 72:
1.58 cgd 73: .if !defined(PICFLAG)
74: PICFLAG=-fpic
75: .endif
76:
1.1 cgd 77: .if !defined(NOPROFILE)
78: _LIBS=lib${LIB}.a lib${LIB}_p.a
79: .else
80: _LIBS=lib${LIB}.a
81: .endif
82:
1.27 pk 83: .if !defined(NOPIC)
84: _LIBS+=lib${LIB}_pic.a
1.37 cgd 85: .if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
86: _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
1.27 pk 87: .endif
1.35 pk 88: .endif
1.27 pk 89:
1.58 cgd 90: .if !defined(NOLINT)
91: _LIBS+=llib-l${LIB}.ln
1.27 pk 92: .endif
93:
1.58 cgd 94: all: ${_LIBS} _SUBDIRUSE
1.1 cgd 95:
1.21 mycroft 96: OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
1.1 cgd 97:
98: lib${LIB}.a:: ${OBJS}
99: @echo building standard ${LIB} library
100: @rm -f lib${LIB}.a
1.45 pk 101: @${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort`
1.13 cgd 102: ${RANLIB} lib${LIB}.a
1.1 cgd 103:
104: POBJS+= ${OBJS:.o=.po}
105: lib${LIB}_p.a:: ${POBJS}
106: @echo building profiled ${LIB} library
107: @rm -f lib${LIB}_p.a
1.45 pk 108: @${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort`
1.13 cgd 109: ${RANLIB} lib${LIB}_p.a
1.1 cgd 110:
1.27 pk 111: SOBJS+= ${OBJS:.o=.so}
112: lib${LIB}_pic.a:: ${SOBJS}
113: @echo building shared object ${LIB} library
114: @rm -f lib${LIB}_pic.a
1.45 pk 115: @${AR} cq lib${LIB}_pic.a `lorder ${SOBJS} | tsort`
1.27 pk 116: ${RANLIB} lib${LIB}_pic.a
117:
1.42 mycroft 118: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD}
1.38 cgd 119: @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
1.37 cgd 120: @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
1.53 pk 121: $(LD) -x -Bshareable -Bforcearchive \
1.42 mycroft 122: -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD}
1.35 pk 123:
1.58 cgd 124: LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
125: # the following looks XXX to me... -- cgd
126: LLIBS?= -lc
127: llib-l${LIB}.ln: ${LOBJS}
128: @echo building llib-l${LIB}.ln
129: @rm -f llib-l${LIB}.ln
130: @${LINT} -C${LIB} ${LOBJS} ${LLIBS}
1.1 cgd 131:
132: .if !target(clean)
1.49 cgd 133: clean: _SUBDIRUSE
1.48 mycroft 134: rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59 cgd 135: rm -f lib${LIB}.a ${OBJS}
136: rm -f lib${LIB}_p.a ${POBJS}
1.61 ! cgd 137: rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS}
1.59 cgd 138: rm -f llib-l${LIB}.ln ${LOBJS}
1.1 cgd 139: .endif
140:
1.49 cgd 141: cleandir: _SUBDIRUSE clean
1.25 mycroft 142:
1.26 mycroft 143: .if defined(SRCS)
1.23 mycroft 144: afterdepend:
1.1 cgd 145: @(TMP=/tmp/_depend$$$$; \
1.58 cgd 146: sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' \
147: < .depend > $$TMP; \
1.1 cgd 148: mv $$TMP .depend)
1.26 mycroft 149: .endif
1.1 cgd 150:
151: .if !target(install)
152: .if !target(beforeinstall)
153: beforeinstall:
154: .endif
155:
1.11 mycroft 156: realinstall:
1.13 cgd 157: # ranlib lib${LIB}.a
1.56 cgd 158: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
1.1 cgd 159: ${DESTDIR}${LIBDIR}
160: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.56 cgd 161: chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12 cgd 162: .if !defined(NOPROFILE)
1.13 cgd 163: # ranlib lib${LIB}_p.a
1.56 cgd 164: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.1 cgd 165: lib${LIB}_p.a ${DESTDIR}${LIBDIR}
166: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.56 cgd 167: chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.32 pk 168: .endif
1.39 pk 169: .if !defined(NOPIC)
1.32 pk 170: # ranlib lib${LIB}_pic.a
1.56 cgd 171: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.32 pk 172: lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
173: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.56 cgd 174: chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.33 pk 175: .endif
1.37 cgd 176: .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
1.33 pk 177: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.37 cgd 178: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
1.12 cgd 179: .endif
1.58 cgd 180: .if !defined(NOLINT)
181: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
182: llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
183: .endif
1.1 cgd 184: .if defined(LINKS) && !empty(LINKS)
185: @set ${LINKS}; \
186: while test $$# -ge 2; do \
187: l=${DESTDIR}$$1; \
188: shift; \
189: t=${DESTDIR}$$1; \
190: shift; \
191: echo $$t -\> $$l; \
192: rm -f $$t; \
193: ln $$l $$t; \
194: done; true
195: .endif
196:
1.49 cgd 197: install: maninstall _SUBDIRUSE
1.11 mycroft 198: maninstall: afterinstall
199: afterinstall: realinstall
200: realinstall: beforeinstall
1.1 cgd 201: .endif
202:
1.10 mycroft 203: .if !defined(NOMAN)
1.1 cgd 204: .include <bsd.man.mk>
1.57 jtc 205: .endif
206:
207: .if !defined(NONLS)
208: .include <bsd.nls.mk>
1.10 mycroft 209: .endif
210:
1.22 mycroft 211: .include <bsd.obj.mk>
1.24 mycroft 212: .include <bsd.dep.mk>
1.49 cgd 213: .include <bsd.subdir.mk>
CVSweb <webmaster@jp.NetBSD.org>