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

1.23      mycroft     1: #      from: @(#)bsd.lib.mk    5.26 (Berkeley) 5/2/91
1.37    ! cgd         2: #      $Id: bsd.lib.mk,v 1.36 1993/11/02 22:59:06 pk Exp $
1.1       cgd         3:
                      4: .if exists(${.CURDIR}/../Makefile.inc)
                      5: .include "${.CURDIR}/../Makefile.inc"
                      6: .endif
                      7:
1.35      pk          8: .if exists(${.CURDIR}/shlib_version)
1.37    ! cgd         9: SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
        !            10: SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
1.35      pk         11: .endif
                     12:
1.1       cgd        13: .MAIN: all
                     14:
                     15: # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
1.27      pk         16: # .so used for PIC object files
1.1       cgd        17: .SUFFIXES:
1.27      pk         18: .SUFFIXES: .out .o .po .so .s .c .cc .C .f .y .l .0 .1 .2 .3 .4 .5 .6 .7 .8
1.1       cgd        19:
                     20: .c.o:
                     21:        ${CC} ${CFLAGS} -c ${.IMPSRC}
                     22:        @${LD} -x -r ${.TARGET}
                     23:        @mv a.out ${.TARGET}
                     24:
                     25: .c.po:
                     26:        ${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
1.17      mycroft    27:        @${LD} -X -r ${.TARGET}
                     28:        @mv a.out ${.TARGET}
                     29:
1.27      pk         30: .c.so:
                     31:        ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
                     32:
1.18      mycroft    33: .cc.o .C.o:
1.17      mycroft    34:        ${CXX} ${CXXFLAGS} -c ${.IMPSRC}
                     35:        @${LD} -x -r ${.TARGET}
                     36:        @mv a.out ${.TARGET}
                     37:
1.18      mycroft    38: .cc.po .C.po:
1.17      mycroft    39:        ${CXX} -p ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
1.28      cgd        40:        @${LD} -X -r ${.TARGET}
                     41:        @mv a.out ${.TARGET}
                     42:
                     43: .cc.so .C.so:
                     44:        ${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
1.1       cgd        45:
                     46: .s.o:
                     47:        ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
                     48:            ${AS} -o ${.TARGET}
                     49:        @${LD} -x -r ${.TARGET}
                     50:        @mv a.out ${.TARGET}
                     51:
                     52: .s.po:
                     53:        ${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
                     54:            ${AS} -o ${.TARGET}
                     55:        @${LD} -X -r ${.TARGET}
                     56:        @mv a.out ${.TARGET}
                     57:
1.27      pk         58: .s.so:
                     59:        ${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
                     60:            ${AS} -k -o ${.TARGET}
                     61:
1.1       cgd        62: .if !defined(NOPROFILE)
                     63: _LIBS=lib${LIB}.a lib${LIB}_p.a
                     64: .else
                     65: _LIBS=lib${LIB}.a
                     66: .endif
                     67:
1.27      pk         68: .if !defined(NOPIC)
                     69: _LIBS+=lib${LIB}_pic.a
1.37    ! cgd        70: .if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
        !            71: _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
1.27      pk         72: .endif
1.35      pk         73: .endif
1.27      pk         74:
                     75: .if !defined(PICFLAG)
                     76: PICFLAG=-fpic
                     77: .endif
                     78:
1.24      mycroft    79: all: ${_LIBS} # llib-l${LIB}.ln
1.1       cgd        80:
1.21      mycroft    81: OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
1.1       cgd        82:
                     83: lib${LIB}.a:: ${OBJS}
                     84:        @echo building standard ${LIB} library
                     85:        @rm -f lib${LIB}.a
1.16      mycroft    86:        @${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
1.13      cgd        87:        ${RANLIB} lib${LIB}.a
1.1       cgd        88:
                     89: POBJS+=        ${OBJS:.o=.po}
                     90: lib${LIB}_p.a:: ${POBJS}
                     91:        @echo building profiled ${LIB} library
                     92:        @rm -f lib${LIB}_p.a
1.16      mycroft    93:        @${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
1.13      cgd        94:        ${RANLIB} lib${LIB}_p.a
1.1       cgd        95:
1.27      pk         96: SOBJS+=        ${OBJS:.o=.so}
                     97: lib${LIB}_pic.a:: ${SOBJS}
                     98:        @echo building shared object ${LIB} library
                     99:        @rm -f lib${LIB}_pic.a
                    100:        @${AR} cTq lib${LIB}_pic.a `lorder ${SOBJS} | tsort` ${LDADD}
                    101:        ${RANLIB} lib${LIB}_pic.a
                    102:
1.37    ! cgd       103: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}:
        !           104:        @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
        !           105:        $(LD) -Bshareable -Bforcearchive \
        !           106:            -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a
1.35      pk        107:
1.1       cgd       108: llib-l${LIB}.ln: ${SRCS}
                    109:        ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
                    110:
                    111: .if !target(clean)
                    112: clean:
1.9       cgd       113:        rm -f a.out Errs errs mklog core ${CLEANFILES}
                    114:        rm -f ${OBJS}
                    115:        rm -f ${POBJS} profiled/*.o
1.27      pk        116:        rm -f ${SOBJS} shared/*.o
1.30      cgd       117:        rm -f lib${LIB}.a lib${LIB}_p.a lib${LIB}_pic.a llib-l${LIB}.ln
1.33      pk        118:        rm -f lib${LIB}.so.*.*
1.1       cgd       119: .endif
                    120:
1.25      mycroft   121: cleandir: clean
                    122:
1.26      mycroft   123: .if defined(SRCS)
1.23      mycroft   124: afterdepend:
1.1       cgd       125:        @(TMP=/tmp/_depend$$$$; \
1.29      pk        126:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < .depend > $$TMP; \
1.1       cgd       127:            mv $$TMP .depend)
1.26      mycroft   128: .endif
1.1       cgd       129:
                    130: .if !target(install)
                    131: .if !target(beforeinstall)
                    132: beforeinstall:
1.22      mycroft   133:        @install -d -o root -g wheel -m 755 ${DESTDIR}${LIBDIR}
1.1       cgd       134: .endif
                    135:
1.11      mycroft   136: realinstall:
1.13      cgd       137: #      ranlib lib${LIB}.a
1.8       cgd       138:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
1.1       cgd       139:            ${DESTDIR}${LIBDIR}
                    140:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12      cgd       141: .if !defined(NOPROFILE)
1.13      cgd       142: #      ranlib lib${LIB}_p.a
1.8       cgd       143:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1       cgd       144:            lib${LIB}_p.a ${DESTDIR}${LIBDIR}
                    145:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.32      pk        146: .endif
                    147: .if !defined(NOPIC) && defined(INSTALL_PIC_ARCHIVE)
                    148: #      ranlib lib${LIB}_pic.a
                    149:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
                    150:            lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
                    151:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.33      pk        152: .endif
1.37    ! cgd       153: .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
1.33      pk        154:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.37    ! cgd       155:            lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
1.12      cgd       156: .endif
1.8       cgd       157: #      install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1       cgd       158: #          llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
                    159: .if defined(LINKS) && !empty(LINKS)
                    160:        @set ${LINKS}; \
                    161:        while test $$# -ge 2; do \
                    162:                l=${DESTDIR}$$1; \
                    163:                shift; \
                    164:                t=${DESTDIR}$$1; \
                    165:                shift; \
                    166:                echo $$t -\> $$l; \
                    167:                rm -f $$t; \
                    168:                ln $$l $$t; \
                    169:        done; true
                    170: .endif
                    171:
1.11      mycroft   172: install: maninstall
                    173: maninstall: afterinstall
                    174: afterinstall: realinstall
                    175: realinstall: beforeinstall
1.1       cgd       176: .endif
                    177:
1.10      mycroft   178: .if !defined(NOMAN)
1.1       cgd       179: .include <bsd.man.mk>
1.10      mycroft   180: .endif
                    181:
1.22      mycroft   182: .include <bsd.obj.mk>
1.24      mycroft   183: .include <bsd.dep.mk>

CVSweb <webmaster@jp.NetBSD.org>