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

1.189   ! simonb      1: #      $NetBSD: bsd.lib.mk,v 1.188 2001/11/02 05:21:50 tv Exp $
1.92      mikel       2: #      @(#)bsd.lib.mk  8.3 (Berkeley) 4/22/94
1.1       cgd         3:
1.188     tv          4: .include <bsd.init.mk>
1.97      mycroft     5:
1.188     tv          6: ##### Basic targets
1.143     erh         7: .PHONY:                checkver cleanlib libinstall
                      8: realinstall:   checkver libinstall
1.183     tv          9: clean:         cleanlib
1.1       cgd        10:
1.188     tv         11: ##### Build and install rules
1.184     tv         12: .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})
1.154     simonb     13: SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
                     14: SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
1.171     christos   15: SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
1.143     erh        16:
                     17: # Check for higher installed library versions.
1.145     erh        18: .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
                     19:        exists(${BSDSRCDIR}/lib/checkver)
1.143     erh        20: checkver:
1.144     erh        21:        @(cd ${.CURDIR} && \
1.176     gmcgarry   22:                sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
1.154     simonb     23:                    -d ${DESTDIR}${LIBDIR} ${LIB})
1.173     christos   24: .endif
                     25: .endif
                     26:
                     27: .if !target(checkver)
1.143     erh        28: checkver:
                     29: .endif
1.173     christos   30:
1.169     thorpej    31: print-shlib-major:
1.185     tv         32: .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
1.169     thorpej    33:        @echo ${SHLIB_MAJOR}
1.173     christos   34: .else
                     35:        @false
                     36: .endif
1.169     thorpej    37:
                     38: print-shlib-minor:
1.185     tv         39: .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
1.169     thorpej    40:        @echo ${SHLIB_MINOR}
1.173     christos   41: .else
                     42:        @false
                     43: .endif
1.171     christos   44:
                     45: print-shlib-teeny:
1.185     tv         46: .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
1.171     christos   47:        @echo ${SHLIB_TEENY}
1.143     erh        48: .else
1.169     thorpej    49:        @false
1.173     christos   50: .endif
1.169     thorpej    51:
1.173     christos   52: .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
                     53: .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
                     54: .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
                     55: SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
                     56: .else
                     57: SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
                     58: .endif
                     59: .else
                     60: SHLIB_FULLVERSION=${SHLIB_MAJOR}
                     61: .endif
1.35      pk         62: .endif
1.1       cgd        63:
1.101     mycroft    64: # add additional suffixes not exported.
                     65: # .po is used for profiling object files.
                     66: # .so is used for PIC object files.
1.118     lukem      67: .SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
                     68: .SUFFIXES: .sh .m4 .m
1.82      mikel      69:
1.86      jonathan   70:
                     71: # Set PICFLAGS to cc flags for producing position-independent code,
                     72: # if not already set.  Includes -DPIC, if required.
                     73:
1.164     simonb     74: # Data-driven table using make variables to control how shared libraries
1.86      jonathan   75: # are built for different platforms and object formats.
1.125     jonathan   76: # OBJECT_FMT:          currently either "ELF" or "a.out", from <bsd.own.mk>
1.164     simonb     77: # SHLIB_SOVERSION:     version number to be compiled into a shared library
                     78: #                      via -soname. Usualy ${SHLIB_MAJOR} on ELF.
1.173     christos   79: #                      NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
                     80: #                      [.${SHLIB_TEENY}]]
1.164     simonb     81: # SHLIB_SHFLAGS:       Flags to tell ${LD} to emit shared library.
1.123     jonathan   82: #                      with ELF, also set shared-lib version for ld.so.
                     83: # SHLIB_LDSTARTFILE:   support .o file, call C++ file-level constructors
                     84: # SHLIB_LDENDFILE:     support .o file, call C++ file-level destructors
1.179     dmcmahil   85: # FPICFLAGS:           flags for ${FC} to compile .[fF] files to .so objects.
1.164     simonb     86: # CPPICFLAGS:          flags for ${CPP} to preprocess .[sS] files for ${AS}
                     87: # CPICFLAGS:           flags for ${CC} to compile .[cC] files to .so objects.
                     88: # CAPICFLAGS           flags for {$CC} to compiling .[Ss] files
