don't remove tags files on cleanup
[unix-history] / usr / src / share / mk / bsd.lib.mk
index 0a0c959..40b07ee 100644 (file)
@@ -1,4 +1,4 @@
-#      @(#)bsd.lib.mk  5.18 (Berkeley) %G%
+#      @(#)bsd.lib.mk  8.3 (Berkeley) %G%
 
 .if exists(${.CURDIR}/../Makefile.inc)
 .include "${.CURDIR}/../Makefile.inc"
 
 .if exists(${.CURDIR}/../Makefile.inc)
 .include "${.CURDIR}/../Makefile.inc"
@@ -20,10 +20,10 @@ BINMODE?=   555
 
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
 .SUFFIXES:
 
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
 .SUFFIXES:
-.SUFFIXES: .out .o .po .s .c .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0
+.SUFFIXES: .out .o .po .s .c .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0 .m4
 
 .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:
 
 .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:
-       nroff -man -h ${.IMPSRC} > ${.TARGET}
+       nroff -man ${.IMPSRC} > ${.TARGET}
 
 .c.o:
        ${CC} ${CFLAGS} -c ${.IMPSRC} 
 
 .c.o:
        ${CC} ${CFLAGS} -c ${.IMPSRC} 
@@ -48,35 +48,52 @@ BINMODE?=   555
        @mv a.out ${.TARGET}
 
 MANALL=        ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
        @mv a.out ${.TARGET}
 
 MANALL=        ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
+manpages: ${MANALL}
 
 
-all: lib${LIB}.a lib${LIB}_p.a ${MANALL}# llib-l${LIB}.ln
+.if !defined(NOPROFILE)
+_LIBS=lib${LIB}.a lib${LIB}_p.a
+.else
+_LIBS=lib${LIB}.a
+.endif
+
+all: ${_LIBS} # llib-l${LIB}.ln
+.if !defined(NOMAN)
+all: ${MANALL}
+.endif
+
+OBJS+= ${SRCS:R:S/$/.o/g}
 
 
-OBJS+= ${SRCS:S/.c$/.o/g:S/.f$/.o/g:S/.s$/.o/g}
 lib${LIB}.a:: ${OBJS}
        @echo building standard ${LIB} library
        @rm -f lib${LIB}.a
 lib${LIB}.a:: ${OBJS}
        @echo building standard ${LIB} library
        @rm -f lib${LIB}.a
-       @${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
+       @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
+       ranlib lib${LIB}.a
 
 POBJS+=        ${OBJS:.o=.po}
 lib${LIB}_p.a:: ${POBJS}
        @echo building profiled ${LIB} library
        @rm -f lib${LIB}_p.a
 
 POBJS+=        ${OBJS:.o=.po}
 lib${LIB}_p.a:: ${POBJS}
        @echo building profiled ${LIB} library
        @rm -f lib${LIB}_p.a
-       @${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
+       @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
+       ranlib lib${LIB}_p.a
 
 llib-l${LIB}.ln: ${SRCS}
        ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
 
 .if !target(clean)
 clean:
 
 llib-l${LIB}.ln: ${SRCS}
        ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
 
 .if !target(clean)
 clean:
-       rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \
+       rm -f ${OBJS}
+       rm -f ${POBJS}
+       rm -f a.out [Ee]rrs mklog ${CLEANFILES} \
            profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
 .endif
 
 .if !target(cleandir)
 cleandir:
            profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
 .endif
 
 .if !target(cleandir)
 cleandir:
-       rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \
+       rm -f ${OBJS}
+       rm -f ${POBJS}
+       rm -f a.out [Ee]rrs mklog ${CLEANFILES} \
            profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
            profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
-       rm -f ${MANALL} ${.CURDIR}/tags .depend
+       rm -f ${MANALL} .depend
 .endif
 
 .if !target(depend)
 .endif
 
 .if !target(depend)
@@ -84,7 +101,7 @@ depend: .depend
 .depend: ${SRCS}
        mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC}
        @(TMP=/tmp/_depend$$$$; \
 .depend: ${SRCS}
        mkdep ${CFLAGS:M-[ID]*} ${AINC} ${.ALLSRC}
        @(TMP=/tmp/_depend$$$$; \
-           sed -e 's/^\([^\.]*\).o:/\1.o \1.po:/' < .depend > $$TMP; \
+           sed -e 's/^\([^\.]*\).o *:/\1.o \1.po:/' < .depend > $$TMP; \
            mv $$TMP .depend)
 .endif
 
            mv $$TMP .depend)
 .endif
 
@@ -98,10 +115,12 @@ realinstall: beforeinstall
        install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
            ${DESTDIR}${LIBDIR}
        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
        install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
            ${DESTDIR}${LIBDIR}
        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
+.if !defined(NOPROFILE)
        ranlib lib${LIB}_p.a
        install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
            lib${LIB}_p.a ${DESTDIR}${LIBDIR}
        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
        ranlib lib${LIB}_p.a
        install -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
            lib${LIB}_p.a ${DESTDIR}${LIBDIR}
        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
+.endif
 #      install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 #          llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
 .if defined(LINKS) && !empty(LINKS)
 #      install -c -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
 #          llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
 .if defined(LINKS) && !empty(LINKS)
@@ -118,7 +137,10 @@ realinstall: beforeinstall
 .endif
 
 install: afterinstall
 .endif
 
 install: afterinstall
-afterinstall: realinstall maninstall
+afterinstall: realinstall
+.if !defined(NOMAN)
+afterinstall: maninstall
+.endif
 .endif
 
 .if !target(lint)
 .endif
 
 .if !target(lint)
@@ -127,14 +149,8 @@ lint:
 
 .if !target(tags)
 tags: ${SRCS}
 
 .if !target(tags)
 tags: ${SRCS}
-       -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \
-           sed "s;\${.CURDIR}/;;" > tags
-.if !empty(SRCS:M*.s)
-       -cd ${.CURDIR}; egrep -o "^ENTRY(.*)|^SYSCALL(.*)" ${.ALLSRC:M*.s} | \
-           sed \
-           "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \`pwd\`/\1 /^\2(\3\4$$/;" \
-           >> tags; sort -o tags tags
-.endif
+       -ctags -f /dev/stdout ${.ALLSRC:M*.c} | \
+           sed "s;\${.CURDIR}/;;" > ${.CURDIR}/tags
 .endif
 
 .include <bsd.man.mk>
 .endif
 
 .include <bsd.man.mk>