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

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

CVSweb <webmaster@jp.NetBSD.org>