1# @(#)bsd.lib.mk 5.11 (Berkeley) 06/01/90 2 3.if exists(${.CURDIR}/../Makefile.inc) 4.include "${.CURDIR}/../Makefile.inc" 5.endif 6 7LIBDIR?= /usr/lib 8LINTLIBDIR?= /usr/libdata/lint 9LIBGRP?= bin 10LIBOWN?= bin 11LIBMODE?= 444 12 13.MAIN: all 14 15# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries 16.SUFFIXES: 17.SUFFIXES: .out .o .po .s .c .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0 18 19.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: 20 nroff -man -h ${.IMPSRC} > ${.TARGET} 21 22.c.o: 23 ${CC} ${CFLAGS} -c ${.IMPSRC} 24 @${LD} -x -r ${.TARGET} 25 @mv a.out ${.TARGET} 26 27.c.po: 28 ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 29 @${LD} -X -r ${.TARGET} 30 @mv a.out ${.TARGET} 31 32.s.o: 33 ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 34 ${AS} -o ${.TARGET} 35 @${LD} -x -r ${.TARGET} 36 @mv a.out ${.TARGET} 37 38.s.po: 39 ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 40 ${AS} -o ${.TARGET} 41 @${LD} -X -r ${.TARGET} 42 @mv a.out ${.TARGET} 43 44MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 45 46all: lib${LIB}.a lib${LIB}_p.a ${MANALL}# llib-l${LIB}.ln 47 48OBJS+= ${SRCS:S/.c$/.o/g:S/.f$/.o/g:S/.s$/.o/g} 49lib${LIB}.a:: ${OBJS} 50 @echo building standard ${LIB} library 51 @${AR} cr lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} 52 53POBJS+= ${OBJS:.o=.po} 54lib${LIB}_p.a:: ${POBJS} 55 @echo building profiled ${LIB} library 56 @${AR} cr lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} 57 58llib-l${LIB}.ln: ${SRCS} 59 ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} 60 61.if !target(clean) 62clean: 63 rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 64 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 65.endif 66 67.if !target(cleandir) 68cleandir: 69 rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 70 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 71 rm -f ${MANALL} ${.CURDIR}/tags .depend 72.endif 73 74.if !target(depend) 75depend: .depend 76.depend: ${SRCS} 77 mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC} 78.endif 79 80.if !target(install) 81.if !target(beforeinstall) 82beforeinstall: 83.endif 84 85realinstall: beforeinstall 86 ranlib lib${LIB}.a 87 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \ 88 ${DESTDIR}${LIBDIR} 89 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 90 ranlib lib${LIB}_p.a 91 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 92 lib${LIB}_p.a ${DESTDIR}${LIBDIR} 93 ${RANLIB} -t ${DESTDIR}/usr/lib/lib${LIB}_p.a 94# install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 95# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} 96.if defined(LINKS) && !empty(LINKS) 97 @set ${LINKS}; \ 98 while test $$# -ge 2; do \ 99 l=${DESTDIR}$$1; \ 100 shift; \ 101 t=${DESTDIR}$$1; \ 102 shift; \ 103 echo $$t -\> $$l; \ 104 rm -f $$t; \ 105 ln $$l $$t; \ 106 done; true 107.endif 108 109install: afterinstall 110afterinstall: realinstall maninstall 111.endif 112 113.if !target(lint) 114lint: 115.endif 116 117.if !target(tags) 118tags: 119 cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ 120 sed "s;\${.CURDIR}/;;" > tags 121.if !empty(SRCS:M*.s) 122 cd ${.CURDIR}; egrep -o "^ENTRY(.*)|^SYSCALL(.*)" ${.ALLSRC:M*.s} | \ 123 sed \ 124 "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \`pwd\`/\1 /^\2(\3\4$$/;" \ 125 >> tags; sort -o tags tags 126.endif 127.endif 128 129.include <bsd.man.mk> 130