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

1.23      mycroft     1: #      from: @(#)bsd.lib.mk    5.26 (Berkeley) 5/2/91
1.39    ! pk          2: #      $Id: bsd.lib.mk,v 1.38 1993/11/02 23:14:50 cgd 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.38      cgd       103: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a
                    104:        @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
1.37      cgd       105:        @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
                    106:        $(LD) -Bshareable -Bforcearchive \
                    107:            -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a
1.35      pk        108:
1.1       cgd       109: llib-l${LIB}.ln: ${SRCS}
                    110:        ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
                    111:
                    112: .if !target(clean)
                    113: clean:
1.9       cgd       114:        rm -f a.out Errs errs mklog core ${CLEANFILES}
                    115:        rm -f ${OBJS}
                    116:        rm -f ${POBJS} profiled/*.o
1.27      pk        117:        rm -f ${SOBJS} shared/*.o
1.30      cgd       118:        rm -f lib${LIB}.a lib${LIB}_p.a lib${LIB}_pic.a llib-l${LIB}.ln
1.33      pk        119:        rm -f lib${LIB}.so.*.*
1.1       cgd       120: .endif
                    121:
1.25      mycroft   122: cleandir: clean
                    123:
1.26      mycroft   124: .if defined(SRCS)
1.23      mycroft   125: afterdepend:
1.1       cgd       126:        @(TMP=/tmp/_depend$$$$; \
1.29      pk        127:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < .depend > $$TMP; \
1.1       cgd       128:            mv $$TMP .depend)
1.26      mycroft   129: .endif
1.1       cgd       130:
                    131: .if !target(install)
                    132: .if !target(beforeinstall)
                    133: beforeinstall:
1.22      mycroft   134:        @install -d -o root -g wheel -m 755 ${DESTDIR}${LIBDIR}
1.1       cgd       135: .endif
                    136:
1.11      mycroft   137: realinstall:
1.13      cgd       138: #      ranlib lib${LIB}.a
1.8       cgd       139:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \
1.1       cgd       140:            ${DESTDIR}${LIBDIR}
                    141:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12      cgd       142: .if !defined(NOPROFILE)
1.13      cgd       143: #      ranlib lib${LIB}_p.a
1.8       cgd       144:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1       cgd       145:            lib${LIB}_p.a ${DESTDIR}${LIBDIR}
                    146:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.32      pk        147: .endif
1.39    ! pk        148: .if !defined(NOPIC)
1.32      pk        149: #      ranlib lib${LIB}_pic.a
                    150:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
                    151:            lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
                    152:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.33      pk        153: .endif
1.37      cgd       154: .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
1.33      pk        155:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.37      cgd       156:            lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
1.12      cgd       157: .endif
1.8       cgd       158: #      install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.1       cgd       159: #          llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
                    160: .if defined(LINKS) && !empty(LINKS)
                    161:        @set ${LINKS}; \
                    162:        while test $$# -ge 2; do \
                    163:                l=${DESTDIR}$$1; \
                    164:                shift; \
                    165:                t=${DESTDIR}$$1; \
                    166:                shift; \
                    167:                echo $$t -\> $$l; \
                    168:                rm -f $$t; \
                    169:                ln $$l $$t; \
                    170:        done; true
                    171: .endif
                    172:
1.11      mycroft   173: install: maninstall
                    174: maninstall: afterinstall
                    175: afterinstall: realinstall
                    176: realinstall: beforeinstall
1.1       cgd       177: .endif
                    178:
1.10      mycroft   179: .if !defined(NOMAN)
1.1       cgd       180: .include <bsd.man.mk>
1.10      mycroft   181: .endif
                    182:
1.22      mycroft   183: .include <bsd.obj.mk>
1.24      mycroft   184: .include <bsd.dep.mk>

CVSweb <webmaster@jp.NetBSD.org>