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

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

CVSweb <webmaster@jp.NetBSD.org>