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

1.333   ! christos    1: #      $NetBSD: bsd.lib.mk,v 1.332 2013/03/05 21:16:24 pooka 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.207     thorpej     5: .include <bsd.shlib.mk>
1.219     thorpej     6: .include <bsd.gcc.mk>
1.227     lukem       7: # Pull in <bsd.sys.mk> here so we can override its .c.o rule
                      8: .include <bsd.sys.mk>
1.97      mycroft     9:
1.282     lukem      10: LIBISMODULE?=  no
1.281     lukem      11: LIBISPRIVATE?= no
1.291     mrg        12: LIBISCXX?=     no
1.281     lukem      13:
1.282     lukem      14: .if ${LIBISMODULE} != "no"
1.330     christos   15: _LIB_PREFIX?=  # empty
1.282     lukem      16: MKDEBUGLIB:=   no
                     17: MKLINT:=       no
                     18: MKPICINSTALL:= no
                     19: MKPROFILE:=    no
                     20: MKSTATICLIB:=  no
1.330     christos   21: .else
                     22: _LIB_PREFIX?=  lib
1.282     lukem      23: .endif
                     24:
1.281     lukem      25: .if ${LIBISPRIVATE} != "no"
1.280     lukem      26: MKDEBUGLIB:=   no
                     27: MKLINT:=       no
1.290     cube       28: MKPICINSTALL:= no
                     29: . if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
                     30: MKSTATICLIB:=  no
                     31: . else
1.280     lukem      32: MKPIC:=                no
1.290     cube       33: . endif
1.280     lukem      34: MKPROFILE:=    no
                     35: .endif
                     36:
1.188     tv         37: ##### Basic targets
1.246     lukem      38: .PHONY:                checkver libinstall
1.143     erh        39: realinstall:   checkver libinstall
1.232     erh        40:
                     41: ##### LIB specific flags.
1.287     christos   42: # XXX: This is needed for programs that link with .a libraries
                     43: # Perhaps a more correct solution is to always generate _pic.a
                     44: # files or always have a shared library.
                     45: .if defined(MKPIE) && (${MKPIE} != "no")
                     46: CFLAGS+=        ${PIE_CFLAGS}
1.288     christos   47: AFLAGS+=        ${PIE_AFLAGS}
1.287     christos   48: .endif
1.1       cgd        49:
1.332     pooka      50: .if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \
                     51:     (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
1.326     christos   52: # We only add -g to the shared library objects
                     53: # because we don't currently split .a archives.
                     54: CSHLIBFLAGS+=  -g
1.333   ! christos   55: .if ${LIBISPRIVATE} == "yes"
        !            56: CFLAGS+=       -g
1.326     christos   57: .endif
1.333   ! christos   58: .endif
        !            59:
1.326     christos   60:
1.256     lukem      61: ##### Libraries that this may depend upon.
                     62: .if defined(LIBDPLIBS) && ${MKPIC} != "no"                             # {
                     63: .for _lib _dir in ${LIBDPLIBS}
                     64: .if !defined(LIBDO.${_lib})
1.303     christos   65: LIBDO.${_lib}!=        cd "${_dir}" && ${PRINTOBJDIR}
1.256     lukem      66: .MAKEOVERRIDES+=LIBDO.${_lib}
                     67: .endif
1.325     pooka      68: .if ${LIBDO.${_lib}} == "_external"
                     69: LDADD+=                -l${_lib}
                     70: .else
1.256     lukem      71: LDADD+=                -L${LIBDO.${_lib}} -l${_lib}
1.327     christos   72: DPADD+=                ${LIBDO.${_lib}}/lib${_lib}.so  # Don't use _LIB_PREFIX
1.325     pooka      73: .endif
1.256     lukem      74: .endfor
                     75: .endif                                                                 # }
                     76:
1.188     tv         77: ##### Build and install rules
1.304     njoly      78: MKDEP_SUFFIXES?=       .o .po .pico .go .ln
1.292     pooka      79:
1.252     lukem      80: .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})             # {
1.154     simonb     81: SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
                     82: SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
1.171     christos   83: SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
1.143     erh        84:
1.295     he         85: DPADD+=        ${SHLIB_VERSION_FILE}
                     86:
1.143     erh        87: # Check for higher installed library versions.
1.145     erh        88: .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
1.201     lukem      89:        exists(${NETBSDSRCDIR}/lib/checkver)
1.143     erh        90: checkver:
1.303     christos   91:        @(cd "${.CURDIR}" && \
1.289     apb        92:            HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
1.239     lukem      93:            ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
1.327     christos   94:                    -d ${_DEST.OBJ} ${LIB})
1.173     christos   95: .endif
1.252     lukem      96: .endif                                                                 # }
1.173     christos   97:
                     98: .if !target(checkver)
1.143     erh        99: checkver:
                    100: .endif
1.173     christos  101:
1.169     thorpej   102: print-shlib-major:
1.185     tv        103: .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
1.169     thorpej   104:        @echo ${SHLIB_MAJOR}
1.173     christos  105: .else
                    106:        @false
                    107: .endif
