1*51825Smarc# @(#)bsd.lib.mk 5.30 (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*51825Smarc nroff -man ${.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 3851824Smarc.if (${MACHINE} == "mips") 3951824SmarcNOPROFILE=1 4040581Sbostic.s.o: 4151824Smarc ${AS} ${CFLAGS:M-[ID]*} ${AINC} -o ${.TARGET} ${.IMPSRC} 4251824Smarc @${LD} -x -r ${.TARGET} 4351824Smarc @mv a.out ${.TARGET} 4451824Smarc.else 4551824Smarc.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} 5651824Smarc.endif 5740581Sbostic 5840581SbosticMANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 59*51825Smarcmanpages: ${MANALL} 6040581Sbostic 6148878Sbostic.if !defined(NOPROFILE) 6248878Sbostic_LIBS=lib${LIB}.a lib${LIB}_p.a 6348878Sbostic.else 6448878Sbostic_LIBS=lib${LIB}.a 6548878Sbostic.endif 6640581Sbostic 67*51825Smarcall: ${_LIBS} # llib-l${LIB}.ln 68*51825Smarc.if !defined(NOMAN) 69*51825Smarcall: ${MANALL} 70*51825Smarc.endif 7148878Sbostic 7246047SbosticOBJS+= ${SRCS:R:S/$/.o/g} 7346047Sbostic 7440581Sbosticlib${LIB}.a:: ${OBJS} 7540581Sbostic @echo building standard ${LIB} library 7643509Sbostic @rm -f lib${LIB}.a 7751824Smarc.if (${MACHINE} == "mips") 7851824Smarc @${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} 7951824Smarc.else 8047601Sbostic @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} 8151824Smarc.endif 8246871Sbostic ranlib lib${LIB}.a 8340581Sbostic 8442550SbosticPOBJS+= ${OBJS:.o=.po} 8540581Sbosticlib${LIB}_p.a:: ${POBJS} 8640581Sbostic @echo building profiled ${LIB} library 8744309Sbostic @rm -f lib${LIB}_p.a 8847601Sbostic @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} 8946871Sbostic ranlib lib${LIB}_p.a 9040581Sbostic 9140581Sbosticllib-l${LIB}.ln: ${SRCS} 9241461Sbostic ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} 9340581Sbostic 9441555Sbostic.if !target(clean) 9541555Sbosticclean: 9640581Sbostic rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 9740581Sbostic profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 9841555Sbostic.endif 9940581Sbostic 10041555Sbostic.if !target(cleandir) 10141555Sbosticcleandir: 10241555Sbostic rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 10341555Sbostic profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 10442550Sbostic rm -f ${MANALL} ${.CURDIR}/tags .depend 10541555Sbostic.endif 10640581Sbostic 10741555Sbostic.if !target(depend) 10841555Sbosticdepend: .depend 10941555Sbostic.depend: ${SRCS} 11041461Sbostic mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC} 11145937Sbostic @(TMP=/tmp/_depend$$$$; \ 11243508Sbostic sed -e 's/^\([^\.]*\).o:/\1.o \1.po:/' < .depend > $$TMP; \ 11343508Sbostic mv $$TMP .depend) 11441555Sbostic.endif 11540581Sbostic 11641555Sbostic.if !target(install) 11741555Sbostic.if !target(beforeinstall) 11841555Sbosticbeforeinstall: 11941555Sbostic.endif 12041555Sbostic 12141555Sbosticrealinstall: beforeinstall 12241600Sbostic ranlib lib${LIB}.a 12341461Sbostic install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \ 12441461Sbostic ${DESTDIR}${LIBDIR} 12541461Sbostic ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 12641600Sbostic ranlib lib${LIB}_p.a 12741461Sbostic install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 12841461Sbostic lib${LIB}_p.a ${DESTDIR}${LIBDIR} 12943867Sbostic ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 13041604Sbostic# install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 13141604Sbostic# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} 13242198Sbostic.if defined(LINKS) && !empty(LINKS) 13342198Sbostic @set ${LINKS}; \ 13442198Sbostic while test $$# -ge 2; do \ 13542198Sbostic l=${DESTDIR}$$1; \ 13642198Sbostic shift; \ 13742198Sbostic t=${DESTDIR}$$1; \ 13842198Sbostic shift; \ 13942198Sbostic echo $$t -\> $$l; \ 14042198Sbostic rm -f $$t; \ 14142198Sbostic ln $$l $$t; \ 14242198Sbostic done; true 14342198Sbostic.endif 14441461Sbostic 14541555Sbosticinstall: afterinstall 146*51825Smarcafterinstall: realinstall 147*51825Smarc.if !defined(NOMAN) 148*51825Smarcafterinstall: maninstall 14941555Sbostic.endif 150*51825Smarc.endif 15141461Sbostic 15241555Sbostic.if !target(lint) 15341555Sbosticlint: 15441555Sbostic.endif 15541555Sbostic 15641555Sbostic.if !target(tags) 15743473Sbostictags: ${SRCS} 15843473Sbostic -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ 15942550Sbostic sed "s;\${.CURDIR}/;;" > tags 16040581Sbostic.endif 16140581Sbostic 16241600Sbostic.include <bsd.man.mk> 16343473Sbostic.if !target(obj) 16443473Sbostic.if defined(NOOBJ) 16543473Sbosticobj: 16643473Sbostic.else 16743473Sbosticobj: 16843473Sbostic @cd ${.CURDIR}; rm -rf obj; \ 16943473Sbostic here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 17045780Sbostic echo "$$here -> $$dest"; ln -s $$dest obj; \ 17145780Sbostic if test -d /usr/obj -a ! -d $$dest; then \ 17245780Sbostic mkdir -p $$dest; \ 17345780Sbostic else \ 17445780Sbostic true; \ 17545780Sbostic fi; 17643473Sbostic.endif 17743473Sbostic.endif 178