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

1.68      cgd         1: #      $NetBSD: bsd.lib.mk,v 1.67 1996/01/17 20:39:26 mycroft 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.58      cgd        17: # prefer .S to a .c, add .po, remove stuff not used in the BSD libraries.
                     18: # .so used for PIC object files.  .ln used for lint output files.
1.1       cgd        19: .SUFFIXES:
1.58      cgd        20: .SUFFIXES: .out .o .po .so .S .s .c .cc .C .f .y .l .ln .m4
1.1       cgd        21:
                     22: .c.o:
1.62      christos   23:        @echo "${COMPILE.c} ${.IMPSRC}"
                     24:        @${COMPILE.c} ${.IMPSRC}  -o ${.TARGET}.o
                     25:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                     26:        @rm -f ${.TARGET}.o
1.1       cgd        27:
                     28: .c.po:
1.68      cgd        29:        @echo "${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}"
                     30:        @${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
1.62      christos   31:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                     32:        @rm -f ${.TARGET}.o
1.17      mycroft    33:
1.27      pk         34: .c.so:
1.62      christos   35:        @echo "${COMPILE.c} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}"
                     36:        @${COMPILE.c} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}.o
                     37:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                     38:        @rm -f ${.TARGET}.o
1.27      pk         39:
1.58      cgd        40: .c.ln:
                     41:        ${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} -i ${.IMPSRC}
                     42:
1.18      mycroft    43: .cc.o .C.o:
1.62      christos   44:        @echo "${COMPILE.cc} ${.IMPSRC}"
                     45:        @${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
1.63      jtc        46:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
1.62      christos   47:        @rm -f ${.TARGET}.o
1.17      mycroft    48:
1.18      mycroft    49: .cc.po .C.po:
1.68      cgd        50:        @echo "${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}"
                     51:        @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
1.62      christos   52:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                     53:        @rm -f ${.TARGET}.o
1.28      cgd        54:
                     55: .cc.so .C.so:
1.62      christos   56:        @echo "${COMPILE.cc} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}"
                     57:        @${COMPILE.cc} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}.o
                     58:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                     59:        @rm -f ${.TARGET}.o
1.1       cgd        60:
1.40      cgd        61: .S.o .s.o:
1.69    ! jtc        62:        @echo "${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
        !            63:        @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
1.62      christos   64:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                     65:        @rm -f ${.TARGET}.o
1.1       cgd        66:
1.40      cgd        67: .S.po .s.po:
1.69    ! jtc        68:        @echo "${COMPILE.S} -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}"
        !            69:        @${COMPILE.S} -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${TARGET}.o
1.62      christos   70:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                     71:        @rm -f ${.TARGET}.o
1.1       cgd        72:
1.40      cgd        73: .S.so .s.so:
1.69    ! jtc        74:        @echo "${COMPILE.S} ${PICFLAG} -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${TARGET}.o
        !            75:        @${COMPILE.S} ${PICFLAG} -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${TARGET}.o
1.62      christos   76:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                     77:        @rm -f ${.TARGET}.o
1.27      pk         78:
1.58      cgd        79: .if !defined(PICFLAG)
                     80: PICFLAG=-fpic
                     81: .endif
                     82:
1.1       cgd        83: .if !defined(NOPROFILE)
                     84: _LIBS=lib${LIB}.a lib${LIB}_p.a
                     85: .else
                     86: _LIBS=lib${LIB}.a
                     87: .endif
                     88:
1.27      pk         89: .if !defined(NOPIC)
                     90: _LIBS+=lib${LIB}_pic.a
1.37      cgd        91: .if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
                     92: _LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
1.27      pk         93: .endif
1.35      pk         94: .endif
1.27      pk         95:
1.58      cgd        96: .if !defined(NOLINT)
                     97: _LIBS+=llib-l${LIB}.ln
1.27      pk         98: .endif
                     99:
1.58      cgd       100: all: ${_LIBS} _SUBDIRUSE
1.1       cgd       101:
1.21      mycroft   102: OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
1.1       cgd       103:
                    104: lib${LIB}.a:: ${OBJS}
                    105:        @echo building standard ${LIB} library
                    106:        @rm -f lib${LIB}.a