1.107     jonathan   89: #                      (usually just ${CPPPICFLAGS} ${CPICFLAGS})
1.164     simonb     90: # APICFLAGS:           flags for ${AS} to assemble .[sS] to .so objects.
1.86      jonathan   91:
1.148     lukem      92: .if ${MACHINE_ARCH} == "alpha"
1.123     jonathan   93:                # Alpha-specific shared library flags
1.179     dmcmahil   94: FPICFLAGS ?= -fPIC
1.165     dmcmahil   95: CPICFLAGS ?= -fPIC -DPIC
1.107     jonathan   96: CPPPICFLAGS?= -DPIC
                     97: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
                     98: APICFLAGS ?=
1.151     drochner   99: .elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
1.123     jonathan  100:                # mips-specific shared library flags
1.86      jonathan  101:
1.160     simonb    102: # On mips, all libs are compiled with ABIcalls, not just sharedlibs.
                    103: MKPICLIB= no
                    104:
                    105: # so turn shlib PIC flags on for ${AS}.
                    106: AINC+=-DABICALLS
1.86      jonathan  107: AFLAGS+= -fPIC
                    108: AS+=   -KPIC
1.172     matt      109:
                    110: .elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
                    111: # On the VAX, all object are PIC by default, not just sharedlibs.
                    112: MKPICLIB= no
1.150     christos  113:
1.175     mrg       114: .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
                    115:        ${OBJECT_FMT} == "ELF"
1.150     christos  116:
1.179     dmcmahil  117: FPICFLAGS ?= -fPIC
1.165     dmcmahil  118: CPICFLAGS ?= -fPIC -DPIC
1.150     christos  119: CPPPICFLAGS?= -DPIC
                    120: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
                    121: APICFLAGS ?= -KPIC
1.86      jonathan  122:
                    123: .else
                    124:
1.187     nathanw   125: # Platform-independent flags for NetBSD a.out shared libraries
1.171     christos  126: SHLIB_SOVERSION=${SHLIB_FULLVERSION}
1.125     jonathan  127: SHLIB_SHFLAGS=
1.179     dmcmahil  128: FPICFLAGS ?= -fPIC
1.165     dmcmahil  129: CPICFLAGS?= -fPIC -DPIC
1.107     jonathan  130: CPPPICFLAGS?= -DPIC
                    131: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
                    132: APICFLAGS?= -k
1.86      jonathan  133:
                    134: .endif
                    135:
1.160     simonb    136: MKPICLIB?= yes
                    137:
1.123     jonathan  138: # Platform-independent linker flags for ELF shared libraries
1.148     lukem     139: .if ${OBJECT_FMT} == "ELF"
1.182     mrg       140: SHLIB_SOVERSION=       ${SHLIB_MAJOR}
                    141: SHLIB_SHFLAGS=         -soname lib${LIB}.so.${SHLIB_SOVERSION}
                    142: SHLIB_LDSTARTFILE?=    ${DESTDIR}/usr/lib/crtbeginS.o
                    143: SHLIB_LDENDFILE?=      ${DESTDIR}/usr/lib/crtendS.o
1.123     jonathan  144: .endif
1.86      jonathan  145:
1.82      mikel     146: CFLAGS+=       ${COPTS}
1.179     dmcmahil  147: FFLAGS+=       ${FOPTS}
1.1       cgd       148:
                    149: .c.o:
1.153     christos  150: .if defined(COPTS) && !empty(COPTS:M*-g*)
                    151:        ${COMPILE.c} ${.IMPSRC}
                    152: .else
1.80      christos  153:        @echo ${COMPILE.c:Q} ${.IMPSRC}
1.122     cgd       154:        @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  155:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    156:        @rm -f ${.TARGET}.o
1.153     christos  157: .endif
1.1       cgd       158:
                    159: .c.po:
1.153     christos  160: .if defined(COPTS) && !empty(COPTS:M*-g*)
                    161:        ${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
                    162: .else
1.80      christos  163:        @echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
1.68      cgd       164:        @${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  165:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                    166:        @rm -f ${.TARGET}.o
1.153     christos  167: .endif
1.17      mycroft   168:
1.27      pk        169: .c.so:
1.153     christos  170: .if defined(COPTS) && !empty(COPTS:M*-g*)
                    171:        ${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    172: .else
1.86      jonathan  173:        @echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    174:        @${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  175:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    176:        @rm -f ${.TARGET}.o
1.153     christos  177: .endif
1.27      pk        178:
1.58      cgd       179: .c.ln:
1.121     thorpej   180:        ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
1.58      cgd       181:
1.18      mycroft   182: .cc.o .C.o:
1.153     christos  183: .if defined(COPTS) && !empty(COPTS:M*-g*)
                    184:        ${COMPILE.cc} ${.IMPSRC}
                    185: .else
1.80      christos  186:        @echo ${COMPILE.cc:Q} ${.IMPSRC}
1.62      christos  187:        @${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
1.63      jtc       188:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
1.62      christos  189:        @rm -f ${.TARGET}.o
1.153     christos  190: .endif
1.17      mycroft   191:
1.18      mycroft   192: .cc.po .C.po:
1.153     christos  193: .if defined(COPTS) && !empty(COPTS:M*-g*)
                    194:        ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
                    195: .else
1.80      christos  196:        @echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
1.68      cgd       197:        @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  198:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                    199:        @rm -f ${.TARGET}.o
1.153     christos  200: .endif
1.28      cgd       201:
                    202: .cc.so .C.so:
1.153     christos  203: .if defined(COPTS) && !empty(COPTS:M*-g*)
                    204:        ${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    205: .else
1.86      jonathan  206:        @echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    207:        @${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  208:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    209:        @rm -f ${.TARGET}.o
1.153     christos  210: .endif
1.118     lukem     211:
1.179     dmcmahil  212: .f.o:
                    213: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
                    214:        ${COMPILE.f} ${.IMPSRC}
                    215: .else
                    216:        @echo ${COMPILE.f:Q} ${.IMPSRC}
                    217:        @${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
                    218:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    219:        @rm -f ${.TARGET}.o
                    220: .endif
                    221:
                    222: .f.po:
                    223: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
                    224:        ${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
                    225: .else
                    226:        @echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
                    227:        @${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
                    228:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                    229:        @rm -f ${.TARGET}.o
                    230: .endif
                    231:
                    232: .f.so:
                    233: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
                    234:        ${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    235: .else
                    236:        @echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    237:        @${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
                    238:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    239:        @rm -f ${.TARGET}.o
                    240: .endif
                    241:
                    242: .f.ln:
                    243:        ${ECHO} Skipping lint for Fortran libraries.
                    244:
1.118     lukem     245: .m.o:
1.153     christos  246: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
                    247:        ${COMPILE.m} ${.IMPSRC}
                    248: .else
1.118     lukem     249:        @echo ${COMPILE.m:Q} ${.IMPSRC}
1.122     cgd       250:        @${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
1.118     lukem     251:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    252:        @rm -f ${.TARGET}.o
1.153     christos  253: .endif
1.118     lukem     254:
                    255: .m.po:
1.153     christos  256: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
                    257:        ${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
                    258: .else
1.118     lukem     259:        @echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
                    260:        @${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
                    261:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                    262:        @rm -f ${.TARGET}.o
1.153     christos  263: .endif
1.118     lukem     264:
                    265: .m.so:
1.153     christos  266: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
                    267:        ${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    268: .else
1.118     lukem     269:        @echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    270:        @${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
                    271:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    272:        @rm -f ${.TARGET}.o
1.153     christos  273: .endif
1.1       cgd       274:
1.40      cgd       275: .S.o .s.o:
1.80      christos  276:        @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
1.69      jtc       277:        @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  278:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    279:        @rm -f ${.TARGET}.o
1.1       cgd       280:
1.40      cgd       281: .S.po .s.po:
1.80      christos  282:        @echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
1.75      jtc       283:        @${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  284:        @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
                    285:        @rm -f ${.TARGET}.o
1.1       cgd       286:
1.40      cgd       287: .S.so .s.so:
1.107     jonathan  288:        @echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
                    289:        @${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
1.62      christos  290:        @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
                    291:        @rm -f ${.TARGET}.o
1.27      pk        292:
1.148     lukem     293: .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    294:        || ${MKLINKLIB} != "no"
1.130     tv        295: _LIBS=lib${LIB}.a
                    296: .else
                    297: _LIBS=
                    298: .endif
1.58      cgd       299:
1.167     matt      300: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.158     christos  301:
1.149     lukem     302: .if ${MKPROFILE} != "no"
1.130     tv        303: _LIBS+=lib${LIB}_p.a
1.167     matt      304: POBJS+=${OBJS:.o=.po}
1.1       cgd       305: .endif
                    306:
1.148     lukem     307: .if ${MKPIC} != "no"
1.160     simonb    308: .if ${MKPICLIB} == "no"
                    309: SOLIB=lib${LIB}.a
                    310: .else
                    311: SOLIB=lib${LIB}_pic.a
                    312: _LIBS+=${SOLIB}
1.167     matt      313: SOBJS+=${OBJS:.o=.so}
1.160     simonb    314: .endif
1.171     christos  315: .if defined(SHLIB_FULLVERSION)
                    316: _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
1.27      pk        317: .endif
1.35      pk        318: .endif
1.27      pk        319:
1.179     dmcmahil  320: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    321: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.58      cgd       322: _LIBS+=llib-l${LIB}.ln
1.27      pk        323: .endif
                    324:
1.167     matt      325: .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    326:        || ${MKLINKLIB} != "no"
1.179     dmcmahil  327: ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
1.167     matt      328: .else
1.179     dmcmahil  329: ALLOBJS=${POBJS} ${SOBJS}
                    330: .endif
                    331: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
                    332: ALLOBJS+=${LOBJS}
1.167     matt      333: .endif
1.186     tv        334:
                    335: .NOPATH: ${ALLOBJS} ${_LIBS} ${SRCS:M*.[ly]:C/..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.158     christos  336:
1.162     mycroft   337: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
1.1       cgd       338:
1.90      christos  339: __archivebuild: .USE
1.89      christos  340:        @rm -f ${.TARGET}
1.138     tv        341:        @${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.89      christos  342:        ${RANLIB} ${.TARGET}
                    343:
                    344: __archiveinstall: .USE
1.188     tv        345:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
1.89      christos  346:        ${RANLIB} -t ${.TARGET}
                    347:        chmod ${LIBMODE} ${.TARGET}
                    348:
1.186     tv        349: DPSRCS+=       ${SRCS:M*.[ly]:C/..$/.c/}
                    350: CLEANFILES+=   ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.103     mycroft   351:
1.89      christos  352: lib${LIB}.a:: ${OBJS} __archivebuild
1.1       cgd       353:        @echo building standard ${LIB} library
                    354:
1.89      christos  355: lib${LIB}_p.a:: ${POBJS} __archivebuild
1.1       cgd       356:        @echo building profiled ${LIB} library
                    357:
1.89      christos  358: lib${LIB}_pic.a:: ${SOBJS} __archivebuild
1.27      pk        359:        @echo building shared object ${LIB} library
                    360:
1.171     christos  361: lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
1.88      cgd       362:     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.171     christos  363:        @echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
                    364:        @rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
1.152     fair      365: .if defined(DESTDIR)
1.155     wrstuden  366:        $(LD) -nostdlib -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
1.152     fair      367:            ${SHLIB_LDSTARTFILE} \
1.160     simonb    368:            --whole-archive ${SOLIB} \
1.170     erh       369:            --no-whole-archive ${LDADD} \
1.155     wrstuden  370:            -L${DESTDIR}${LIBDIR} -R${LIBDIR} \
1.152     fair      371:            ${SHLIB_LDENDFILE}
                    372: .else
1.126     jonathan  373:        $(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
1.123     jonathan  374:            ${SHLIB_LDSTARTFILE} \
1.160     simonb    375:            --whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
1.115     cjs       376:            ${SHLIB_LDENDFILE}
1.152     fair      377: .endif
1.148     lukem     378: .if ${OBJECT_FMT} == "ELF"
1.177     mycroft   379:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
                    380:        mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
                    381:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
                    382:        mv -f lib${LIB}.so.tmp lib${LIB}.so
1.133     tv        383: .endif
1.35      pk        384:
1.179     dmcmahil  385: .if !empty(LOBJS)
1.103     mycroft   386: LLIBS?=                -lc
1.58      cgd       387: llib-l${LIB}.ln: ${LOBJS}
                    388:        @echo building llib-l${LIB}.ln
                    389:        @rm -f llib-l${LIB}.ln
1.141     wrstuden  390:        @${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.179     dmcmahil  391: .endif
1.1       cgd       392:
1.81      cgd       393: cleanlib:
1.48      mycroft   394:        rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59      cgd       395:        rm -f lib${LIB}.a ${OBJS}
                    396:        rm -f lib${LIB}_p.a ${POBJS}
1.133     tv        397:        rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
1.59      cgd       398:        rm -f llib-l${LIB}.ln ${LOBJS}
1.1       cgd       399:
1.26      mycroft   400: .if defined(SRCS)
1.64      christos  401: afterdepend: .depend
1.1       cgd       402:        @(TMP=/tmp/_depend$$$$; \
1.79      cgd       403:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
1.58      cgd       404:              < .depend > $$TMP; \
1.1       cgd       405:            mv $$TMP .depend)
1.26      mycroft   406: .endif
1.1       cgd       407:
1.97      mycroft   408: .if !target(libinstall)
1.148     lukem     409: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139     tv        410: libinstall::
                    411:
1.148     lukem     412: .if ${MKLINKLIB} != "no"
1.89      christos  413: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.168     mycroft   414: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.89      christos  415: .if !defined(UPDATE)
                    416: .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
                    417: .endif
1.168     mycroft   418:
1.157     fredb     419: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
1.89      christos  420: ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
                    421: .endif
                    422: ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
1.130     tv        423: .endif
1.89      christos  424:
1.149     lukem     425: .if ${MKPROFILE} != "no"
1.89      christos  426: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.168     mycroft   427: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.89      christos  428: .if !defined(UPDATE)
                    429: .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.32      pk        430: .endif
1.168     mycroft   431:
1.157     fredb     432: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
1.89      christos  433: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
                    434: .endif
                    435: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
                    436: .endif
                    437:
1.149     lukem     438: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.168     mycroft   439: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.160     simonb    440: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.89      christos  441: .if !defined(UPDATE)
                    442: .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
                    443: .endif
1.168     mycroft   444:
1.157     fredb     445: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
1.89      christos  446: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
1.33      pk        447: .endif
1.160     simonb    448: .if ${MKPICLIB} == "no"
                    449: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
                    450:        rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
                    451:        ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
                    452: .else
1.89      christos  453: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
1.160     simonb    454: .endif
1.89      christos  455: .endif
                    456:
1.171     christos  457: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
                    458: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
                    459: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.89      christos  460: .if !defined(UPDATE)
1.171     christos  461: .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.89      christos  462: .endif
1.168     mycroft   463:
1.171     christos  464: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
                    465: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
1.89      christos  466: .endif
1.171     christos  467: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
1.188     tv        468:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
                    469:                ${.ALLSRC} ${.TARGET}
1.148     lukem     470: .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
1.146     thorpej   471:        /sbin/ldconfig -m ${LIBDIR}
                    472: .endif
1.148     lukem     473: .if ${OBJECT_FMT} == "ELF"
1.178     mycroft   474:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
1.177     mycroft   475:            ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
1.178     mycroft   476:        mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
1.83      cgd       477:            ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.148     lukem     478: .if ${MKLINKLIB} != "no"
1.178     mycroft   479:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
1.177     mycroft   480:            ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
1.178     mycroft   481:        mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
1.83      cgd       482:            ${DESTDIR}${LIBDIR}/lib${LIB}.so
                    483: .endif
1.12      cgd       484: .endif
1.139     tv        485: .endif
1.89      christos  486:
1.179     dmcmahil  487: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.89      christos  488: libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.168     mycroft   489: .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.89      christos  490: .if !defined(UPDATE)
                    491: .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
                    492: .endif
1.168     mycroft   493:
1.157     fredb     494: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
1.89      christos  495: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
                    496: .endif
1.95      mycroft   497: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
1.188     tv        498:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
                    499:                ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
1.58      cgd       500: .endif
1.1       cgd       501: .endif
                    502:
1.188     tv        503: ##### Pull in related .mk logic
1.1       cgd       504: .include <bsd.man.mk>
1.57      jtc       505: .include <bsd.nls.mk>
1.91      christos  506: .include <bsd.files.mk>
1.89      christos  507: .include <bsd.inc.mk>
1.109     cjs       508: .include <bsd.links.mk>
1.24      mycroft   509: .include <bsd.dep.mk>
1.66      christos  510: .include <bsd.sys.mk>
1.117     mycroft   511:
1.188     tv        512: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>