1.169     thorpej   108:
                    109: print-shlib-minor:
1.185     tv        110: .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
1.169     thorpej   111:        @echo ${SHLIB_MINOR}
1.173     christos  112: .else
                    113:        @false
                    114: .endif
1.171     christos  115:
                    116: print-shlib-teeny:
1.185     tv        117: .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
1.171     christos  118:        @echo ${SHLIB_TEENY}
1.143     erh       119: .else
1.169     thorpej   120:        @false
1.173     christos  121: .endif
1.169     thorpej   122:
1.252     lukem     123: .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)                                # {
1.173     christos  124: .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
                    125: .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
                    126: SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
                    127: .else
                    128: SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
                    129: .endif
                    130: .else
                    131: SHLIB_FULLVERSION=${SHLIB_MAJOR}
                    132: .endif
1.252     lukem     133: .endif                                                                 # }
1.1       cgd       134:
1.101     mycroft   135: # add additional suffixes not exported.
                    136: # .po is used for profiling object files.
1.304     njoly     137: # .pico is used for PIC object files.
                    138: .SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .C .m .F .f .r .y .l .cl .p .h
1.118     lukem     139: .SUFFIXES: .sh .m4 .m
1.82      mikel     140:
1.86      jonathan  141:
                    142: # Set PICFLAGS to cc flags for producing position-independent code,
                    143: # if not already set.  Includes -DPIC, if required.
                    144:
1.164     simonb    145: # Data-driven table using make variables to control how shared libraries
1.86      jonathan  146: # are built for different platforms and object formats.
1.302     abs       147: # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
                    148: #                      numbers of shared library
1.164     simonb    149: # SHLIB_SOVERSION:     version number to be compiled into a shared library
                    150: #                      via -soname. Usualy ${SHLIB_MAJOR} on ELF.
1.173     christos  151: #                      NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
                    152: #                      [.${SHLIB_TEENY}]]
1.164     simonb    153: # SHLIB_SHFLAGS:       Flags to tell ${LD} to emit shared library.
1.123     jonathan  154: #                      with ELF, also set shared-lib version for ld.so.
                    155: # SHLIB_LDSTARTFILE:   support .o file, call C++ file-level constructors
                    156: # SHLIB_LDENDFILE:     support .o file, call C++ file-level destructors
1.304     njoly     157: # FPICFLAGS:           flags for ${FC} to compile .[fF] files to .pico objects.
1.271     tsutsui   158: # CPPPICFLAGS:         flags for ${CPP} to preprocess .[sS] files for ${AS}
1.205     yamt      159: # CPICFLAGS:           flags for ${CC} to compile .[cC] files to pic objects.
1.304     njoly     160: # CSHLIBFLAGS:         flags for ${CC} to compile .[cC] files to .pico objects.
1.205     yamt      161: #                      (usually includes ${CPICFLAGS})
                    162: # CAPICFLAGS:          flags for ${CC} to compiling .[Ss] files
1.107     jonathan  163: #                      (usually just ${CPPPICFLAGS} ${CPICFLAGS})
1.304     njoly     164: # APICFLAGS:           flags for ${AS} to assemble .[sS] to .pico objects.
1.86      jonathan  165:
1.252     lukem     166: .if ${MACHINE_ARCH} == "alpha"                                         # {
1.209     thorpej   167:
1.179     dmcmahil  168: FPICFLAGS ?= -fPIC
1.165     dmcmahil  169: CPICFLAGS ?= -fPIC -DPIC
1.222     lukem     170: CPPPICFLAGS?= -DPIC
1.107     jonathan  171: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
                    172: APICFLAGS ?=
1.209     thorpej   173:
1.308     mrg       174: .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")     # } {
1.209     thorpej   175:
1.222     lukem     176: # If you use -fPIC you need to define BIGPIC to turn on 32-bit
1.202     eeh       177: # relocations in asm code
1.179     dmcmahil  178: FPICFLAGS ?= -fPIC
1.165     dmcmahil  179: CPICFLAGS ?= -fPIC -DPIC
1.202     eeh       180: CPPPICFLAGS?= -DPIC -DBIGPIC
1.150     christos  181: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
1.203     eeh       182: APICFLAGS ?= -KPIC
1.204     fredette  183:
1.252     lukem     184: .else                                                                  # } {
1.86      jonathan  185:
1.244     skrll     186: # Platform-independent flags for NetBSD shared libraries
1.171     christos  187: SHLIB_SOVERSION=${SHLIB_FULLVERSION}
1.125     jonathan  188: SHLIB_SHFLAGS=
1.179     dmcmahil  189: FPICFLAGS ?= -fPIC
1.165     dmcmahil  190: CPICFLAGS?= -fPIC -DPIC
1.222     lukem     191: CPPPICFLAGS?= -DPIC
1.107     jonathan  192: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
                    193: APICFLAGS?= -k
1.86      jonathan  194:
1.252     lukem     195: .endif                                                                 # }
1.160     simonb    196:
1.205     yamt      197: .if ${MKPICLIB} != "no"
                    198: CSHLIBFLAGS+= ${CPICFLAGS}
                    199: .endif
                    200:
                    201: .if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
                    202: MKSHLIBOBJS= yes
                    203: .else
                    204: MKSHLIBOBJS= no
                    205: .endif
                    206:
1.123     jonathan  207: # Platform-independent linker flags for ELF shared libraries
1.182     mrg       208: SHLIB_SOVERSION=       ${SHLIB_MAJOR}
1.327     christos  209: SHLIB_SHFLAGS=         -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION}
1.272     christos  210: SHLIB_SHFLAGS+=                -Wl,--warn-shared-textrel
1.322     christos  211: SHLIB_LDSTARTFILE?=    ${_GCC_CRTI} ${_GCC_CRTBEGINS}
                    212: SHLIB_LDENDFILE?=      ${_GCC_CRTENDS} ${_GCC_CRTN}
1.86      jonathan  213:
1.82      mikel     214: CFLAGS+=       ${COPTS}
1.267     mrg       215: OBJCFLAGS+=    ${OBJCOPTS}
1.257     simonb    216: AFLAGS+=       ${COPTS}
1.179     dmcmahil  217: FFLAGS+=       ${FOPTS}
1.1       cgd       218:
1.305     darran    219: .if defined(CTFCONVERT)
                    220: .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
                    221: CTFFLAGS+=     -g
                    222: .endif
                    223: .endif
                    224:
1.333   ! christos  225: LIBSTRIPAOBJS= yes
        !           226: .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
        !           227: LIBSTRIPCOBJS= yes
        !           228: .endif
        !           229: .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
        !           230: LIBSTRIPOBJCOBJS=      yes
        !           231: .endif
        !           232: .if !defined(FFLAGS) || empty(FFLAGS:M*-g*)
        !           233: LIBSTRIPFOBJS= yes
        !           234: .endif
        !           235: .if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*)
        !           236: LIBSTRIPSHLIBOBJS=     yes
        !           237: .endif
        !           238:
1.1       cgd       239: .c.o:
1.238     lukem     240:        ${_MKTARGET_COMPILE}
1.263     dsl       241:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305     darran    242: .if defined(CTFCONVERT)
                    243:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    244: .endif
1.333   ! christos  245: .if defined(LIBSTRIPCOBJS)
1.320     christos  246:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  247: .endif
1.1       cgd       248:
                    249: .c.po:
1.238     lukem     250:        ${_MKTARGET_COMPILE}
1.263     dsl       251:        ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
1.305     darran    252: .if defined(CTFCONVERT)
                    253:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    254: .endif
1.333   ! christos  255: .if defined(LIBSTRIPCOBJS)
1.320     christos  256:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  257: .endif
1.17      mycroft   258:
1.266     christos  259: .c.go:
                    260:        ${_MKTARGET_COMPILE}
                    261:        ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
                    262:
1.304     njoly     263: .c.pico:
1.238     lukem     264:        ${_MKTARGET_COMPILE}
1.263     dsl       265:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  266: .if defined(LIBSTRIPSHLIBOBJS)
1.320     christos  267:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  268: .endif
1.27      pk        269:
1.223     lukem     270: .cc.o .cpp.o .cxx.o .C.o:
1.238     lukem     271:        ${_MKTARGET_COMPILE}
1.263     dsl       272:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  273: .if defined(LIBSTRIPCOBJS)
1.320     christos  274:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  275: .endif
1.17      mycroft   276:
1.266     christos  277: .cc.po .cpp.po .cxx.po .C.po:
1.238     lukem     278:        ${_MKTARGET_COMPILE}
1.263     dsl       279:        ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  280: .if defined(LIBSTRIPCOBJS)
1.320     christos  281:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  282: .endif
1.28      cgd       283:
1.266     christos  284: .cc.go .cpp.go .cxx.go .C.go:
                    285:        ${_MKTARGET_COMPILE}
                    286:        ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
                    287:
1.304     njoly     288: .cc.pico .cpp.pico .cxx.pico .C.pico:
1.238     lukem     289:        ${_MKTARGET_COMPILE}
1.263     dsl       290:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  291: .if defined(LIBSTRIPSHLIBOBJS)
1.320     christos  292:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  293: .endif
1.118     lukem     294:
1.179     dmcmahil  295: .f.o:
1.238     lukem     296:        ${_MKTARGET_COMPILE}
1.263     dsl       297:        ${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
1.305     darran    298: .if defined(CTFCONVERT)
                    299:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    300: .endif
1.333   ! christos  301: .if defined(LIBSTRIPFOBJS)
1.320     christos  302:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179     dmcmahil  303: .endif
                    304:
                    305: .f.po:
1.238     lukem     306:        ${_MKTARGET_COMPILE}
1.263     dsl       307:        ${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
1.305     darran    308: .if defined(CTFCONVERT)
                    309:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    310: .endif
1.333   ! christos  311: .if defined(LIBSTRIPFOBJS)
1.320     christos  312:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179     dmcmahil  313: .endif
                    314:
1.266     christos  315: .f.go:
                    316:        ${_MKTARGET_COMPILE}
                    317:        ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
                    318:
1.304     njoly     319: .f.pico:
1.238     lukem     320:        ${_MKTARGET_COMPILE}
1.263     dsl       321:        ${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  322: .if defined(LIBSTRIPFOBJS)
1.320     christos  323:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.179     dmcmahil  324: .endif
                    325:
                    326: .f.ln:
1.238     lukem     327:        ${_MKTARGET_COMPILE}
1.217     wiz       328:        @echo Skipping lint for Fortran libraries.
1.179     dmcmahil  329:
1.118     lukem     330: .m.o:
1.238     lukem     331:        ${_MKTARGET_COMPILE}
1.267     mrg       332:        ${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305     darran    333: .if defined(CTFCONVERT)
                    334:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    335: .endif
1.333   ! christos  336: .if defined(LIBSTRIPOBJCOBJS)
1.320     christos  337:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  338: .endif
1.118     lukem     339:
                    340: .m.po:
1.238     lukem     341:        ${_MKTARGET_COMPILE}
1.267     mrg       342:        ${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305     darran    343: .if defined(CTFCONVERT)
                    344:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    345: .endif
1.333   ! christos  346: .if defined(LIBSTRIPOBJCOBJS)
1.320     christos  347:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  348: .endif
1.118     lukem     349:
1.266     christos  350: .m.go:
                    351:        ${_MKTARGET_COMPILE}
1.267     mrg       352:        ${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  353: .if defined(LIBSTRIPOBJCOBJS)
1.320     christos  354:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.266     christos  355: .endif
                    356:
1.304     njoly     357: .m.pico:
1.238     lukem     358:        ${_MKTARGET_COMPILE}
1.267     mrg       359:        ${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  360: .if defined(LIBSTRIPOBJCOBJS)
1.320     christos  361:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.153     christos  362: .endif
1.1       cgd       363:
1.251     lukem     364: .s.o:
1.238     lukem     365:        ${_MKTARGET_COMPILE}
1.263     dsl       366:        ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305     darran    367: .if defined(CTFCONVERT)
                    368:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    369: .endif
1.333   ! christos  370: .if defined(LIBSTRIPAOBJS)
1.320     christos  371:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333   ! christos  372: .endif
1.1       cgd       373:
1.251     lukem     374: .S.o:
                    375:        ${_MKTARGET_COMPILE}
1.263     dsl       376:        ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305     darran    377: .if defined(CTFCONVERT)
                    378:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    379: .endif
1.333   ! christos  380: .if defined(LIBSTRIPAOBJS)
1.320     christos  381:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333   ! christos  382: .endif
1.251     lukem     383:
                    384: .s.po:
                    385:        ${_MKTARGET_COMPILE}
1.263     dsl       386:        ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305     darran    387: .if defined(CTFCONVERT)
                    388:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    389: .endif
1.333   ! christos  390: .if defined(LIBSTRIPAOBJS)
1.320     christos  391:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333   ! christos  392: .endif
1.251     lukem     393:
                    394: .S.po:
1.238     lukem     395:        ${_MKTARGET_COMPILE}
1.263     dsl       396:        ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.305     darran    397: .if defined(CTFCONVERT)
                    398:        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    399: .endif
1.333   ! christos  400: .if defined(LIBSTRIPAOBJS)
1.320     christos  401:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333   ! christos  402: .endif
1.1       cgd       403:
1.266     christos  404: .s.go:
                    405:        ${_MKTARGET_COMPILE}
                    406:        ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    407:
                    408: .S.go:
                    409:        ${_MKTARGET_COMPILE}
                    410:        ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    411:
1.304     njoly     412: .s.pico:
1.251     lukem     413:        ${_MKTARGET_COMPILE}
1.263     dsl       414:        ${COMPILE.s} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  415: .if defined(LIBSTRIPAOBJS)
1.320     christos  416:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333   ! christos  417: .endif
1.251     lukem     418:
1.304     njoly     419: .S.pico:
1.238     lukem     420:        ${_MKTARGET_COMPILE}
1.263     dsl       421:        ${COMPILE.S} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
1.333   ! christos  422: .if defined(LIBSTRIPAOBJS)
1.320     christos  423:        ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
1.333   ! christos  424: .endif
1.27      pk        425:
1.327     christos  426: # Declare a few variables to make our life easier later.
                    427: _LIB:=${_LIB_PREFIX}${LIB}
                    428: _LIB.a:=${_LIB}.a
                    429: _LIB_p.a:=${_LIB}_p.a
                    430: _LIB_g.a:=${_LIB}_g.a
                    431: _LIB_pic.a:=${_LIB}_pic.a
                    432: _LIB.ln:=llib-l${LIB}.ln
                    433:
                    434: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
                    435: _LIB.so:=${_LIB}.so
                    436: _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR}
                    437: _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION}
                    438: .if ${MKDEBUG} != "no"
                    439: _LIB.so.debug:=${_LIB.so.full}.debug
                    440: .endif
                    441: .endif
                    442:
                    443: _DEST.LIB:=${DESTDIR}${LIBDIR}
                    444: _DEST.OBJ:=${DESTDIR}${_LIBSODIR}
                    445: _DEST.LINT:=${DESTDIR}${LINTLIBDIR}
                    446: _DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR}
                    447:
1.252     lukem     448: .if defined(LIB)                                                       # {
1.234     lukem     449: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    450:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.327     christos  451: _LIBS=${_LIB.a}
1.130     tv        452: .else
                    453: _LIBS=
                    454: .endif
1.58      cgd       455:
1.321     matt      456: .if ${LIBISPRIVATE} != "no" \
                    457:    && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \
                    458:    && !defined(NOCOMBINE))                                             # {
                    459: .for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g}
                    460: COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
                    461: .if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f)
                    462: COMBINESRCS+=  ${f}
                    463: NODPSRCS+=     ${f}
                    464: .else
                    465: OBJS+=         ${f:R:S/$/.o/}
                    466: .endif
                    467: .endfor
                    468:
                    469: .if !empty(COMBINESRCS)
1.327     christos  470: OBJS+=         ${_LIB}_combine.o
                    471: ${_LIB}_combine.o: ${COMBINESRCS}
1.321     matt      472:        ${_MKTARGET_COMPILE}
                    473:        ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET}
