1# @(#)bsd.lib.mk 5.7 (Berkeley) 05/11/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 .y .l 18 19.c.o: 20 ${CC} ${CFLAGS} -c ${.IMPSRC} 21 @${LD} -x -r ${.TARGET} 22 @mv a.out ${.TARGET} 23 24.c.po: 25 ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 26 @${LD} -X -r ${.TARGET} 27 @mv a.out ${.TARGET} 28 29.s.o: 30 ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 31 ${AS} -o ${.TARGET} 32 @${LD} -x -r ${.TARGET} 33 @mv a.out ${.TARGET} 34 35.s.po: 36 ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 37 ${AS} -o ${.TARGET} 38 @${LD} -X -r ${.TARGET} 39 @mv a.out ${.TARGET} 40 41MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} 42 43all: lib${LIB}.a lib${LIB}_p.a ${MANALL}# llib-l${LIB}.ln 44 45OBJS= ${SRCS:S/.c$/.o/g:S/.f$/.o/g:S/.s$/.o/g} 46lib${LIB}.a:: ${OBJS} 47 @echo building standard ${LIB} library 48 @${AR} cr lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} 49 50POBJS= ${OBJS:.o=.po} 51lib${LIB}_p.a:: ${POBJS} 52 @echo building profiled ${LIB} library 53 @${AR} cr lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} 54 55llib-l${LIB}.ln: ${SRCS} 56 ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} 57 58.if !target(clean) 59clean: 60 rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 61 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 62.endif 63 64.if !target(cleandir) 65cleandir: 66 rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 67 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 68 rm -f ${MANALL} tags .depend 69.endif 70 71.if !target(depend) 72depend: .depend 73.depend: ${SRCS} 74 mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC} 75.endif 76 77.if !target(install) 78.if !target(beforeinstall) 79beforeinstall: 80.endif 81 82realinstall: beforeinstall 83 ranlib lib${LIB}.a 84 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \ 85 ${DESTDIR}${LIBDIR} 86 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 87 ranlib lib${LIB}_p.a 88 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 89 lib${LIB}_p.a ${DESTDIR}${LIBDIR} 90 ${RANLIB} -t ${DESTDIR}/usr/lib/lib${LIB}_p.a 91# install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 92# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} 93 94install: afterinstall 95afterinstall: realinstall maninstall 96.endif 97 98.if !target(lint) 99lint: 100.endif 101 102.if !target(tags) 103tags: 104 tags ${.ALLSRC:M*.c} 105 sed -e 's;../gen/;/usr/src/lib/libc/gen/;' \ 106 -e 's;../compat-43/;/usr/src/lib/libc/gen/;' \ 107 < tags > tags.tmp 108.if !empty(SRCS:M*.s) 109 egrep -o "^ENTRY(.*)|^SYSCALL(.*)" ${.ALLSRC:M*.s} | sed \ 110 "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \`pwd\`/\1 /^\2(\3\4$$/;" \ 111 >> tags.tmp 112 sort tags.tmp -o tags.tmp 113.endif 114 mv tags.tmp tags 115.endif 116 117.include <bsd.man.mk> 118