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

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

CVSweb <webmaster@jp.NetBSD.org>