1.333   ! christos  474: .if defined(LIBSTRIPOBJS)
1.321     matt      475:        ${OBJCOPY} -x ${.TARGET}
                    476: .endif
                    477:
1.327     christos  478: CLEANFILES+=   ${_LIB}_combine.d
1.321     matt      479:
1.327     christos  480: .if exists("${_LIB}_combine.d")
                    481: .include "${_LIB}_combine.d"
1.321     matt      482: .endif
                    483: .endif   # empty(XSRCS.${LIB})
                    484: .else                                                  # } {
1.167     matt      485: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.321     matt      486: .endif                                                 # }
1.158     christos  487:
1.255     thorpej   488: STOBJS+=${OBJS}
                    489:
1.280     lukem     490: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    491:
1.281     lukem     492: .if ${LIBISPRIVATE} != "no"
1.252     lukem     493: # No installation is required
                    494: libinstall::
1.306     lukem     495: .endif
1.252     lukem     496:
1.268     lukem     497: .if ${MKDEBUGLIB} != "no"
1.327     christos  498: _LIBS+=${_LIB_g.a}
1.266     christos  499: GOBJS+=${OBJS:.o=.go}
                    500: DEBUGFLAGS?=-DDEBUG
                    501: .endif
                    502:
1.149     lukem     503: .if ${MKPROFILE} != "no"
1.327     christos  504: _LIBS+=${_LIB_p.a}
1.167     matt      505: POBJS+=${OBJS:.o=.po}
1.262     christos  506: PROFFLAGS?=-DGPROF -DPROF
1.1       cgd       507: .endif
                    508:
1.252     lukem     509: .if ${MKPIC} != "no"                                                   # {
1.160     simonb    510: .if ${MKPICLIB} == "no"
1.205     yamt      511: .if ${MKSHLIBOBJS} != "no"
                    512: # make _pic.a, which isn't really pic,
                    513: # since it's needed for making shared lib.
                    514: # but don't install it.
1.327     christos  515: SOLIB=${_LIB_pic.a}
1.304     njoly     516: SOBJS+=${OBJS:.o=.pico}
1.205     yamt      517: .else
1.327     christos  518: SOLIB=${_LIB.a}
1.205     yamt      519: .endif
1.160     simonb    520: .else
1.327     christos  521: SOLIB=${_LIB_pic.a}
1.160     simonb    522: _LIBS+=${SOLIB}
1.304     njoly     523: SOBJS+=${OBJS:.o=.pico}
1.160     simonb    524: .endif
1.171     christos  525: .if defined(SHLIB_FULLVERSION)
1.327     christos  526: _LIBS+=${_LIB.so.full}
1.27      pk        527: .endif
1.252     lukem     528: .endif                                                                 # }
1.27      pk        529:
1.279     lukem     530: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327     christos  531: _LIBS+=${_LIB.ln}
1.215     christos  532: .endif
1.27      pk        533:
1.234     lukem     534: ALLOBJS=
                    535: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    536:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.255     thorpej   537: ALLOBJS+=${STOBJS}
1.179     dmcmahil  538: .endif
1.234     lukem     539: ALLOBJS+=${POBJS} ${SOBJS}
1.279     lukem     540: .if ${MKLINT} != "no" && !empty(LOBJS)
1.179     dmcmahil  541: ALLOBJS+=${LOBJS}
1.216     christos  542: .endif
1.252     lukem     543: .else  # !defined(LIB)                                                 # } {
1.216     christos  544: LOBJS=
                    545: SOBJS=
1.252     lukem     546: .endif # !defined(LIB)                                                 # }
1.186     tv        547:
1.254     lukem     548: _YLSRCS=       ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.253     christos  549:
                    550: .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
1.158     christos  551:
1.327     christos  552: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug}
1.1       cgd       553:
1.296     perry     554: MKARZERO?=no
                    555:
                    556: .if ${MKARZERO} == "yes"
                    557: _ARFL=crsD
