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

1.80    ! christos    1: #      $NetBSD: bsd.lib.mk,v 1.79 1996/12/20 16:36:56 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.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.80    ! christos   23:        @echo ${COMPILE.c:Q} ${.IMPSRC}
1.62      christos   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.80    ! christos   29:        @echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
1.68      cgd        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.80    ! christos   35:        @echo ${COMPILE.c:Q} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}
1.62      christos   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.80    ! christos   44:        @echo ${COMPILE.cc:Q} ${.IMPSRC}
1.62      christos   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.80    ! christos   50:        @echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
1.68      cgd        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.80    ! christos   56:        @echo ${COMPILE.cc:Q} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}
1.62      christos   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.80    ! christos   62:        @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
1.69      jtc        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.80    ! christos   68:        @echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
1.75      jtc        69:        @${COMPILE.S} -DGPROF -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.80    ! christos   74:        @echo ${COMPILE.S:Q} ${PICFLAG} -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
1.70      jtc        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.72      cgd       127: .if (${MACHINE_ARCH} != "alpha")
1.53      pk        128:        $(LD) -x -Bshareable -Bforcearchive \
1.42      mycroft   129:            -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD}
1.72      cgd       130: .else
1.77      cgd       131:        $(LD) -shared -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
                    132:            -soname lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
                    133:            /usr/lib/crtbegin.o \
                    134:            --whole-archive lib${LIB}_pic.a --no-whole-archive ${LDADD} \
                    135:            /usr/lib/crtend.o
1.72      cgd       136: .endif
1.35      pk        137:
1.58      cgd       138: LOBJS+=        ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    139: LLIBS?=        -lc
                    140: llib-l${LIB}.ln: ${LOBJS}
                    141:        @echo building llib-l${LIB}.ln
                    142:        @rm -f llib-l${LIB}.ln
                    143:        @${LINT} -C${LIB} ${LOBJS} ${LLIBS}
1.1       cgd       144:
                    145: .if !target(clean)
1.49      cgd       146: clean: _SUBDIRUSE
1.48      mycroft   147:        rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59      cgd       148:        rm -f lib${LIB}.a ${OBJS}
                    149:        rm -f lib${LIB}_p.a ${POBJS}
1.61      cgd       150:        rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS}
1.59      cgd       151:        rm -f llib-l${LIB}.ln ${LOBJS}
1.1       cgd       152: .endif
                    153:
1.49      cgd       154: cleandir: _SUBDIRUSE clean
1.25      mycroft   155:
1.26      mycroft   156: .if defined(SRCS)
1.64      christos  157: afterdepend: .depend
1.1       cgd       158:        @(TMP=/tmp/_depend$$$$; \
1.79      cgd       159:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
1.58      cgd       160:              < .depend > $$TMP; \
1.1       cgd       161:            mv $$TMP .depend)
1.26      mycroft   162: .endif
1.1       cgd       163:
                    164: .if !target(install)
                    165: .if !target(beforeinstall)
                    166: beforeinstall:
                    167: .endif
                    168:
1.11      mycroft   169: realinstall:
1.13      cgd       170: #      ranlib lib${LIB}.a
1.73      thorpej   171:        ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
1.1       cgd       172:            ${DESTDIR}${LIBDIR}
                    173:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.56      cgd       174:        chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.12      cgd       175: .if !defined(NOPROFILE)
1.13      cgd       176: #      ranlib lib${LIB}_p.a
1.73      thorpej   177:        ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.1       cgd       178:            lib${LIB}_p.a ${DESTDIR}${LIBDIR}
                    179:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.56      cgd       180:        chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.32      pk        181: .endif
1.39      pk        182: .if !defined(NOPIC)
1.32      pk        183: #      ranlib lib${LIB}_pic.a
1.73      thorpej   184:        ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
1.32      pk        185:            lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
                    186:        ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.56      cgd       187:        chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.33      pk        188: .endif
1.37      cgd       189: .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
1.73      thorpej   190:        ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.37      cgd       191:            lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
1.12      cgd       192: .endif
1.58      cgd       193: .if !defined(NOLINT)
1.73      thorpej   194:        ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.58      cgd       195:            llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
                    196: .endif
1.1       cgd       197: .if defined(LINKS) && !empty(LINKS)
                    198:        @set ${LINKS}; \
                    199:        while test $$# -ge 2; do \
                    200:                l=${DESTDIR}$$1; \
                    201:                shift; \
                    202:                t=${DESTDIR}$$1; \
                    203:                shift; \
                    204:                echo $$t -\> $$l; \
                    205:                rm -f $$t; \
                    206:                ln $$l $$t; \
                    207:        done; true
                    208: .endif
                    209:
1.49      cgd       210: install: maninstall _SUBDIRUSE
1.11      mycroft   211: maninstall: afterinstall
                    212: afterinstall: realinstall
                    213: realinstall: beforeinstall
1.1       cgd       214: .endif
                    215:
1.10      mycroft   216: .if !defined(NOMAN)
1.1       cgd       217: .include <bsd.man.mk>
1.57      jtc       218: .endif
                    219:
                    220: .if !defined(NONLS)
                    221: .include <bsd.nls.mk>
1.10      mycroft   222: .endif
                    223:
1.22      mycroft   224: .include <bsd.obj.mk>
1.24      mycroft   225: .include <bsd.dep.mk>
1.49      cgd       226: .include <bsd.subdir.mk>
1.66      christos  227: .include <bsd.sys.mk>

CVSweb <webmaster@jp.NetBSD.org>