Annotation of src/share/mk/bsd.lib.mk, Revision 1.58
1.58 ! cgd 1: # $NetBSD: bsd.lib.mk,v 1.57 1995/04/21 20:29:40 jtc 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.9 cgd 135: rm -f ${OBJS}
136: rm -f ${POBJS} profiled/*.o
1.27 pk 137: rm -f ${SOBJS} shared/*.o
1.58 ! cgd 138: rm -f ${LOBJS}
1.30 cgd 139: rm -f lib${LIB}.a lib${LIB}_p.a lib${LIB}_pic.a llib-l${LIB}.ln
1.33 pk 140: rm -f lib${LIB}.so.*.*
1.1 cgd 141: .endif
142:
1.49 cgd 143: cleandir: _SUBDIRUSE clean
1.25 mycroft 144:
1.26 mycroft 145: .if defined(SRCS)
1.23 mycroft 146: afterdepend:
1.1 cgd 147: @(TMP=/tmp/_depend$$$$; \
1.58 ! cgd 148: sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' \
! 149: < .depend > $$TMP; \
1.1 cgd 150: mv $$TMP .depend)
1.26 mycroft 151: .endif
1.1 cgd 152:
153: .if !target(install)
154: .if !target(beforeinstall)
155: beforeinstall:
156: .endif
157:
1.11 mycroft 158: realinstall:
1.13 cgd 159: # ranlib lib${LIB}.a
1.56 cgd 160: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
1.1 cgd 161: ${DESTDIR}${LIBDIR}
162: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.56 cgd 163: chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12 cgd 164: .if !defined(NOPROFILE)
1.13 cgd 165: # ranlib lib${LIB}_p.a
1.56 cgd 166: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.1 cgd 167: lib${LIB}_p.a ${DESTDIR}${LIBDIR}
168: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.56 cgd 169: chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.32 pk 170: .endif
1.39 pk 171: .if !defined(NOPIC)
1.32 pk 172: # ranlib lib${LIB}_pic.a
1.56 cgd 173: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.32 pk 174: lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
175: ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.56 cgd 176: chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.33 pk 177: .endif
1.37 cgd 178: .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
1.33 pk 179: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.37 cgd 180: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
1.12 cgd 181: .endif
1.58 ! cgd 182: .if !defined(NOLINT)
! 183: install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
! 184: llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
! 185: .endif
1.1 cgd 186: .if defined(LINKS) && !empty(LINKS)
187: @set ${LINKS}; \
188: while test $$# -ge 2; do \
189: l=${DESTDIR}$$1; \
190: shift; \
191: t=${DESTDIR}$$1; \
192: shift; \
193: echo $$t -\> $$l; \
194: rm -f $$t; \
195: ln $$l $$t; \
196: done; true
197: .endif
198:
1.49 cgd 199: install: maninstall _SUBDIRUSE
1.11 mycroft 200: maninstall: afterinstall
201: afterinstall: realinstall
202: realinstall: beforeinstall
1.1 cgd 203: .endif
204:
1.10 mycroft 205: .if !defined(NOMAN)
1.1 cgd 206: .include <bsd.man.mk>
1.57 jtc 207: .endif
208:
209: .if !defined(NONLS)
210: .include <bsd.nls.mk>
1.10 mycroft 211: .endif
212:
1.22 mycroft 213: .include <bsd.obj.mk>
1.24 mycroft 214: .include <bsd.dep.mk>
1.49 cgd 215: .include <bsd.subdir.mk>
CVSweb <webmaster@jp.NetBSD.org>