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

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

CVSweb <webmaster@jp.NetBSD.org>