1.297     perry     558: _ARRANFL=sD
1.296     perry     559: _INSTRANLIB=
                    560: .else
                    561: _ARFL=crs
1.297     perry     562: _ARRANFL=s
1.296     perry     563: _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
                    564: .endif
                    565:
1.293     pooka     566: # If you change this, please consider reflecting the change in
                    567: # the override in sys/rump/Makefile.rump.
1.243     rtr       568: .if !target(__archivebuild)
1.90      christos  569: __archivebuild: .USE
1.238     lukem     570:        ${_MKTARGET_BUILD}
1.236     lukem     571:        rm -f ${.TARGET}
1.296     perry     572:        ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.243     rtr       573: .endif
1.89      christos  574:
1.243     rtr       575: .if !target(__archiveinstall)
1.89      christos  576: __archiveinstall: .USE
1.238     lukem     577:        ${_MKTARGET_INSTALL}
1.198     lukem     578:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.296     perry     579:            ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
1.243     rtr       580: .endif
1.89      christos  581:
1.197     mycroft   582: __archivesymlinkpic: .USE
1.238     lukem     583:        ${_MKTARGET_INSTALL}
1.264     jwise     584:        ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
1.197     mycroft   585:
1.253     christos  586: DPSRCS+=       ${_YLSRCS}
                    587: CLEANFILES+=   ${_YLSRCS}
1.230     lukem     588:
1.266     christos  589: ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
1.103     mycroft   590:
1.327     christos  591: ${_LIB.a}:: ${STOBJS} __archivebuild
1.1       cgd       592:
1.327     christos  593: ${_LIB_p.a}:: ${POBJS} __archivebuild
1.1       cgd       594:
1.327     christos  595: ${_LIB_pic.a}:: ${SOBJS} __archivebuild
1.27      pk        596:
1.327     christos  597: ${_LIB_g.a}:: ${GOBJS} __archivebuild
1.266     christos  598:
1.235     lukem     599:
                    600: _LIBLDOPTS=
                    601: .if ${SHLIBDIR} != "/usr/lib"
1.324     joerg     602: _LIBLDOPTS+=   -Wl,-rpath,${SHLIBDIR} \
                    603:                -L=${SHLIBDIR}
                    604: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
                    605: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
                    606:                -L=${SHLIBINSTALLDIR}
1.235     lukem     607: .endif
                    608:
1.277     christos  609: # gcc -shared now adds -lc automatically. For libraries other than libc and
                    610: # libgcc* we add as a dependency the installed shared libc. For libc and
                    611: # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
                    612: # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
                    613: # to add standard libraries, not the linker.
1.276     christos  614: .if !defined(LIB)
1.312     matt      615: .if !empty(LIBC_SO)
1.274     christos  616: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312     matt      617: .endif
1.276     christos  618: .else
1.278     simonb    619: .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
1.312     matt      620: .if !empty(LIBC_SO)
1.276     christos  621: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312     matt      622: .endif
1.277     christos  623: .else
1.278     simonb    624: LDLIBC ?= -nodefaultlibs
                    625: .if ${LIB} == "c"
1.318     mrg       626: LDADD+= -lgcc
1.278     simonb    627: .endif
1.276     christos  628: .endif
1.274     christos  629: .endif
                    630:
1.291     mrg       631: .if ${LIBISCXX} != "no"
                    632: LIBCC:=        ${CXX}
                    633: .else
                    634: LIBCC:=        ${CC}
                    635: .endif
                    636:
1.327     christos  637: _LDADD.${_LIB}=        ${LDADD} ${LDADD.${_LIB}}
                    638: _LDFLAGS.${_LIB}=      ${LDFLAGS} ${LDFLAGS.${_LIB}}
