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

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

CVSweb <webmaster@jp.NetBSD.org>