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

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

CVSweb <webmaster@jp.NetBSD.org>