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

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

CVSweb <webmaster@jp.NetBSD.org>