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

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

CVSweb <webmaster@jp.NetBSD.org>