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

1.334   ! christos    1: #      $NetBSD: bsd.lib.mk,v 1.333 2013/04/04 21:15:15 christos 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}
1.334   ! christos  447: _DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR}
1.327     christos  448:
1.252     lukem     449: .if defined(LIB)                                                       # {
1.234     lukem     450: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    451:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.327     christos  452: _LIBS=${_LIB.a}
1.130     tv        453: .else
                    454: _LIBS=
                    455: .endif
1.58      cgd       456:
1.321     matt      457: .if ${LIBISPRIVATE} != "no" \
                    458:    && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \
                    459:    && !defined(NOCOMBINE))                                             # {
                    460: .for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g}
                    461: COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
                    462: .if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f)
                    463: COMBINESRCS+=  ${f}
                    464: NODPSRCS+=     ${f}
                    465: .else
                    466: OBJS+=         ${f:R:S/$/.o/}
                    467: .endif
                    468: .endfor
                    469:
                    470: .if !empty(COMBINESRCS)
1.327     christos  471: OBJS+=         ${_LIB}_combine.o
                    472: ${_LIB}_combine.o: ${COMBINESRCS}
1.321     matt      473:        ${_MKTARGET_COMPILE}
                    474:        ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET}
1.333     christos  475: .if defined(LIBSTRIPOBJS)
1.321     matt      476:        ${OBJCOPY} -x ${.TARGET}
                    477: .endif
                    478:
1.327     christos  479: CLEANFILES+=   ${_LIB}_combine.d
1.321     matt      480:
1.327     christos  481: .if exists("${_LIB}_combine.d")
                    482: .include "${_LIB}_combine.d"
1.321     matt      483: .endif
                    484: .endif   # empty(XSRCS.${LIB})
                    485: .else                                                  # } {
1.167     matt      486: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.321     matt      487: .endif                                                 # }
1.158     christos  488:
1.255     thorpej   489: STOBJS+=${OBJS}
                    490:
1.280     lukem     491: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    492:
1.281     lukem     493: .if ${LIBISPRIVATE} != "no"
1.252     lukem     494: # No installation is required
                    495: libinstall::
1.306     lukem     496: .endif
1.252     lukem     497:
1.268     lukem     498: .if ${MKDEBUGLIB} != "no"
1.327     christos  499: _LIBS+=${_LIB_g.a}
1.266     christos  500: GOBJS+=${OBJS:.o=.go}
                    501: DEBUGFLAGS?=-DDEBUG
                    502: .endif
                    503:
1.149     lukem     504: .if ${MKPROFILE} != "no"
1.327     christos  505: _LIBS+=${_LIB_p.a}
1.167     matt      506: POBJS+=${OBJS:.o=.po}
1.262     christos  507: PROFFLAGS?=-DGPROF -DPROF
1.1       cgd       508: .endif
                    509:
1.252     lukem     510: .if ${MKPIC} != "no"                                                   # {
1.160     simonb    511: .if ${MKPICLIB} == "no"
1.205     yamt      512: .if ${MKSHLIBOBJS} != "no"
                    513: # make _pic.a, which isn't really pic,
                    514: # since it's needed for making shared lib.
                    515: # but don't install it.
1.327     christos  516: SOLIB=${_LIB_pic.a}
1.304     njoly     517: SOBJS+=${OBJS:.o=.pico}
1.205     yamt      518: .else
1.327     christos  519: SOLIB=${_LIB.a}
1.205     yamt      520: .endif
1.160     simonb    521: .else
1.327     christos  522: SOLIB=${_LIB_pic.a}
1.160     simonb    523: _LIBS+=${SOLIB}
1.304     njoly     524: SOBJS+=${OBJS:.o=.pico}
1.160     simonb    525: .endif
1.171     christos  526: .if defined(SHLIB_FULLVERSION)
1.327     christos  527: _LIBS+=${_LIB.so.full}
1.27      pk        528: .endif
1.252     lukem     529: .endif                                                                 # }
1.27      pk        530:
1.279     lukem     531: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327     christos  532: _LIBS+=${_LIB.ln}
1.215     christos  533: .endif
1.27      pk        534:
1.234     lukem     535: ALLOBJS=
                    536: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    537:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.255     thorpej   538: ALLOBJS+=${STOBJS}