1.300     uebayasi  639:
1.327     christos  640: ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPLIBC} \
1.88      cgd       641:     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.238     lukem     642:        ${_MKTARGET_BUILD}
1.327     christos  643:        rm -f ${.TARGET}
                    644:        ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \
                    645:            ${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \
                    646:            -Wl,--whole-archive ${SOLIB} \
1.328     matt      647:            -Wl,--no-whole-archive ${_LDADD.${_LIB}}
1.196     lukem     648: #  We don't use INSTALL_SYMLINK here because this is just
                    649: #  happening inside the build directory/objdir. XXX Why does
                    650: #  this spend so much effort on libraries that aren't live??? XXX
1.284     lukem     651: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
                    652:     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327     christos  653:        ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
                    654:        mv -f ${_LIB.so.major}.tmp ${_LIB.so.major}
1.283     lukem     655: .endif
1.327     christos  656:        ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
                    657:        mv -f ${_LIB.so}.tmp ${_LIB.so}
1.286     joerg     658: .if ${MKSTRIPIDENT} != "no"
                    659:        ${OBJCOPY} -R .ident ${.TARGET}
                    660: .endif
1.35      pk        661:
1.327     christos  662: .if defined(_LIB.so.debug)
                    663: ${_LIB.so.debug}: ${_LIB.so.full}
1.307     lukem     664:        ${_MKTARGET_CREATE}
1.327     christos  665:        (  ${OBJCOPY} --only-keep-debug ${_LIB.so.full} ${_LIB.so.debug} \
1.309     lukem     666:        && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
1.327     christos  667:                --add-gnu-debuglink=${_LIB.so.debug} ${_LIB.so.full} \
                    668:        ) || (rm -f ${.TARGET}; false)
1.307     lukem     669: .endif
                    670:
1.252     lukem     671: .if !empty(LOBJS)                                                      # {
1.103     mycroft   672: LLIBS?=                -lc
1.327     christos  673: ${_LIB.ln}: ${LOBJS}
1.238     lukem     674:        ${_MKTARGET_COMPILE}
1.327     christos  675:        rm -f ${.TARGET}
1.206     thorpej   676: .if defined(DESTDIR)
1.228     lukem     677:        ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206     thorpej   678: .else
1.228     lukem     679:        ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206     thorpej   680: .endif
1.252     lukem     681: .endif                                                                 # }
1.1       cgd       682:
1.280     lukem     683: lint: ${LOBJS}
                    684: .if defined(LOBJS) && !empty(LOBJS)
                    685:        ${LINT} ${LINTFLAGS} ${LOBJS}
                    686: .endif
                    687:
1.327     christos  688:
1.317     apb       689: # If the number of entries in CLEANFILES is too large, then the
                    690: # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
                    691: # failed (Argument list too long)".  Avoid that by splitting the
                    692: # files to clean into several lists using different variable names.
                    693: # __cleanuse is an internal target in bsd.clean.mk; the way we
                    694: # use it here mimics the way it's used by the clean target in
                    695: # bsd.clean.mk.
                    696: #
                    697: clean: libclean1 libclean2 libclean3 libclean4 libclean5
                    698: libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
                    699: libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
                    700: libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
                    701: libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
                    702: libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
1.316     apb       703: CLEANFILES+= a.out [Ee]rrs mklog core *.core
1.327     christos  704: LIBCLEANFILES1+= ${_LIB.a}   ${STOBJS} ${STOBJS:=.tmp}
                    705: LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS}  ${POBJS:=.tmp}
                    706: LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS}  ${GOBJS:=.tmp}
                    707: LIBCLEANFILES4+= ${_LIB_pic.a}
                    708: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
                    709: LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug}
                    710: .endif
1.317     apb       711: LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
1.327     christos  712: LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS}
1.252     lukem     713:
                    714: .if !target(libinstall)                                                        # {
1.148     lukem     715: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139     tv        716: libinstall::
                    717:
1.234     lukem     718: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.327     christos  719: libinstall:: ${_DEST.LIB}/${_LIB.a}
                    720: .PRECIOUS: ${_DEST.LIB}/${_LIB.a}
1.197     mycroft   721:
1.269     dbj       722: .if ${MKUPDATE} == "no"
1.327     christos  723: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
                    724: ${_DEST.LIB}/${_LIB.a}! .MADE
