1*51824Smarc# @(#)bsd.lib.mk 5.26.1.1 (Berkeley) 12/02/91 240581Sbostic 341461Sbostic.if exists(${.CURDIR}/../Makefile.inc) 441461Sbostic.include "${.CURDIR}/../Makefile.inc" 541461Sbostic.endif 641461Sbostic 741600SbosticLIBDIR?= /usr/lib 841600SbosticLINTLIBDIR?= /usr/libdata/lint 941600SbosticLIBGRP?= bin 1041600SbosticLIBOWN?= bin 1141600SbosticLIBMODE?= 444 1241600Sbostic 1343473SbosticSTRIP?= -s 1443473Sbostic 1543473SbosticBINGRP?= bin 1643473SbosticBINOWN?= bin 1743473SbosticBINMODE?= 555 1843473Sbostic 1940581Sbostic.MAIN: all 2040581Sbostic 2141600Sbostic# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries 2240581Sbostic.SUFFIXES: 2341873Sbostic.SUFFIXES: .out .o .po .s .c .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0 2441558Sbostic 2541867Sbostic.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: 26*51824Smarc /usr/old/bin/nroff -mandoc ${.IMPSRC} > ${.TARGET} 2741867Sbostic 2840581Sbostic.c.o: 2940581Sbostic ${CC} ${CFLAGS} -c ${.IMPSRC} 3040581Sbostic @${LD} -x -r ${.TARGET} 3141461Sbostic @mv a.out ${.TARGET} 3240581Sbostic 3340581Sbostic.c.po: 3440581Sbostic ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 3540581Sbostic @${LD} -X -r ${.TARGET} 3641461Sbostic @mv a.out ${.TARGET} 3740581Sbostic 38*51824Smarc.if (${MACHINE} == "mips") 39*51824SmarcNOPROFILE=1 4040581Sbostic.s.o: 41*51824Smarc ${AS} ${CFLAGS:M-[ID]*} ${AINC} -o ${.TARGET} ${.IMPSRC} 42*51824Smarc @${LD} -x -r ${.TARGET} 43*51824Smarc @mv a.out ${.TARGET} 44*51824Smarc.else 45*51824Smarc.s.o: 4640581Sbostic ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 4740581Sbostic ${AS} -o ${.TARGET} 4840581Sbostic @${LD} -x -r ${.TARGET} 4941461Sbostic @mv a.out ${.TARGET} 5040581Sbostic 5140581Sbostic.s.po: 5240581Sbostic ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 5340581Sbostic ${AS} -o ${.TARGET} 5440581Sbostic @${LD} -X -r ${.TARGET} 5541461Sbostic @mv a.out ${.TARGET} 56*51824Smarc.endif 5740581Sbostic 5840581SbosticMANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 5940581Sbostic 6048878Sbostic.if !defined(NOPROFILE) 6148878Sbostic_LIBS=lib${LIB}.a lib${LIB}_p.a 6248878Sbostic.else 6348878Sbostic_LIBS=lib${LIB}.a 6448878Sbostic.endif 6540581Sbostic 66*51824Smarcall: ${_LIBS} ${MANALL}# llib-l${LIB}.ln 6748878Sbostic 6846047SbosticOBJS+= ${SRCS:R:S/$/.o/g} 6946047Sbostic 7040581Sbosticlib${LIB}.a:: ${OBJS} 7140581Sbostic @echo building standard ${LIB} library 7243509Sbostic @rm -f lib${LIB}.a 73*51824Smarc.if (${MACHINE} == "mips") 74*51824Smarc @${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} 75*51824Smarc.else 7647601Sbostic @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} 77*51824Smarc.endif 7846871Sbostic ranlib lib${LIB}.a 7940581Sbostic 8042550SbosticPOBJS+= ${OBJS:.o=.po} 8140581Sbosticlib${LIB}_p.a:: ${POBJS} 8240581Sbostic @echo building profiled ${LIB} library 8344309Sbostic @rm -f lib${LIB}_p.a 8447601Sbostic @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} 8546871Sbostic ranlib lib${LIB}_p.a 8640581Sbostic 8740581Sbosticllib-l${LIB}.ln: ${SRCS} 8841461Sbostic ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} 8940581Sbostic 9041555Sbostic.if !target(clean) 9141555Sbosticclean: 9240581Sbostic rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 9340581Sbostic profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 9441555Sbostic.endif 9540581Sbostic 9641555Sbostic.if !target(cleandir) 9741555Sbosticcleandir: 9841555Sbostic rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 9941555Sbostic profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 10042550Sbostic rm -f ${MANALL} ${.CURDIR}/tags .depend 10141555Sbostic.endif 10240581Sbostic 10341555Sbostic.if !target(depend) 10441555Sbosticdepend: .depend 10541555Sbostic.depend: ${SRCS} 10641461Sbostic mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC} 10745937Sbostic @(TMP=/tmp/_depend$$$$; \ 10843508Sbostic sed -e 's/^\([^\.]*\).o:/\1.o \1.po:/' < .depend > $$TMP; \ 10943508Sbostic mv $$TMP .depend) 11041555Sbostic.endif 11140581Sbostic 11241555Sbostic.if !target(install) 11341555Sbostic.if !target(beforeinstall) 11441555Sbosticbeforeinstall: 11541555Sbostic.endif 11641555Sbostic 11741555Sbosticrealinstall: beforeinstall 11841600Sbostic ranlib lib${LIB}.a 11941461Sbostic install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \ 12041461Sbostic ${DESTDIR}${LIBDIR} 12141461Sbostic ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 12241600Sbostic ranlib lib${LIB}_p.a 12341461Sbostic install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 12441461Sbostic lib${LIB}_p.a ${DESTDIR}${LIBDIR} 12543867Sbostic ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 12641604Sbostic# install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 12741604Sbostic# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} 12842198Sbostic.if defined(LINKS) && !empty(LINKS) 12942198Sbostic @set ${LINKS}; \ 13042198Sbostic while test $$# -ge 2; do \ 13142198Sbostic l=${DESTDIR}$$1; \ 13242198Sbostic shift; \ 13342198Sbostic t=${DESTDIR}$$1; \ 13442198Sbostic shift; \ 13542198Sbostic echo $$t -\> $$l; \ 13642198Sbostic rm -f $$t; \ 13742198Sbostic ln $$l $$t; \ 13842198Sbostic done; true 13942198Sbostic.endif 14041461Sbostic 14141555Sbosticinstall: afterinstall 142*51824Smarcafterinstall: realinstall maninstall 14341555Sbostic.endif 14441461Sbostic 14541555Sbostic.if !target(lint) 14641555Sbosticlint: 14741555Sbostic.endif 14841555Sbostic 14941555Sbostic.if !target(tags) 15043473Sbostictags: ${SRCS} 15143473Sbostic -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ 15242550Sbostic sed "s;\${.CURDIR}/;;" > tags 15340581Sbostic.endif 15440581Sbostic 15541600Sbostic.include <bsd.man.mk> 15643473Sbostic.if !target(obj) 15743473Sbostic.if defined(NOOBJ) 15843473Sbosticobj: 15943473Sbostic.else 16043473Sbosticobj: 16143473Sbostic @cd ${.CURDIR}; rm -rf obj; \ 16243473Sbostic here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 16345780Sbostic echo "$$here -> $$dest"; ln -s $$dest obj; \ 16445780Sbostic if test -d /usr/obj -a ! -d $$dest; then \ 16545780Sbostic mkdir -p $$dest; \ 16645780Sbostic else \ 16745780Sbostic true; \ 16845780Sbostic fi; 16943473Sbostic.endif 17043473Sbostic.endif 171