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

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

CVSweb <webmaster@jp.NetBSD.org>