1.179     dmcmahil  539: .endif
1.234     lukem     540: ALLOBJS+=${POBJS} ${SOBJS}
1.279     lukem     541: .if ${MKLINT} != "no" && !empty(LOBJS)
1.179     dmcmahil  542: ALLOBJS+=${LOBJS}
1.216     christos  543: .endif
1.252     lukem     544: .else  # !defined(LIB)                                                 # } {
1.216     christos  545: LOBJS=
                    546: SOBJS=
1.252     lukem     547: .endif # !defined(LIB)                                                 # }
1.186     tv        548:
1.254     lukem     549: _YLSRCS=       ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.253     christos  550:
                    551: .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
1.158     christos  552:
1.327     christos  553: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug}
1.1       cgd       554:
1.296     perry     555: MKARZERO?=no
                    556:
                    557: .if ${MKARZERO} == "yes"
                    558: _ARFL=crsD
1.297     perry     559: _ARRANFL=sD
1.296     perry     560: _INSTRANLIB=
                    561: .else
                    562: _ARFL=crs
1.297     perry     563: _ARRANFL=s
1.296     perry     564: _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
                    565: .endif
                    566:
1.293     pooka     567: # If you change this, please consider reflecting the change in
                    568: # the override in sys/rump/Makefile.rump.
1.243     rtr       569: .if !target(__archivebuild)
1.90      christos  570: __archivebuild: .USE
1.238     lukem     571:        ${_MKTARGET_BUILD}
1.236     lukem     572:        rm -f ${.TARGET}
1.296     perry     573:        ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.243     rtr       574: .endif
1.89      christos  575:
1.243     rtr       576: .if !target(__archiveinstall)
1.89      christos  577: __archiveinstall: .USE
1.238     lukem     578:        ${_MKTARGET_INSTALL}
1.198     lukem     579:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.296     perry     580:            ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
1.243     rtr       581: .endif
1.89      christos  582:
1.197     mycroft   583: __archivesymlinkpic: .USE
1.238     lukem     584:        ${_MKTARGET_INSTALL}
1.264     jwise     585:        ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
1.197     mycroft   586:
1.253     christos  587: DPSRCS+=       ${_YLSRCS}
                    588: CLEANFILES+=   ${_YLSRCS}
1.230     lukem     589:
1.266     christos  590: ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
1.103     mycroft   591:
1.327     christos  592: ${_LIB.a}:: ${STOBJS} __archivebuild
1.1       cgd       593:
1.327     christos  594: ${_LIB_p.a}:: ${POBJS} __archivebuild
1.1       cgd       595:
1.327     christos  596: ${_LIB_pic.a}:: ${SOBJS} __archivebuild
1.27      pk        597:
1.327     christos  598: ${_LIB_g.a}:: ${GOBJS} __archivebuild
1.266     christos  599:
1.235     lukem     600:
                    601: _LIBLDOPTS=
                    602: .if ${SHLIBDIR} != "/usr/lib"
1.324     joerg     603: _LIBLDOPTS+=   -Wl,-rpath,${SHLIBDIR} \
                    604:                -L=${SHLIBDIR}
                    605: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
                    606: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
                    607:                -L=${SHLIBINSTALLDIR}
1.235     lukem     608: .endif
                    609:
1.277     christos  610: # gcc -shared now adds -lc automatically. For libraries other than libc and
                    611: # libgcc* we add as a dependency the installed shared libc. For libc and
                    612: # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
                    613: # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
                    614: # to add standard libraries, not the linker.
1.276     christos  615: .if !defined(LIB)
1.312     matt      616: .if !empty(LIBC_SO)
1.274     christos  617: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312     matt      618: .endif
1.276     christos  619: .else
1.278     simonb    620: .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
1.312     matt      621: .if !empty(LIBC_SO)
1.276     christos  622: DPLIBC ?= ${DESTDIR}${LIBC_SO}
1.312     matt      623: .endif
1.277     christos  624: .else
1.278     simonb    625: LDLIBC ?= -nodefaultlibs
                    626: .if ${LIB} == "c"
