[BACK]Return to bsd.lib.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

Annotation of src/share/mk/bsd.lib.mk, Revision 1.1.1.2

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

CVSweb <webmaster@jp.NetBSD.org>