1# $Id: $ 2 3.if !defined(NOINCLUDE) && exists(${.CURDIR}/../Makefile.inc) 4.include "${.CURDIR}/../Makefile.inc" 5.endif 6 7LIBDIR?= /usr/lib 8LINTLIBDIR?= /usr/lib/lint 9LIBGRP?= bin 10LIBOWN?= bin 11LIBMODE?= 444 12 13STRIP?= -s 14 15BINGRP?= bin 16BINOWN?= bin 17BINMODE?= 555 18 19INCARPA?= -I/usr/include/nonstd/arpa 20INCOLDBSD?= -I/usr/include/nonstd/bsd 21INCLASTBSD?= -I/usr/include/nonstd/lastbsd 22INCDB?= -I/usr/include/nonstd/db 23INCDEV?= -I/usr/include/nonstd/dev 24INCFS?= -I/usr/include/nonstd/fs 25INCGNU?= -I/usr/include/nonstd/gnu 26INCIC?= -I/usr/include/nonstd/ic 27INCKERNEL?= -I/usr/include/nonstd/kernel 28INCNET?= -I/usr/include/nonstd/net 29INCSUN?= -I/usr/include/nonstd/sun 30CFLAGS+= ${NONSTDINC} 31.MAIN: all 32 33# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries 34.SUFFIXES: 35.SUFFIXES: .out .o .po .s .c .f .y .l .9 .8 .7 .6 .5 .4 .3 .2 .1 .0 36 37.9.0 .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: 38 nroff -mandoc ${.IMPSRC} > ${.TARGET} 39 40.c.o: 41 ${CC} ${CFLAGS} -c ${.IMPSRC} 42 @${LD} -x -r ${.TARGET} 43 @mv a.out ${.TARGET} 44 45.c.po: 46 ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 47 @${LD} -X -r ${.TARGET} 48 @mv a.out ${.TARGET} 49 50.s.o: 51 ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 52 ${AS} -o ${.TARGET} 53 @${LD} -x -r ${.TARGET} 54 @mv a.out ${.TARGET} 55 56.s.po: 57 ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 58 ${AS} -o ${.TARGET} 59 @${LD} -X -r ${.TARGET} 60 @mv a.out ${.TARGET} 61 62MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} ${MAN9} 63 64.if !defined(NOPROFILE) 65_LIBS=lib${LIB}.a lib${LIB}_p.a 66.else 67_LIBS=lib${LIB}.a 68.endif 69 70all: ${_LIBS} ${MANALL}# llib-l${LIB}.ln 71 72OBJS+= ${SRCS:R:S/$/.o/g} 73 74lib${LIB}.a:: ${OBJS} 75 @echo building standard ${LIB} library 76 @rm -f lib${LIB}.a 77 @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} 78 ranlib lib${LIB}.a 79 80POBJS+= ${OBJS:.o=.po} 81lib${LIB}_p.a:: ${POBJS} 82 @echo building profiled ${LIB} library 83 @rm -f lib${LIB}_p.a 84 @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} 85 ranlib lib${LIB}_p.a 86 87llib-l${LIB}.ln: ${SRCS} 88 ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} 89 90.if !target(clean) 91clean: 92 rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 93 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln ${MANALL} 94.endif 95 96.if !target(cleandir) 97cleandir: 98 rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ 99 profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln 100 rm -f ${MANALL} ${.CURDIR}/tags .depend 101.endif 102 103.if !target(depend) 104depend: .depend 105.depend: ${SRCS} 106 mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC} 107 @(TMP=/tmp/_depend$$$$; \ 108 sed -e 's/^\([^\.]*\).o:/\1.o \1.po:/' < .depend > $$TMP; \ 109 mv $$TMP .depend) 110.endif 111 112.if !target(install) 113.if !target(beforeinstall) 114beforeinstall: 115.endif 116 117realinstall: beforeinstall 118 ranlib lib${LIB}.a 119 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \ 120 ${DESTDIR}${LIBDIR} 121 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 122 ranlib lib${LIB}_p.a 123 install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 124 lib${LIB}_p.a ${DESTDIR}${LIBDIR} 125 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 126# install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 127# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} 128.if defined(LINKS) && !empty(LINKS) 129 @set ${LINKS}; \ 130 while test $$# -ge 2; do \ 131 l=${DESTDIR}$$1; \ 132 shift; \ 133 t=${DESTDIR}$$1; \ 134 shift; \ 135 echo $$t -\> $$l; \ 136 rm -f $$t; \ 137 ln $$l $$t; \ 138 done; true 139.endif 140 141install: afterinstall 142afterinstall: realinstall maninstall 143.endif 144 145.if !target(lint) 146lint: 147.endif 148 149.if !target(tags) 150tags: ${SRCS} 151 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ 152 sed "s;\${.CURDIR}/;;" > tags 153.endif 154 155.include <bsd.man.mk> 156.if !target(obj) 157.if defined(NOOBJ) 158obj: 159.else 160obj: 161 @cd ${.CURDIR}; rm -rf obj; \ 162 here=`pwd`; dest=/usr/obj/`echo $$here | sed 's,/usr/src/,,'`; \ 163 echo "$$here -> $$dest"; ln -s $$dest obj; \ 164 if test -d /usr/obj -a ! -d $$dest; then \ 165 mkdir -p $$dest; \ 166 else \ 167 true; \ 168 fi; 169.endif 170.endif 171