1.318     mrg       627: LDADD+= -lgcc
1.278     simonb    628: .endif
1.276     christos  629: .endif
1.274     christos  630: .endif
                    631:
1.291     mrg       632: .if ${LIBISCXX} != "no"
                    633: LIBCC:=        ${CXX}
                    634: .else
                    635: LIBCC:=        ${CC}
                    636: .endif
                    637:
1.327     christos  638: _LDADD.${_LIB}=        ${LDADD} ${LDADD.${_LIB}}
                    639: _LDFLAGS.${_LIB}=      ${LDFLAGS} ${LDFLAGS.${_LIB}}
1.300     uebayasi  640:
1.327     christos  641: ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPLIBC} \
1.88      cgd       642:     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.238     lukem     643:        ${_MKTARGET_BUILD}
1.327     christos  644:        rm -f ${.TARGET}
                    645:        ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \
                    646:            ${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \
                    647:            -Wl,--whole-archive ${SOLIB} \
1.328     matt      648:            -Wl,--no-whole-archive ${_LDADD.${_LIB}}
1.196     lukem     649: #  We don't use INSTALL_SYMLINK here because this is just
                    650: #  happening inside the build directory/objdir. XXX Why does
                    651: #  this spend so much effort on libraries that aren't live??? XXX
1.284     lukem     652: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
                    653:     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327     christos  654:        ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
                    655:        mv -f ${_LIB.so.major}.tmp ${_LIB.so.major}
1.283     lukem     656: .endif
1.327     christos  657:        ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
                    658:        mv -f ${_LIB.so}.tmp ${_LIB.so}
1.286     joerg     659: .if ${MKSTRIPIDENT} != "no"
                    660:        ${OBJCOPY} -R .ident ${.TARGET}
                    661: .endif
1.35      pk        662:
1.327     christos  663: .if defined(_LIB.so.debug)
                    664: ${_LIB.so.debug}: ${_LIB.so.full}
1.307     lukem     665:        ${_MKTARGET_CREATE}
1.327     christos  666:        (  ${OBJCOPY} --only-keep-debug ${_LIB.so.full} ${_LIB.so.debug} \
1.309     lukem     667:        && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
1.327     christos  668:                --add-gnu-debuglink=${_LIB.so.debug} ${_LIB.so.full} \
                    669:        ) || (rm -f ${.TARGET}; false)
1.307     lukem     670: .endif
                    671:
1.252     lukem     672: .if !empty(LOBJS)                                                      # {
1.103     mycroft   673: LLIBS?=                -lc
1.327     christos  674: ${_LIB.ln}: ${LOBJS}
1.238     lukem     675:        ${_MKTARGET_COMPILE}
1.327     christos  676:        rm -f ${.TARGET}
1.206     thorpej   677: .if defined(DESTDIR)
1.228     lukem     678:        ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206     thorpej   679: .else
1.228     lukem     680:        ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206     thorpej   681: .endif
1.252     lukem     682: .endif                                                                 # }
1.1       cgd       683:
1.280     lukem     684: lint: ${LOBJS}
                    685: .if defined(LOBJS) && !empty(LOBJS)
                    686:        ${LINT} ${LINTFLAGS} ${LOBJS}
                    687: .endif
                    688:
1.327     christos  689:
1.317     apb       690: # If the number of entries in CLEANFILES is too large, then the
                    691: # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
                    692: # failed (Argument list too long)".  Avoid that by splitting the
                    693: # files to clean into several lists using different variable names.
                    694: # __cleanuse is an internal target in bsd.clean.mk; the way we
                    695: # use it here mimics the way it's used by the clean target in
                    696: # bsd.clean.mk.
                    697: #
                    698: clean: libclean1 libclean2 libclean3 libclean4 libclean5
                    699: libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
                    700: libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
                    701: libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
                    702: libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
                    703: libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
1.316     apb       704: CLEANFILES+= a.out [Ee]rrs mklog core *.core
1.327     christos  705: LIBCLEANFILES1+= ${_LIB.a}   ${STOBJS} ${STOBJS:=.tmp}
                    706: LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS}  ${POBJS:=.tmp}
                    707: LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS}  ${GOBJS:=.tmp}
                    708: LIBCLEANFILES4+= ${_LIB_pic.a}
                    709: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
                    710: LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug}
                    711: .endif