1.67      mycroft   107:        @${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort -q`
1.13      cgd       108:        ${RANLIB} lib${LIB}.a
1.1       cgd       109:
                    110: POBJS+=        ${OBJS:.o=.po}
                    111: lib${LIB}_p.a:: ${POBJS}
                    112:        @echo building profiled ${LIB} library
                    113:        @rm -f lib${LIB}_p.a
1.67      mycroft   114:        @${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort -q`
1.13      cgd       115:        ${RANLIB} lib${LIB}_p.a
1.1       cgd       116:
1.27      pk        117: SOBJS+=        ${OBJS:.o=.so}
                    118: lib${LIB}_pic.a:: ${SOBJS}
                    119:        @echo building shared object ${LIB} library
                    120:        @rm -f lib${LIB}_pic.a
1.67      mycroft   121:        @${AR} cq lib${LIB}_pic.a `lorder ${SOBJS} | tsort -q`
1.27      pk        122:        ${RANLIB} lib${LIB}_pic.a
                    123:
1.42      mycroft   124: lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD}
1.38      cgd       125:        @echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
1.37      cgd       126:        @rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
1.53      pk        127:        $(LD) -x -Bshareable -Bforcearchive \
1.42      mycroft   128:            -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD}
1.35      pk        129:
1.58      cgd       130: LOBJS+=        ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    131: # the following looks XXX to me... -- cgd
                    132: LLIBS?=        -lc
                    133: llib-l${LIB}.ln: ${LOBJS}
                    134:        @echo building llib-l${LIB}.ln
                    135:        @rm -f llib-l${LIB}.ln
                    136:        @${LINT} -C${LIB} ${LOBJS} ${LLIBS}
1.1       cgd       137:
                    138: .if !target(clean)
1.49      cgd       139: clean: _SUBDIRUSE
1.48      mycroft   140:        rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59      cgd       141:        rm -f lib${LIB}.a ${OBJS}
                    142:        rm -f lib${LIB}_p.a ${POBJS}
1.61      cgd       143:        rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS}
1.59      cgd       144:        rm -f llib-l${LIB}.ln ${LOBJS}
1.1       cgd       145: .endif
                    146:
1.49      cgd       147: cleandir: _SUBDIRUSE clean
1.25      mycroft   148:
1.26      mycroft   149: .if defined(SRCS)
1.64      christos  150: afterdepend: .depend
1.1       cgd       151:        @(TMP=/tmp/_depend$$$$; \
1.58      cgd       152:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' \
                    153:              < .depend > $$TMP; \
1.1       cgd       154:            mv $$TMP .depend)
1.26      mycroft   155: .endif
1.1       cgd       156:
                    157: .if !target(install)
                    158: .if !target(beforeinstall)
                    159: beforeinstall:
                    160: .endif
                    161:
1.11      mycroft   162: realinstall:
1.13      cgd       163: #      ranlib lib${LIB}.a
1.56      cgd       164:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
1.1       cgd       165:            ${DESTDIR}${LIBDIR}
                    166:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.56      cgd       167:        chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12      cgd       168: .if !defined(NOPROFILE)
1.13      cgd       169: #      ranlib lib${LIB}_p.a
1.56      cgd       170:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.1       cgd       171:            lib${LIB}_p.a ${DESTDIR}${LIBDIR}
                    172:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.56      cgd       173:        chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.32      pk        174: .endif
1.39      pk        175: .if !defined(NOPIC)
1.32      pk        176: #      ranlib lib${LIB}_pic.a
1.56      cgd       177:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.32      pk        178:            lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
                    179:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.56      cgd       180:        chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.33      pk        181: .endif
1.37      cgd       182: .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
1.33      pk        183:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.37      cgd       184:            lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
1.12      cgd       185: .endif
1.58      cgd       186: .if !defined(NOLINT)
                    187:        install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
                    188:            llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
                    189: .endif
1.1       cgd       190: .if defined(LINKS) && !empty(LINKS)
                    191:        @set ${LINKS}; \
                    192:        while test $$# -ge 2; do \
                    193:                l=${DESTDIR}$$1; \
                    194:                shift; \
                    195:                t=${DESTDIR}$$1; \
                    196:                shift; \
                    197:                echo $$t -\> $$l; \
                    198:                rm -f $$t; \
                    199:                ln $$l $$t; \
                    200:        done; true
                    201: .endif
                    202:
1.49      cgd       203: install: maninstall _SUBDIRUSE
1.11      mycroft   204: maninstall: afterinstall
                    205: afterinstall: realinstall
                    206: realinstall: beforeinstall
1.1       cgd       207: .endif
                    208:
1.10      mycroft   209: .if !defined(NOMAN)
1.1       cgd       210: .include <bsd.man.mk>
1.57      jtc       211: .endif
                    212:
                    213: .if !defined(NONLS)
                    214: .include <bsd.nls.mk>
1.10      mycroft   215: .endif
                    216:
1.22      mycroft   217: .include <bsd.obj.mk>
1.24      mycroft   218: .include <bsd.dep.mk>
1.49      cgd       219: .include <bsd.subdir.mk>
1.66      christos  220: .include <bsd.sys.mk>

CVSweb <webmaster@jp.NetBSD.org>