[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.18

1.1       cgd         1: #      @(#)bsd.lib.mk  5.26 (Berkeley) 5/2/91
                      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.17      mycroft    23: .SUFFIXES: .out .o .po .s .c .cc .C .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0
1.1       cgd        24:
                     25: .8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0:
                     26:        nroff -mandoc ${.IMPSRC} > ${.TARGET}
                     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}
1.17      mycroft    35:        @${LD} -X -r ${.TARGET}
                     36:        @mv a.out ${.TARGET}
                     37:
1.18    ! mycroft    38: .cc.o .C.o:
1.17      mycroft    39:        ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
                     40:        @${LD} -x -r ${.TARGET}
                     41:        @mv a.out ${.TARGET}
                     42:
1.18    ! mycroft    43: .cc.po .C.po:
1.17      mycroft    44:        ${CXX} -p ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
1.1       cgd        45:        @${LD} -X -r ${.TARGET}
                     46:        @mv a.out ${.TARGET}
                     47:
                     48: .s.o:
                     49:        ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
                     50:            ${AS} -o ${.TARGET}
                     51:        @${LD} -x -r ${.TARGET}
                     52:        @mv a.out ${.TARGET}
                     53:
                     54: .s.po:
                     55:        ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
                     56:            ${AS} -o ${.TARGET}
                     57:        @${LD} -X -r ${.TARGET}
                     58:        @mv a.out ${.TARGET}
                     59:
1.10      mycroft    60: .if !defined(NOMAN)
1.1       cgd        61: MANALL=        ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
1.10      mycroft    62: .endif
1.1       cgd        63:
                     64: .if !defined(NOPROFILE)
                     65: _LIBS=lib${LIB}.a lib${LIB}_p.a
                     66: .else
                     67: _LIBS=lib${LIB}.a
                     68: .endif
                     69:
                     70: all: ${_LIBS} ${MANALL}# llib-l${LIB}.ln
                     71:
                     72: OBJS+= ${SRCS:R:S/$/.o/g}
                     73:
                     74: lib${LIB}.a:: ${OBJS}
                     75:        @echo building standard ${LIB} library
                     76:        @rm -f lib${LIB}.a
1.16      mycroft    77:        @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
1.13      cgd        78:        ${RANLIB} lib${LIB}.a
1.1       cgd        79:
                     80: POBJS+=        ${OBJS:.o=.po}
                     81: lib${LIB}_p.a:: ${POBJS}
                     82:        @echo building profiled ${LIB} library
                     83:        @rm -f lib${LIB}_p.a
1.16      mycroft    84:        @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
1.13      cgd        85:        ${RANLIB} lib${LIB}_p.a
1.1       cgd        86:
                     87: llib-l${LIB}.ln: ${SRCS}
                     88:        ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
                     89:
                     90: .if !target(clean)
                     91: clean:
1.9       cgd        92:        rm -f a.out Errs errs mklog core ${CLEANFILES}
                     93:        rm -f ${OBJS}
                     94:        rm -f ${POBJS} profiled/*.o
                     95:        rm -f lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
1.1       cgd        96: .endif
                     97:
                     98: .if !target(cleandir)
                     99: cleandir:
1.9       cgd       100:        rm -f a.out Errs errs mklog core ${CLEANFILES}
                    101:        rm -f ${OBJS}
                    102:        rm -f ${POBJS} profiled/*.o
                    103:        rm -f lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln
1.1       cgd       104:        rm -f ${MANALL} ${.CURDIR}/tags .depend
                    105: .endif
                    106:
                    107: .if !target(depend)
                    108: depend: .depend
                    109: .depend: ${SRCS}
1.8       cgd       110:        mkdep ${CFLAGS:M-[ID+]*} ${AINC} ${.ALLSRC}
1.1       cgd       111:        @(TMP=/tmp/_depend$$$$; \
1.14      cgd       112:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po:/' < .depend > $$TMP; \
1.1       cgd       113:            mv $$TMP .depend)
                    114: .endif
                    115:
                    116: .if !target(install)
                    117: .if !target(beforeinstall)
                    118: beforeinstall:
1.7       cgd       119:        @if [ ! -d "${DESTDIR}${LIBDIR}" ]; then \
1.6       cgd       120:                /bin/rm -f ${DESTDIR}${LIBDIR} ; \
1.5       cgd       121:                mkdir -p ${DESTDIR}${LIBDIR} ; \
                    122:                chown root.wheel ${DESTDIR}${LIBDIR} ; \
                    123:                chmod 755 ${DESTDIR}${LIBDIR} ; \
                    124:        else \
                    125:                true ; \
                    126:        fi
1.1       cgd       127: .endif
                    128:
1.11      mycroft   129: realinstall:
1.13      cgd       130: #      ranlib lib${LIB}.a
1.8       cgd       131:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
1.1       cgd       132:            ${DESTDIR}${LIBDIR}
                    133:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12      cgd       134: .if !defined(NOPROFILE)
1.13      cgd       135: #      ranlib lib${LIB}_p.a
1.8       cgd       136:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1       cgd       137:            lib${LIB}_p.a ${DESTDIR}${LIBDIR}
                    138:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.12      cgd       139: .endif
1.8       cgd       140: #      install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1       cgd       141: #          llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
                    142: .if defined(LINKS) && !empty(LINKS)
                    143:        @set ${LINKS}; \
                    144:        while test $$# -ge 2; do \
                    145:                l=${DESTDIR}$$1; \
                    146:                shift; \
                    147:                t=${DESTDIR}$$1; \
                    148:                shift; \
                    149:                echo $$t -\> $$l; \
                    150:                rm -f $$t; \
                    151:                ln $$l $$t; \
                    152:        done; true
                    153: .endif
                    154:
1.11      mycroft   155: install: maninstall
                    156: maninstall: afterinstall
                    157: afterinstall: realinstall
                    158: realinstall: beforeinstall
1.1       cgd       159: .endif
                    160:
                    161: .if !target(lint)
                    162: lint:
                    163: .endif
                    164:
                    165: .if !target(tags)
                    166: tags: ${SRCS}
                    167:        -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \
                    168:            sed "s;\${.CURDIR}/;;" > tags
                    169: .endif
                    170:
1.10      mycroft   171: .if !defined(NOMAN)
1.1       cgd       172: .include <bsd.man.mk>
1.10      mycroft   173: .endif
                    174:
1.1       cgd       175: .if !target(obj)
                    176: .if defined(NOOBJ)
                    177: obj:
                    178: .else
                    179: obj:
1.3       cgd       180:        @cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \
1.2       cgd       181:        here=`pwd`; subdir=`echo $$here | sed 's,^/usr/src/,,'`; \
                    182:        if test $$here != $$subdir ; then \
                    183:                dest=/usr/obj/$$subdir ; \
                    184:                echo "$$here -> $$dest"; ln -s $$dest obj; \
                    185:                if test -d /usr/obj -a ! -d $$dest; then \
                    186:                        mkdir -p $$dest; \
                    187:                else \
                    188:                        true; \
                    189:                fi; \
1.1       cgd       190:        else \
1.2       cgd       191:                true ; \
                    192:                dest=$$here/obj ; \
                    193:                echo "making $$here/obj" ; \
                    194:                if test ! -d obj ; then \
                    195:                        mkdir $$here/obj; \
                    196:                fi; \
1.1       cgd       197:        fi;
                    198: .endif
                    199: .endif

CVSweb <webmaster@jp.NetBSD.org>