1.317     apb       712: LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
1.327     christos  713: LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS}
1.252     lukem     714:
                    715: .if !target(libinstall)                                                        # {
1.148     lukem     716: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139     tv        717: libinstall::
                    718:
1.234     lukem     719: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.327     christos  720: libinstall:: ${_DEST.LIB}/${_LIB.a}
                    721: .PRECIOUS: ${_DEST.LIB}/${_LIB.a}
1.197     mycroft   722:
1.269     dbj       723: .if ${MKUPDATE} == "no"
1.327     christos  724: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
                    725: ${_DEST.LIB}/${_LIB.a}! .MADE
1.89      christos  726: .endif
1.327     christos  727: ${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall
1.197     mycroft   728: .else
1.327     christos  729: .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
                    730: ${_DEST.LIB}/${_LIB.a}: .MADE
1.89      christos  731: .endif
1.327     christos  732: ${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall
1.130     tv        733: .endif
1.197     mycroft   734: .endif
1.89      christos  735:
1.149     lukem     736: .if ${MKPROFILE} != "no"
1.327     christos  737: libinstall:: ${_DEST.LIB}/${_LIB_p.a}
                    738: .PRECIOUS: ${_DEST.LIB}/${_LIB_p.a}
1.197     mycroft   739:
1.269     dbj       740: .if ${MKUPDATE} == "no"
1.327     christos  741: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
                    742: ${_DEST.LIB}/${_LIB_p.a}! .MADE
1.32      pk        743: .endif
1.327     christos  744: ${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall
1.197     mycroft   745: .else
1.327     christos  746: .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
                    747: ${_DEST.LIB}/${_LIB_p.a}: .MADE
1.89      christos  748: .endif
1.327     christos  749: ${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall
1.89      christos  750: .endif
1.197     mycroft   751: .endif
1.89      christos  752:
1.268     lukem     753: .if ${MKDEBUGLIB} != "no"
1.327     christos  754: libinstall:: ${_DEST.LIB}/${_LIB_g.a}
                    755: .PRECIOUS: ${_DEST.LIB}/${_LIB_g.a}
1.266     christos  756:
1.269     dbj       757: .if ${MKUPDATE} == "no"
1.329     spz       758: .if !defined(BUILD) && !make(all) && !make(${_LIB_g.a})
1.327     christos  759: ${_DEST.LIB}/${_LIB_g.a}! .MADE
1.266     christos  760: .endif
1.327     christos  761: ${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall
1.266     christos  762: .else
1.327     christos  763: .if !defined(BUILD) && !make(all) && !make(${LIB_g.a})
                    764: ${_DEST.LIB}/${_LIB_g.a}: .MADE
1.266     christos  765: .endif
1.327     christos  766: ${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall
1.266     christos  767: .endif
                    768: .endif
                    769:
1.149     lukem     770: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.327     christos  771: libinstall:: ${_DEST.LIB}/${_LIB_pic.a}
                    772: .PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a}
1.197     mycroft   773:
1.269     dbj       774: .if ${MKUPDATE} == "no"
1.327     christos  775: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
                    776: ${_DEST.LIB}/${_LIB_pic.a}! .MADE
1.89      christos  777: .endif
1.197     mycroft   778: .if ${MKPICLIB} == "no"
1.331     nakayama  779: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic
1.197     mycroft   780: .else
1.327     christos  781: ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall
1.197     mycroft   782: .endif
                    783: .else
1.327     christos  784: .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
                    785: ${_DEST.LIB}/${_LIB_pic.a}: .MADE
1.33      pk        786: .endif
1.160     simonb    787: .if ${MKPICLIB} == "no"
1.331     nakayama  788: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic
1.160     simonb    789: .else
1.327     christos  790: ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall
1.160     simonb    791: .endif
1.89      christos  792: .endif
1.197     mycroft   793: .endif
1.89      christos  794:
1.171     christos  795: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.282     lukem     796:
1.327     christos  797: libinstall:: ${_DEST.OBJ}/${_LIB.so.full}
                    798: .PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full}
1.197     mycroft   799:
1.269     dbj       800: .if ${MKUPDATE} == "no"
1.327     christos  801: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
                    802: ${_DEST.OBJ}/${_LIB.so.full}! .MADE
1.89      christos  803: .endif
1.327     christos  804: ${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full}
1.197     mycroft   805: .else
1.327     christos  806: .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
                    807: ${_DEST.OBJ}/${_LIB.so.full}: .MADE
1.89      christos  808: .endif
1.327     christos  809: ${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full}
1.197     mycroft   810: .endif
1.238     lukem     811:        ${_MKTARGET_INSTALL}
1.188     tv        812:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327     christos  813:            ${.ALLSRC} ${.TARGET}
1.195     lukem     814: .if ${_LIBSODIR} != ${LIBDIR}
1.327     christos  815:        ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
                    816:            ${_DEST.LIB}/${_LIB.so.full}
1.195     lukem     817: .endif
1.284     lukem     818: .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
                    819:     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
1.327     christos  820:        ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major}
1.195     lukem     821: .if ${_LIBSODIR} != ${LIBDIR}
1.327     christos  822:        ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
                    823:            ${_DEST.LIB}/${_LIB.so.major}
1.195     lukem     824: .endif
1.284     lukem     825: .endif
1.148     lukem     826: .if ${MKLINKLIB} != "no"
1.327     christos  827:        ${INSTALL_SYMLINK}  ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so}
1.195     lukem     828: .if ${_LIBSODIR} != ${LIBDIR}
1.327     christos  829:        ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
                    830:            ${_DEST.LIB}/${_LIB.so}
1.195     lukem     831: .endif
1.83      cgd       832: .endif
1.12      cgd       833: .endif
1.89      christos  834:
1.327     christos  835: .if defined(_LIB.so.debug)
                    836: libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug}
                    837: .PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug}
