1# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
| 1# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 2# $Id: bsd.lib.mk,v 1.39 1994/06/15 10:14:40 ache Exp $ 3#
|
2 3.if exists(${.CURDIR}/../Makefile.inc) 4.include "${.CURDIR}/../Makefile.inc" 5.endif 6
| 4 5.if exists(${.CURDIR}/../Makefile.inc) 6.include "${.CURDIR}/../Makefile.inc" 7.endif 8
|
| 9.if exists(${.CURDIR}/shlib_version) 10SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major 11SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor 12.endif 13 14.if defined(DESTDIR) 15CFLAGS+= -I${DESTDIR}/usr/include 16CXXINCLUDES+= -I${DESTDIR}/usr/include/${CXX} 17.endif 18INSTALL?= install
|
7LIBDIR?= /usr/lib 8LINTLIBDIR?= /usr/libdata/lint 9LIBGRP?= bin 10LIBOWN?= bin 11LIBMODE?= 444 12 13STRIP?= -s 14 15BINGRP?= bin 16BINOWN?= bin 17BINMODE?= 555 18 19.MAIN: all 20 21# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
| 19LIBDIR?= /usr/lib 20LINTLIBDIR?= /usr/libdata/lint 21LIBGRP?= bin 22LIBOWN?= bin 23LIBMODE?= 444 24 25STRIP?= -s 26 27BINGRP?= bin 28BINOWN?= bin 29BINMODE?= 555 30 31.MAIN: all 32 33# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
|
| 34# .so used for PIC object files
|
22.SUFFIXES:
| 35.SUFFIXES:
|
23.SUFFIXES: .out .o .po .s .c .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0 .m4
| 36.SUFFIXES: .out .o .po .so .s .S .c .cc .cxx .m .C .f .y .l
|
24
| 37
|
25.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: 26 nroff -man ${.IMPSRC} > ${.TARGET} 27
| |
28.c.o:
| 38.c.o:
|
29 ${CC} ${CFLAGS} -c ${.IMPSRC}
| 39 ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
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
| 40 @${LD} -x -r ${.TARGET} 41 @mv a.out ${.TARGET} 42 43.c.po: 44 ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 45 @${LD} -X -r ${.TARGET} 46 @mv a.out ${.TARGET} 47
|
| 48.c.so: 49 ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 50 51.cc.o .cxx.o .C.o: 52 ${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 53 @${LD} -x -r ${.TARGET} 54 @mv a.out ${.TARGET} 55 56.cc.po .C.po .cxx.o: 57 ${CXX} -p ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 58 @${LD} -X -r ${.TARGET} 59 @mv a.out ${.TARGET} 60 61.cc.so .C.so: 62 ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 63 64.f.o: 65 ${FC} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 66 @${LD} -x -r ${.TARGET} 67 @mv a.out ${.TARGET} 68 69.f.po: 70 ${FC} -p ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 71 @${LD} -X -r ${.TARGET} 72 @mv a.out ${.TARGET} 73 74.f.so: 75 ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 76
|
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
| 77.s.o: 78 ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 79 ${AS} -o ${.TARGET} 80 @${LD} -x -r ${.TARGET} 81 @mv a.out ${.TARGET} 82 83.s.po: 84 ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 85 ${AS} -o ${.TARGET} 86 @${LD} -X -r ${.TARGET} 87 @mv a.out ${.TARGET} 88
|
50MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 51manpages: ${MANALL}
| 89.s.so: 90 ${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 91 ${AS} -k -o ${.TARGET}
|
52
| 92
|
| 93.S.o: 94 ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 95 ${AS} -o ${.TARGET} 96 97.S.po: 98 ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 99 ${AS} -o ${.TARGET} 100 101.S.so: 102 ${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 103 ${AS} -k -o ${.TARGET} 104 105.m.po: 106 ${CC} ${CFLAGS} -p -c ${.IMPSRC} -o ${.TARGET} 107 @${LD} -X -r ${.TARGET} 108 @mv a.out ${.TARGET} 109 110.m.o: 111 ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 112 @${LD} -X -r ${.TARGET} 113 @mv a.out ${.TARGET} 114
|
53.if !defined(NOPROFILE) 54_LIBS=lib${LIB}.a lib${LIB}_p.a 55.else 56_LIBS=lib${LIB}.a 57.endif 58
| 115.if !defined(NOPROFILE) 116_LIBS=lib${LIB}.a lib${LIB}_p.a 117.else 118_LIBS=lib${LIB}.a 119.endif 120
|
59all: ${_LIBS} # llib-l${LIB}.ln 60.if !defined(NOMAN) 61all: ${MANALL}
| 121.if !defined(NOPIC) 122.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) 123_LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
62.endif
| 124.endif
|
| 125.if defined(INSTALL_PIC_ARCHIVE) 126_LIBS+=lib${LIB}_pic.a 127.endif 128.endif
|
63
| 129
|
64OBJS+= ${SRCS:R:S/$/.o/g}
| 130.if !defined(PICFLAG) 131PICFLAG=-fpic 132.endif
|
65
| 133
|
| 134all: ${_LIBS} # llib-l${LIB}.ln 135 136OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 137
|
66lib${LIB}.a:: ${OBJS} 67 @echo building standard ${LIB} library 68 @rm -f lib${LIB}.a 69 @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
| 138lib${LIB}.a:: ${OBJS} 139 @echo building standard ${LIB} library 140 @rm -f lib${LIB}.a 141 @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
|
70 ranlib lib${LIB}.a
| 142 ${RANLIB} lib${LIB}.a
|
71 72POBJS+= ${OBJS:.o=.po} 73lib${LIB}_p.a:: ${POBJS} 74 @echo building profiled ${LIB} library 75 @rm -f lib${LIB}_p.a 76 @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
| 143 144POBJS+= ${OBJS:.o=.po} 145lib${LIB}_p.a:: ${POBJS} 146 @echo building profiled ${LIB} library 147 @rm -f lib${LIB}_p.a 148 @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
|
77 ranlib lib${LIB}_p.a
| 149 ${RANLIB} lib${LIB}_p.a
|
78
| 150
|
| 151.if defined(DESTDIR) 152LDDESTDIR?= -L${DESTDIR}/usr/lib 153.endif 154 155.if defined(CPLUSPLUSLIB) && !make(clean) && !make(cleandir) 156SOBJS+= ${DESTDIR}/usr/lib/c++rt0.o 157.endif 158 159SOBJS+= ${OBJS:.o=.so} 160lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS} 161 @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\) 162 @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} 163 @$(LD) -Bshareable \ 164 -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \ 165 ${SOBJS} ${LDDESTDIR} ${LDADD} ${SHARED_LDADD} 166 167lib${LIB}_pic.a:: ${SOBJS} 168 @echo building special pic ${LIB} library 169 @rm -f lib${LIB}_pic.a 170 @${AR} cTq lib${LIB}_pic.a ${SOBJS} ${LDADD} 171 ${RANLIB} lib${LIB}_pic.a 172
|
79llib-l${LIB}.ln: ${SRCS} 80 ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} 81 82.if !target(clean) 83clean:
| 173llib-l${LIB}.ln: ${SRCS} 174 ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} 175 176.if !target(clean) 177clean:
|
84 rm -f ${OBJS} 85 rm -f ${POBJS} 86 rm -f a.out [Ee]rrs mklog ${CLEANFILES} \ 87 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
| 178 rm -f a.out Errs errs mklog ${CLEANFILES} ${OBJS} 179 rm -f lib${LIB}.a llib-l${LIB}.ln 180 rm -f ${POBJS} profiled/*.o lib${LIB}_p.a 181 rm -f ${SOBJS} shared/*.o 182 rm -f lib${LIB}.so.*.* lib${LIB}_pic.a
|
88.endif 89 90.if !target(cleandir) 91cleandir:
| 183.endif 184 185.if !target(cleandir) 186cleandir:
|
92 rm -f ${OBJS} 93 rm -f ${POBJS} 94 rm -f a.out [Ee]rrs mklog ${CLEANFILES} \ 95 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 96 rm -f ${MANALL} .depend
| 187 rm -f a.out Errs errs mklog ${CLEANFILES} ${OBJS} 188 rm -f lib${LIB}.a llib-l${LIB}.ln 189 rm -f ${.CURDIR}/tags .depend 190 rm -f ${POBJS} profiled/*.o lib${LIB}_p.a 191 rm -f ${SOBJS} shared/*.o 192 rm -f lib${LIB}.so.*.* lib${LIB}_pic.a 193 cd ${.CURDIR}; rm -rf obj;
|
97.endif 98
| 194.endif 195
|
99.if !target(depend) 100depend: .depend 101.depend: ${SRCS} 102 mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC}
| 196.if defined(SRCS) 197afterdepend:
|
103 @(TMP=/tmp/_depend$$$$; \
| 198 @(TMP=/tmp/_depend$$$$; \
|
104 sed -e 's/^\([^\.]*\).o *:/\1.o \1.po:/' < .depend > $$TMP; \ 105 mv $$TMP .depend)
| 199 sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < .depend > $$TMP; \ 200 mv $$TMP .depend)
|
106.endif 107 108.if !target(install) 109.if !target(beforeinstall) 110beforeinstall: 111.endif 112 113realinstall: beforeinstall
| 201.endif 202 203.if !target(install) 204.if !target(beforeinstall) 205beforeinstall: 206.endif 207 208realinstall: beforeinstall
|
114 ranlib lib${LIB}.a 115 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
| 209 ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
|
116 ${DESTDIR}${LIBDIR} 117 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 118.if !defined(NOPROFILE)
| 210 ${DESTDIR}${LIBDIR} 211 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 212.if !defined(NOPROFILE)
|
119 ranlib lib${LIB}_p.a 120 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
| 213 ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
121 lib${LIB}_p.a ${DESTDIR}${LIBDIR} 122 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 123.endif
| 214 lib${LIB}_p.a ${DESTDIR}${LIBDIR} 215 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 216.endif
|
124# install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 125# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
| 217.if !defined(NOPIC) 218.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) 219 ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 220 lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR} 221.endif 222.if defined(INSTALL_PIC_ARCHIVE) 223 ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 224 lib${LIB}_pic.a ${DESTDIR}${LIBDIR} 225 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a 226.endif 227.endif
|
126.if defined(LINKS) && !empty(LINKS) 127 @set ${LINKS}; \ 128 while test $$# -ge 2; do \ 129 l=${DESTDIR}$$1; \ 130 shift; \ 131 t=${DESTDIR}$$1; \ 132 shift; \ 133 echo $$t -\> $$l; \ 134 rm -f $$t; \ 135 ln $$l $$t; \ 136 done; true 137.endif 138 139install: afterinstall
| 228.if defined(LINKS) && !empty(LINKS) 229 @set ${LINKS}; \ 230 while test $$# -ge 2; do \ 231 l=${DESTDIR}$$1; \ 232 shift; \ 233 t=${DESTDIR}$$1; \ 234 shift; \ 235 echo $$t -\> $$l; \ 236 rm -f $$t; \ 237 ln $$l $$t; \ 238 done; true 239.endif 240 241install: afterinstall
|
140afterinstall: realinstall
| |
141.if !defined(NOMAN)
| 242.if !defined(NOMAN)
|
142afterinstall: maninstall
| 243afterinstall: realinstall maninstall 244.else 245afterinstall: realinstall
|
143.endif 144.endif 145 146.if !target(lint) 147lint: 148.endif 149 150.if !target(tags) 151tags: ${SRCS}
| 246.endif 247.endif 248 249.if !target(lint) 250lint: 251.endif 252 253.if !target(tags) 254tags: ${SRCS}
|
152 -ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ 153 sed "s;\${.CURDIR}/;;" > ${.CURDIR}/tags
| 255 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ 256 sed "s;\${.CURDIR}/;;" > tags
|
154.endif 155
| 257.endif 258
|
| 259.if !defined(NOMAN)
|
156.include <bsd.man.mk>
| 260.include <bsd.man.mk>
|
| 261.elif !target(maninstall) 262maninstall: 263.endif 264
|
157.if !target(obj) 158.if defined(NOOBJ) 159obj: 160.else 161obj: 162 @cd ${.CURDIR}; rm -rf obj; \
| 265.if !target(obj) 266.if defined(NOOBJ) 267obj: 268.else 269obj: 270 @cd ${.CURDIR}; rm -rf obj; \
|
163 here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \
| 271 here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
|
164 echo "$$here -> $$dest"; ln -s $$dest obj; \ 165 if test -d /usr/obj -a ! -d $$dest; then \ 166 mkdir -p $$dest; \ 167 else \ 168 true; \ 169 fi; 170.endif 171.endif
| 272 echo "$$here -> $$dest"; ln -s $$dest obj; \ 273 if test -d /usr/obj -a ! -d $$dest; then \ 274 mkdir -p $$dest; \ 275 else \ 276 true; \ 277 fi; 278.endif 279.endif
|
| 280 281.include <bsd.dep.mk>
|
| |