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

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

CVSweb <webmaster@jp.NetBSD.org>