1.307     lukem     838:
1.327     christos  839: ${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug}
1.307     lukem     840:        ${_MKTARGET_INSTALL}
                    841:        ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
1.327     christos  842:            ${.ALLSRC} ${.TARGET}
1.334   ! christos  843: .if ${_LIBSODIR} != ${LIBDIR}
        !           844:        ${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \
        !           845:            ${_DEST.ODEBUG}/${_LIB.so.debug}
        !           846: .endif
1.307     lukem     847: .endif
                    848:
1.279     lukem     849: .if ${MKLINT} != "no" && !empty(LOBJS)
1.327     christos  850: libinstall:: ${_DEST.LINT}/${_LIB.ln}
                    851: .PRECIOUS: ${_DEST.LINT}/${_LIB.ln}
1.197     mycroft   852:
1.269     dbj       853: .if ${MKUPDATE} == "no"
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: .else
1.327     christos  859: .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
                    860: ${_DEST.LINT}/${_LIB.ln}: .MADE
1.89      christos  861: .endif
1.327     christos  862: ${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln}
1.197     mycroft   863: .endif
1.238     lukem     864:        ${_MKTARGET_INSTALL}
1.188     tv        865:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.327     christos  866:                ${.ALLSRC} ${_DEST.LINT}
1.58      cgd       867: .endif
1.252     lukem     868: .endif # !target(libinstall)                                           # }
1.1       cgd       869:
1.188     tv        870: ##### Pull in related .mk logic
1.298     apb       871: LINKSOWN?= ${LIBOWN}
                    872: LINKSGRP?= ${LIBGRP}
                    873: LINKSMODE?= ${LIBMODE}
1.1       cgd       874: .include <bsd.man.mk>
1.57      jtc       875: .include <bsd.nls.mk>
1.91      christos  876: .include <bsd.files.mk>
1.89      christos  877: .include <bsd.inc.mk>
1.109     cjs       878: .include <bsd.links.mk>
1.24      mycroft   879: .include <bsd.dep.mk>
1.315     joerg     880: .include <bsd.clang-analyze.mk>
1.316     apb       881: .include <bsd.clean.mk>
1.117     mycroft   882:
1.188     tv        883: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>