1.89      christos  725: .endif
1.327     christos  726: ${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall
1.197     mycroft   727: .else
1.327     christos  728: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
                    729: ${_DEST.LIB}/${_LIB.a}: .MADE
1.89      christos  730: .endif
1.327     christos  731: ${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall
1.130     tv        732: .endif
1.197     mycroft   733: .endif
1.89      christos  734:
1.149     lukem     735: .if ${MKPROFILE} != "no"
1.327     christos  736: libinstall:: ${_DEST.LIB}/${_LIB_p.a}
                    737: .PRECIOUS: ${_DEST.LIB}/${_LIB_p.a}
1.197     mycroft   738:
1.269     dbj       739: .if ${MKUPDATE} == "no"
1.327     christos  740: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
                    741: ${_DEST.LIB}/${_LIB_p.a}! .MADE
1.32      pk        742: .endif
1.327     christos  743: ${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall
1.197     mycroft   744: .else
1.327     christos  745: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
                    746: ${_DEST.LIB}/${_LIB_p.a}: .MADE
1.89      christos  747: .endif
1.327     christos  748: ${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall
1.89      christos  749: .endif
1.197     mycroft   750: .endif
1.89      christos  751:
1.268     lukem     752: .if ${MKDEBUGLIB} != "no"
1.327     christos  753: libinstall:: ${_DEST.LIB}/${_LIB_g.a}
                    754: .PRECIOUS: ${_DEST.LIB}/${_LIB_g.a}
1.266     christos  755:
1.269     dbj       756: .if ${MKUPDATE} == "no"
1.329     spz       757: .if !defined(BUILD) && !make(all) && !make(${_LIB_g.a})
1.327     christos  758: ${_DEST.LIB}/${_LIB_g.a}! .MADE
1.266     christos  759: .endif
1.327     christos  760: ${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall
1.266     christos  761: .else
1.327     christos  762: .if !defined(BUILD) && !make(all) && !make(${LIB_g.a})
                    763: ${_DEST.LIB}/${_LIB_g.a}: .MADE
1.266     christos  764: .endif
1.327     christos  765: ${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall
1.266     christos  766: .endif
                    767: .endif
                    768:
1.149     lukem     769: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.327     christos  770: libinstall:: ${_DEST.LIB}/${_LIB_pic.a}
                    771: .PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a}
1.197     mycroft   772:
1.269     dbj       773: .if ${MKUPDATE} == "no"
1.327     christos  774: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
                    775: ${_DEST.LIB}/${_LIB_pic.a}! .MADE
1.89      christos  776: .endif
1.197     mycroft   777: .if ${MKPICLIB} == "no"
1.331     nakayama  778: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic
1.197     mycroft   779: .else
1.327     christos  780: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall
1.197     mycroft   781: .endif
                    782: .else
1.327     christos  783: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
                    784: ${_DEST.LIB}/${_LIB_pic.a}: .MADE
1.33      pk        785: .endif
1.160     simonb    786: .if ${MKPICLIB} == "no"
1.331     nakayama  787: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic
1.160     simonb    788: .else
1.327     christos  789: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall
1.160     simonb    790: .endif
1.89      christos  791: .endif
1.197     mycroft   792: .endif
1.89      christos  793:
1.171     christos  794: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.282     lukem     795:
1.327     christos  796: libinstall:: ${_DEST.OBJ}/${_LIB.so.full}
                    797: .PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full}
1.197     mycroft   798:
1.269     dbj       799: .if ${MKUPDATE} == "no"
1.327     christos  800: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
                    801: ${_DEST.OBJ}/${_LIB.so.full}! .MADE
1.89      christos  802: .endif
1.327     christos  803: ${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full}
1.197     mycroft   804: .else
1.327     christos  805: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
                    806: ${_DEST.OBJ}/${_LIB.so.full}: .MADE
1.89      christos  807: .endif
1.327     christos  808: ${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full}
1.197     mycroft   809: .endif
1.238     lukem     810:        ${_MKTARGET_INSTALL}
1.188     tv        811:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327     christos  812:            ${.ALLSRC} ${.TARGET}
1.195     lukem     813: .if ${_LIBSODIR} != ${LIBDIR}
1.327     christos  814:        ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
                    815:            ${_DEST.LIB}/${_LIB.so.full}
1.195     lukem     816: .endif
1.284     lukem     817: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
                    818:     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327     christos  819:        ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major}
1.195     lukem     820: .if ${_LIBSODIR} != ${LIBDIR}
1.327     christos  821:        ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
                    822:            ${_DEST.LIB}/${_LIB.so.major}
1.195     lukem     823: .endif
1.284     lukem     824: .endif
1.148     lukem     825: .if ${MKLINKLIB} != "no"
1.327     christos  826:        ${INSTALL_SYMLINK}  ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so}
1.195     lukem     827: .if ${_LIBSODIR} != ${LIBDIR}
1.327     christos  828:        ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
                    829:            ${_DEST.LIB}/${_LIB.so}
1.195     lukem     830: .endif
1.83      cgd       831: .endif
1.12      cgd       832: .endif
1.89      christos  833:
1.327     christos  834: .if defined(_LIB.so.debug)
                    835: libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug}
                    836: .PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug}
1.307     lukem     837:
1.327     christos  838: ${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug}
1.307     lukem     839:        ${_MKTARGET_INSTALL}
                    840:        ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
1.327     christos  841:            ${.ALLSRC} ${.TARGET}
1.307     lukem     842: .endif
                    843:
1.279     lukem     844: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327     christos  845: libinstall:: ${_DEST.LINT}/${_LIB.ln}
                    846: .PRECIOUS: ${_DEST.LINT}/${_LIB.ln}
1.197     mycroft   847:
1.269     dbj       848: .if ${MKUPDATE} == "no"
1.327     christos  849: .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
                    850: ${_DEST.LINT}/${_LIB.ln}! .MADE
1.89      christos  851: .endif
1.327     christos  852: ${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln}
1.197     mycroft   853: .else
1.327     christos  854: .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
                    855: ${_DEST.LINT}/${_LIB.ln}: .MADE
1.89      christos  856: .endif
1.327     christos  857: ${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln}
1.197     mycroft   858: .endif
1.238     lukem     859:        ${_MKTARGET_INSTALL}
1.188     tv        860:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327     christos  861:                ${.ALLSRC} ${_DEST.LINT}
1.58      cgd       862: .endif
1.252     lukem     863: .endif # !target(libinstall)                                           # }
1.1       cgd       864:
1.188     tv        865: ##### Pull in related .mk logic
1.298     apb       866: LINKSOWN?= ${LIBOWN}
                    867: LINKSGRP?= ${LIBGRP}
                    868: LINKSMODE?= ${LIBMODE}
1.1       cgd       869: .include <bsd.man.mk>
1.57      jtc       870: .include <bsd.nls.mk>
1.91      christos  871: .include <bsd.files.mk>
1.89      christos  872: .include <bsd.inc.mk>
1.109     cjs       873: .include <bsd.links.mk>
1.24      mycroft   874: .include <bsd.dep.mk>
1.315     joerg     875: .include <bsd.clang-analyze.mk>
1.316     apb       876: .include <bsd.clean.mk>
1.117     mycroft   877:
1.188     tv        878: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>