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

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

CVSweb <webmaster@jp.NetBSD.org>