Home | History | Annotate | Line # | Download | only in mk
bsd.lib.mk revision 1.406
      1 #	$NetBSD: bsd.lib.mk,v 1.406 2024/06/28 20:45:26 riastradh Exp $
      2 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
      3 
      4 .include <bsd.init.mk>
      5 .include <bsd.shlib.mk>
      6 .include <bsd.gcc.mk>
      7 .include <bsd.sanitizer.mk>
      8 
      9 # Pull in <bsd.sys.mk> here so we can override its .c.o rule
     10 .include <bsd.sys.mk>
     11 
     12 LIBISMODULE?=	no
     13 LIBISPRIVATE?=	no
     14 LIBISCXX?=	no
     15 
     16 .if ${LIBISMODULE} != "no"
     17 _LIB_PREFIX?=	# empty
     18 MKDEBUGLIB:=	no
     19 MKPROFILE:=	no
     20 MKPICINSTALL:=	no
     21 MAKESTATICLIB?=	no
     22 MAKELINKLIB?=	yes
     23 _LINTINSTALL?=	no
     24 .else
     25 _LIB_PREFIX?=	lib
     26 .endif
     27 
     28 .if ${LIBISPRIVATE} != "no"
     29 MKDEBUGLIB:=	no
     30 MKPROFILE:=	no
     31 MKPICINSTALL:=	no
     32 . if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
     33 MAKESTATICLIB?=	no
     34 . elif ${LIBISPRIVATE} != "pic"
     35 MKPIC:=		no
     36 . endif
     37 MAKELINKLIB?=	no
     38 _LINTINSTALL?=	no
     39 .endif
     40 
     41 _LINTINSTALL?=	${MKLINT}
     42 LINKINSTALL?=	${MAKELINKLIB}
     43 MAKELINKLIB?=	${MKLINKLIB}
     44 MAKESTATICLIB?=	${MKSTATICLIB}
     45 
     46 ##### Basic targets
     47 .PHONY:		checkver libinstall
     48 realinstall:	checkver libinstall
     49 
     50 ##### LIB specific flags.
     51 # XXX: This is needed for programs that link with .a libraries
     52 # Perhaps a more correct solution is to always generate _pic.a
     53 # files or always have a shared library.
     54 # Another fix is to provide rcrt0.o like OpenBSD does and
     55 # do relocations for static PIE.
     56 .if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
     57 CFLAGS+=        ${PIE_CFLAGS}
     58 AFLAGS+=        ${PIE_AFLAGS}
     59 .endif
     60 
     61 PGFLAGS+=	-pg
     62 .if ${MKPIC} != "no"
     63 PGFLAGS+=	-fPIC
     64 .endif
     65 
     66 ##### Libraries that this may depend upon.
     67 .if defined(LIBDPLIBS) && ${MKPIC} != "no"				# {
     68 .for _lib _dir in ${LIBDPLIBS}
     69 .if !defined(LIBDO.${_lib})
     70 LIBDO.${_lib}!=	cd "${_dir}" && ${PRINTOBJDIR}
     71 .MAKEOVERRIDES+=LIBDO.${_lib}
     72 .endif
     73 .if ${LIBDO.${_lib}} == "_external"
     74 LDADD+=		-l${_lib}
     75 .else
     76 LDADD+=		-L${LIBDO.${_lib}} -l${_lib}
     77 .if exists(${LIBDO.${_lib}}/lib${_lib}_pic.a)
     78 DPADD+=         ${LIBDO.${_lib}}/lib${_lib}_pic.a
     79 .elif exists(${LIBDO.${_lib}}/lib${_lib}.so)
     80 DPADD+=         ${LIBDO.${_lib}}/lib${_lib}.so
     81 .else
     82 DPADD+=         ${LIBDO.${_lib}}/lib${_lib}.a
     83 .endif
     84 .endif
     85 .endfor
     86 .endif									# }
     87 
     88 ##### Build and install rules
     89 MKDEP_SUFFIXES?=	.o .po .pico .go .ln .d
     90 
     91 .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})		# {
     92 SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
     93 SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
     94 SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
     95 
     96 DPADD+=	${SHLIB_VERSION_FILE}
     97 
     98 # Check for higher installed library versions.
     99 .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
    100 	exists(${NETBSDSRCDIR}/lib/checkver)
    101 checkver:
    102 	@(cd "${.CURDIR}" && \
    103 	    HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
    104 	    ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
    105 		    -d ${_DEST.OBJ} ${LIB})
    106 .endif
    107 .endif									# }
    108 
    109 .if !target(checkver)
    110 checkver:
    111 .endif
    112 
    113 print-shlib-major:
    114 .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
    115 	@echo ${SHLIB_MAJOR}
    116 .else
    117 	@false
    118 .endif
    119 
    120 print-shlib-minor:
    121 .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
    122 	@echo ${SHLIB_MINOR}
    123 .else
    124 	@false
    125 .endif
    126 
    127 print-shlib-teeny:
    128 .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
    129 	@echo ${SHLIB_TEENY}
    130 .else
    131 	@false
    132 .endif
    133 
    134 .if ${LIBISPRIVATE} == "no"
    135 .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)				# {
    136 .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
    137 .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
    138 SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
    139 .else
    140 SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
    141 .endif
    142 .else
    143 SHLIB_FULLVERSION=${SHLIB_MAJOR}
    144 .endif
    145 .endif									# }
    146 .endif
    147 
    148 # add additional suffixes not exported.
    149 # .po is used for profiling object files.
    150 # .pico is used for PIC object files.
    151 .SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .C .m .F .f .r .y .l .cl .p .h
    152 .SUFFIXES: .sh .m4 .m
    153 
    154 
    155 # Set PICFLAGS to cc flags for producing position-independent code,
    156 # if not already set.
    157 
    158 # Data-driven table using make variables to control how shared libraries
    159 # are built for different platforms and object formats.
    160 # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
    161 #			numbers of shared library
    162 # SHLIB_SOVERSION:	version number to be compiled into a shared library
    163 #			via -soname. Usually ${SHLIB_MAJOR} on ELF.
    164 #			NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
    165 #			[.${SHLIB_TEENY}]]
    166 # SHLIB_SHFLAGS:	Flags to tell ${LD} to emit shared library.
    167 #			with ELF, also set shared-lib version for ld.so.
    168 # SHLIB_LDSTARTFILE:	support .o file, call C++ file-level constructors
    169 # SHLIB_LDENDFILE:	support .o file, call C++ file-level destructors
    170 
    171 PICFLAGS ?= -fPIC
    172 
    173 .if ${MKPICLIB} != "no"
    174 CSHLIBFLAGS+= ${PICFLAGS} ${SANITIZERFLAGS} ${LIBCSANITIZERFLAGS}
    175 .endif
    176 
    177 .if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
    178 MKSHLIBOBJS= yes
    179 .else
    180 MKSHLIBOBJS= no
    181 .endif
    182 
    183 # Avoid adding "-g" if we already have a "-g*" option.
    184 .if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) && \
    185     (!defined(CFLAGS) || empty(CFLAGS:M-g*)) && \
    186     (!defined(CXXFLAGS) || empty(CXXFLAGS:M-g*))
    187 # We only add -g to the shared library objects
    188 # because we don't currently split .a archives.
    189 CSHLIBFLAGS+=	-g
    190 .if ${LIBISPRIVATE} != "no"
    191 CFLAGS+=	-g
    192 .endif
    193 .endif
    194 
    195 # Platform-independent linker flags for ELF shared libraries
    196 SHLIB_SOVERSION=	${SHLIB_MAJOR}
    197 SHLIB_SHFLAGS=		-Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION}
    198 SHLIB_SHFLAGS+=		${SANITIZERFLAGS}
    199 .if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no"
    200 SHLIB_SHFLAGS+=		-Wl,--warn-shared-textrel
    201 .endif
    202 .if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no"
    203 SHLIB_SHFLAGS+=		-Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map
    204 .endif
    205 CLEANFILES+=		${_LIB}.so.${SHLIB_SOVERSION}.map
    206 SHLIB_LDSTARTFILE?=	${_GCC_CRTI} ${_GCC_CRTBEGINS}
    207 SHLIB_LDENDFILE?=	${_GCC_CRTENDS} ${_GCC_CRTN}
    208 
    209 CFLAGS+=	${COPTS}
    210 OBJCFLAGS+=	${OBJCOPTS}
    211 AFLAGS+=	${COPTS}
    212 FFLAGS+=	${FOPTS}
    213 
    214 .if defined(CTFCONVERT)
    215 .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
    216 CTFFLAGS+=	-g
    217 .if defined(HAVE_GCC)
    218 #CFLAGS+=	-gdwarf-2
    219 .endif
    220 .endif
    221 .endif
    222 
    223 LIBSTRIPAOBJS=	yes
    224 .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    225 LIBSTRIPCOBJS=	yes
    226 .endif
    227 .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    228 LIBSTRIPOBJCOBJS=	yes
    229 .endif
    230 .if !defined(FFLAGS) || empty(FFLAGS:M*-g*)
    231 LIBSTRIPFOBJS=	yes
    232 .endif
    233 .if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*)
    234 LIBSTRIPSHLIBOBJS=	yes
    235 .endif
    236 
    237 .c.o:
    238 	${_MKTARGET_COMPILE}
    239 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} ${OBJECT_TARGET}
    240 	${CTFCONVERT_RUN}
    241 .if defined(LIBSTRIPCOBJS)
    242 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    243 .endif
    244 
    245 .c.po:
    246 	${_MKTARGET_COMPILE}
    247 	${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${PGFLAGS} ${.IMPSRC} ${OBJECT_TARGET}
    248 	${CTFCONVERT_RUN}
    249 .if defined(LIBSTRIPCOBJS)
    250 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    251 .endif
    252 
    253 .c.go:
    254 	${_MKTARGET_COMPILE}
    255 	${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
    256 
    257 .c.pico:
    258 	${_MKTARGET_COMPILE}
    259 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
    260 .if defined(LIBSTRIPSHLIBOBJS)
    261 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    262 .endif
    263 
    264 .cc.o .cpp.o .cxx.o .C.o:
    265 	${_MKTARGET_COMPILE}
    266 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    267 .if defined(LIBSTRIPCOBJS)
    268 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    269 .endif
    270 
    271 .cc.po .cpp.po .cxx.po .C.po:
    272 	${_MKTARGET_COMPILE}
    273 	${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${PGFLAGS} ${.IMPSRC} -o ${.TARGET}
    274 .if defined(LIBSTRIPCOBJS)
    275 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    276 .endif
    277 
    278 .cc.go .cpp.go .cxx.go .C.go:
    279 	${_MKTARGET_COMPILE}
    280 	${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
    281 
    282 .cc.pico .cpp.pico .cxx.pico .C.pico:
    283 	${_MKTARGET_COMPILE}
    284 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
    285 .if defined(LIBSTRIPSHLIBOBJS)
    286 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    287 .endif
    288 
    289 .f.o:
    290 	${_MKTARGET_COMPILE}
    291 	${COMPILE.f} ${.IMPSRC} ${OBJECT_TARGET}
    292 	${CTFCONVERT_RUN}
    293 .if defined(LIBSTRIPFOBJS)
    294 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    295 .endif
    296 
    297 .f.po:
    298 	${_MKTARGET_COMPILE}
    299 	${COMPILE.f} ${PROFFLAGS} ${PGFLAGS} ${.IMPSRC} ${OBJECT_TARGET}
    300 	${CTFCONVERT_RUN}
    301 .if defined(LIBSTRIPFOBJS)
    302 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    303 .endif
    304 
    305 .f.go:
    306 	${_MKTARGET_COMPILE}
    307 	${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
    308 
    309 .f.pico:
    310 	${_MKTARGET_COMPILE}
    311 	${COMPILE.f} ${PICFLAGS} ${.IMPSRC} -o ${.TARGET}
    312 .if defined(LIBSTRIPFOBJS)
    313 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    314 .endif
    315 
    316 .f.ln:
    317 	${_MKTARGET_COMPILE}
    318 	@echo Skipping lint for Fortran libraries.
    319 
    320 .m.o:
    321 	${_MKTARGET_COMPILE}
    322 	${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} ${OBJECT_TARGET}
    323 	${CTFCONVERT_RUN}
    324 .if defined(LIBSTRIPOBJCOBJS)
    325 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    326 .endif
    327 
    328 .m.po:
    329 	${_MKTARGET_COMPILE}
    330 	${COMPILE.m} ${PROFFLAGS} ${PGFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} ${OBJECT_TARGET}
    331 	${CTFCONVERT_RUN}
    332 .if defined(LIBSTRIPOBJCOBJS)
    333 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    334 .endif
    335 
    336 .m.go:
    337 	${_MKTARGET_COMPILE}
    338 	${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    339 .if defined(LIBSTRIPOBJCOBJS)
    340 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    341 .endif
    342 
    343 .m.pico:
    344 	${_MKTARGET_COMPILE}
    345 	${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    346 .if defined(LIBSTRIPOBJCOBJS)
    347 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    348 .endif
    349 
    350 .s.o:
    351 	${_MKTARGET_COMPILE}
    352 	${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} ${OBJECT_TARGET}
    353 	${CTFCONVERT_RUN}
    354 .if defined(LIBSTRIPAOBJS)
    355 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    356 .endif
    357 
    358 .S.o:
    359 	${_MKTARGET_COMPILE}
    360 	${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} ${OBJECT_TARGET}
    361 	${CTFCONVERT_RUN}
    362 .if defined(LIBSTRIPAOBJS)
    363 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    364 .endif
    365 
    366 .s.po:
    367 	${_MKTARGET_COMPILE}
    368 	${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} ${OBJECT_TARGET}
    369 	${CTFCONVERT_RUN}
    370 .if defined(LIBSTRIPAOBJS)
    371 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    372 .endif
    373 
    374 .S.po:
    375 	${_MKTARGET_COMPILE}
    376 	${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} ${OBJECT_TARGET}
    377 	${CTFCONVERT_RUN}
    378 .if defined(LIBSTRIPAOBJS)
    379 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    380 .endif
    381 
    382 .s.go:
    383 	${_MKTARGET_COMPILE}
    384 	${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    385 
    386 .S.go:
    387 	${_MKTARGET_COMPILE}
    388 	${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    389 
    390 .s.pico:
    391 	${_MKTARGET_COMPILE}
    392 	${COMPILE.s} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    393 .if defined(LIBSTRIPAOBJS)
    394 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    395 .endif
    396 
    397 .S.pico:
    398 	${_MKTARGET_COMPILE}
    399 	${COMPILE.S} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    400 .if defined(LIBSTRIPAOBJS)
    401 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    402 .endif
    403 
    404 # Declare a few variables to make our life easier later.
    405 _LIB:=${_LIB_PREFIX}${LIB}
    406 _LIB.a:=${_LIB}.a
    407 _LIB_p.a:=${_LIB}_p.a
    408 _LIB_g.a:=${_LIB}_g.a
    409 _LIB_pic.a:=${_LIB}_pic.a
    410 _LIB.ln:=llib-l${LIB}.ln
    411 
    412 .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    413 _LIB.so:=${_LIB}.so
    414 _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR}
    415 _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION}
    416 _LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link
    417 .if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG)
    418 _LIB.so.debug:=${_LIB.so.full}.debug
    419 .endif
    420 .endif
    421 
    422 _DEST.LIB:=${DESTDIR}${LIBDIR}
    423 _DEST.OBJ:=${DESTDIR}${_LIBSODIR}
    424 _DEST.LINT:=${DESTDIR}${LINTLIBDIR}
    425 _DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR}
    426 _DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR}
    427 
    428 .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    429     || ${MAKELINKLIB} != "no" || ${MAKESTATICLIB} != "no"
    430 _BUILDSTATICLIB=yes
    431 .else
    432 _BUILDSTATICLIB=no
    433 .endif
    434 
    435 .if defined(LIB)							# {
    436 .if ${_BUILDSTATICLIB} != "no"
    437 _LIBS=${_LIB.a}
    438 .else
    439 _LIBS=
    440 .endif
    441 
    442 OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
    443 
    444 STOBJS+=${OBJS}
    445 
    446 LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
    447 
    448 .if ${LIBISPRIVATE} != "no"
    449 # No installation is required
    450 libinstall::
    451 .endif
    452 
    453 .if ${MKDEBUGLIB} != "no"
    454 _LIBS+=${_LIB_g.a}
    455 GOBJS+=${OBJS:.o=.go}
    456 DEBUGFLAGS?=-DDEBUG
    457 .endif
    458 
    459 .if ${MKPROFILE} != "no"
    460 _LIBS+=${_LIB_p.a}
    461 POBJS+=${OBJS:.o=.po}
    462 PROFFLAGS?=-DGPROF -DPROF
    463 .endif
    464 
    465 .if ${MKPIC} != "no"							# {
    466 .if ${MKPICLIB} == "no"
    467 .if ${MKSHLIBOBJS} != "no"
    468 # make _pic.a, which isn't really pic,
    469 # since it's needed for making shared lib.
    470 # but don't install it.
    471 SOLIB=${_LIB_pic.a}
    472 SOBJS+=${OBJS:.o=.pico}
    473 .else
    474 SOLIB=${_LIB.a}
    475 .endif
    476 .else
    477 SOLIB=${_LIB_pic.a}
    478 _LIBS+=${SOLIB}
    479 SOBJS+=${OBJS:.o=.pico}
    480 .endif
    481 .if defined(SHLIB_FULLVERSION)
    482 _LIBS+=${_LIB.so.full}
    483 .endif
    484 .endif									# }
    485 
    486 .if ${MKLINT} != "no" && !empty(LOBJS)
    487 _LIBS+=${_LIB.ln}
    488 .endif
    489 
    490 ALLOBJS=
    491 .if ${_BUILDSTATICLIB} != "no"
    492 ALLOBJS+=${STOBJS}
    493 .endif
    494 ALLOBJS+=${POBJS} ${SOBJS}
    495 .if ${MKLINT} != "no" && !empty(LOBJS)
    496 ALLOBJS+=${LOBJS}
    497 .endif
    498 .else	# !defined(LIB)							# } {
    499 LOBJS=
    500 SOBJS=
    501 .endif	# !defined(LIB)							# }
    502 
    503 _YLSRCS=	${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
    504 
    505 .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
    506 
    507 realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug}
    508 
    509 .if ${MKARZERO} == "yes"
    510 _ARFL=crsD
    511 _ARRANFL=sD
    512 _INSTRANLIB=
    513 .else
    514 _ARFL=crs
    515 _ARRANFL=s
    516 _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
    517 .endif
    518 
    519 # If you change this, please consider reflecting the change in
    520 # the override in sys/rump/Makefile.rump.
    521 .if !target(__archivebuild)
    522 __archivebuild: .USE
    523 	${_MKTARGET_BUILD}
    524 	@rm -f ${.TARGET}
    525 	${AR} ${_ARFL} ${.TARGET} $$(NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT})
    526 .endif
    527 
    528 .if !target(__archiveinstall)
    529 __archiveinstall: .USE
    530 	${_MKTARGET_INSTALL}
    531 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    532 	    ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
    533 .endif
    534 
    535 __archivesymlinkpic: .USE
    536 	${_MKTARGET_INSTALL}
    537 	${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
    538 
    539 .if !target(__buildstdlib)
    540 __buildstdlib: .USE
    541 	@echo building standard ${.TARGET:T:S/.o//:S/lib//} library
    542 	@rm -f ${.TARGET}
    543 	@${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -Wno-unused-command-line-argument -r -o ${.TARGET} $$(NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT})
    544 .endif
    545 
    546 .if !target(__buildproflib)
    547 __buildproflib: .USE
    548 	@echo building profiled ${.TARGET:T:S/.o//:S/lib//} library
    549 	${_MKTARGET_BUILD}
    550 	@rm -f ${.TARGET}
    551 	@${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} $$(NM=${NM} ${LORDER} ${.ALLSRC:M*po} | ${TSORT})
    552 .endif
    553 
    554 DPSRCS+=	${_YLSRCS}
    555 CLEANFILES+=	${_YLSRCS}
    556 
    557 ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
    558 
    559 ${_LIB.a}:: ${STOBJS} __archivebuild
    560 
    561 ${_LIB_p.a}:: ${POBJS} __archivebuild
    562 
    563 ${_LIB_pic.a}:: ${SOBJS} __archivebuild
    564 
    565 ${_LIB_g.a}:: ${GOBJS} __archivebuild
    566 
    567 
    568 _LIBLDOPTS=
    569 .if ${SHLIBDIR} != "/usr/lib"
    570 _LIBLDOPTS+=	-Wl,-rpath,${SHLIBDIR} \
    571 		-L=${SHLIBDIR}
    572 .elif ${SHLIBINSTALLDIR} != "/usr/lib"
    573 _LIBLDOPTS+=	-Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
    574 		-L=${SHLIBINSTALLDIR}
    575 .endif
    576 .if ${MKSTRIPSYM} != "no"
    577 _LIBLDOPTS+=	-Wl,-x
    578 .else
    579 _LIBLDOPTS+=	-Wl,-X
    580 .endif
    581 
    582 # gcc -shared now adds -lc automatically. For libraries other than libc and
    583 # libgcc* we add as a dependency the installed shared libc. For libc and
    584 # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
    585 # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
    586 # to add standard libraries, not the linker.
    587 .if !defined(LIB)
    588 .if !empty(LIBC_SO)
    589 DPLIBC ?= ${DESTDIR}${LIBC_SO}
    590 .endif
    591 .else
    592 .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
    593 .if !empty(LIBC_SO)
    594 DPLIBC ?= ${DESTDIR}${LIBC_SO}
    595 .endif
    596 .else
    597 LDLIBC ?= -nodefaultlibs
    598 .if ${HAVE_LIBGCC} == "yes" && ${LIB} == "c"
    599 LDADD+= -lgcc
    600 .endif
    601 .endif
    602 .endif
    603 
    604 .if ${LIBISCXX} != "no"
    605 LIBCC:=	${CXX}
    606 . if ${MKLIBCXX} == "yes"
    607 LIBDPLIBS+=     c++	${.CURDIR}/../../../../../external/bsd/libc++/lib
    608 . else
    609 LIBDPLIBS+=     stdc++	${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3
    610 . endif
    611 .else
    612 LIBCC:=	${CC}
    613 .endif
    614 
    615 # VERSION_MAP
    616 #
    617 #	Path to an ld version script to use when linking the library.
    618 #	If a relative path, interpreted relative to the object
    619 #	directory; use ${.CURDIR}/foo.map if foo.map is in the source
    620 #	directory.  Interpretation of relative path may be changed
    621 #	later to search .PATH like target prerequisites.
    622 #
    623 #	Implemented by adding -Wl,--version-script=${VERSION_MAP} to
    624 #	LDFLAGS.
    625 #
    626 .if !empty(VERSION_MAP)
    627 # It is tempting to use the make :P modifier here so that you can just
    628 # write
    629 #
    630 #	VERSION_MAP=	foo.map
    631 #
    632 # instead of
    633 #
    634 #	VERSION_MAP=	${.CURDIR}/foo.map
    635 #
    636 # but it appears that :P works _only_ with literal names, not with
    637 # expansions, so while you could write
    638 #
    639 #	VERSION_MAP=	${foo.map:P}
    640 #
    641 # in the makefile, we can't set
    642 #
    643 #	LDFLAGS+=	-Wl,--version-script=${${VERSION_MAP}:P}
    644 #
    645 # here.
    646 DPADD+=			${VERSION_MAP}
    647 LDFLAGS+=		-Wl,--version-script=${VERSION_MAP}
    648 .endif
    649 
    650 _LDADD.${_LIB}=	${LDADD} ${LDADD.${_LIB}}
    651 _LDFLAGS.${_LIB}=	${LDFLAGS} ${LDFLAGS.${_LIB}}
    652 
    653 _MAINLIBDEPS=	${SOLIB} ${DPADD} ${DPLIBC} \
    654 		${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
    655 
    656 .if defined(_LIB.so.debug)
    657 ${_LIB.so.debug}: ${_LIB.so.link}
    658 	${_MKTARGET_CREATE}
    659 	( ${OBJCOPY} --only-keep-debug --compress-debug-sections \
    660 	    ${_LIB.so.link} ${_LIB.so.debug} \
    661 	) || (rm -f ${.TARGET}; false)
    662 ${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug}
    663 	${_MKTARGET_CREATE}
    664 	(  ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
    665 	    --add-gnu-debuglink=${_LIB.so.debug} \
    666 	    ${_LIB.so.link} ${_LIB.so.full}.tmp && \
    667 	    ${MV} ${_LIB.so.full}.tmp ${_LIB.so.full} \
    668 	) || (rm -f ${.TARGET}; false)
    669 ${_LIB.so.link}: ${_MAINLIBDEPS}
    670 .else # aka no MKDEBUG
    671 ${_LIB.so.full}: ${_MAINLIBDEPS}
    672 .endif
    673 	${_MKTARGET_BUILD}
    674 	rm -f ${.TARGET}
    675 	${LIBCC} ${LDLIBC} -shared ${SHLIB_SHFLAGS} \
    676 	    ${_LDFLAGS.${_LIB}} -o ${.TARGET}.tmp ${_LIBLDOPTS} \
    677 	    -Wl,--whole-archive ${SOLIB} \
    678 	    -Wl,--no-whole-archive ${_LDADD.${_LIB}}
    679 .if ${MKSTRIPIDENT} != "no"
    680 	${OBJCOPY} -R .ident ${.TARGET}.tmp
    681 .endif
    682 	${MV} ${.TARGET}.tmp ${.TARGET}
    683 #  We don't use INSTALL_SYMLINK here because this is just
    684 #  happening inside the build directory/objdir. XXX Why does
    685 #  this spend so much effort on libraries that aren't live??? XXX
    686 #  XXX Also creates dead symlinks until the .full rule runs
    687 #  above and creates the main link
    688 .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    689     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    690 	${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
    691 	${MV} ${_LIB.so.major}.tmp ${_LIB.so.major}
    692 .endif
    693 	${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
    694 	${MV} ${_LIB.so}.tmp ${_LIB.so}
    695 
    696 # If there's a file listing expected symbols, fail if the diff from it
    697 # to the actual symbols is nonempty, and show the diff in that case.
    698 .if exists(${.CURDIR}/${LIB}.${LIBC_MACHINE_ARCH:U${MACHINE_ARCH}}.expsym)
    699 LIB_EXPSYM?=	${LIB}.${LIBC_MACHINE_ARCH:U${MACHINE_ARCH}}.expsym
    700 .elif exists(${.CURDIR}/${LIB}.${LIBC_MACHINE_CPU:U${MACHINE_CPU}}.expsym)
    701 LIB_EXPSYM?=	${LIB}.${LIBC_MACHINE_CPU:U${MACHINE_CPU}}.expsym
    702 .elif exists(${.CURDIR}/${LIB}.expsym)
    703 LIB_EXPSYM?=	${LIB}.expsym
    704 .endif
    705 
    706 .if !empty(LIB_EXPSYM) && ${MKPIC} != "no"
    707 realall: ${_LIB.so.full}.diffsym
    708 ${_LIB.so.full}.diffsym: ${LIB_EXPSYM} ${_LIB.so.full}.actsym
    709 	${_MKTARGET_CREATE}
    710 	if diff -u ${.ALLSRC} >${.TARGET}.tmp; then \
    711 		${MV} ${.TARGET}.tmp ${.TARGET}; \
    712 	else \
    713 		ret=$$?; \
    714 		cat ${.TARGET}.tmp; \
    715 		echo ${_LIB.so.full}: error: \
    716 			actual symbols differ from expected symbols >&2; \
    717 		exit $$ret; \
    718 	fi
    719 ${_LIB.so.full}.actsym: ${_LIB.so.full}
    720 	${_MKTARGET_CREATE}
    721 	${NM} --dynamic --extern-only --defined-only --with-symbol-versions \
    722 		${.ALLSRC} \
    723 	| cut -d' ' -f3 | LANG=C sort -u >${.TARGET}.tmp
    724 	${MV} ${.TARGET}.tmp ${.TARGET}
    725 CLEANFILES+=	${_LIB.so.full}.actsym
    726 CLEANFILES+=	${_LIB.so.full}.actsym.tmp
    727 CLEANFILES+=	${_LIB.so.full}.diffsym
    728 CLEANFILES+=	${_LIB.so.full}.diffsym.tmp
    729 update-symbols: .PHONY
    730 update-symbols: ${_LIB.so.full}.actsym
    731 	cp ${.ALLSRC} ${.CURDIR}/${LIB_EXPSYM}
    732 .endif
    733 
    734 .if !empty(LOBJS)							# {
    735 LLIBS?=		-lc
    736 ${_LIB.ln}: ${LOBJS}
    737 	${_MKTARGET_COMPILE}
    738 	rm -f ${.TARGET}
    739 .if defined(DESTDIR)
    740 	${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
    741 .else
    742 	${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
    743 .endif
    744 .endif									# }
    745 
    746 lint: ${LOBJS}
    747 .if defined(LOBJS) && !empty(LOBJS)
    748 	${LINT} ${LINTFLAGS} ${LOBJS}
    749 .endif
    750 
    751 
    752 # If the number of entries in CLEANFILES is too large, then the
    753 # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
    754 # failed (Argument list too long)".  Avoid that by splitting the
    755 # files to clean into several lists using different variable names.
    756 # __cleanuse is an internal target in bsd.clean.mk; the way we
    757 # use it here mimics the way it's used by the clean target in
    758 # bsd.clean.mk.
    759 #
    760 clean: libclean1 libclean2 libclean3 libclean4 libclean5
    761 libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
    762 libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
    763 libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
    764 libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
    765 libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
    766 CLEANFILES+= a.out [Ee]rrs mklog core *.core
    767 LIBCLEANFILES1+= ${_LIB.a}   ${STOBJS} ${STOBJS:=.tmp}
    768 LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS}  ${POBJS:=.tmp}
    769 LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS}  ${GOBJS:=.tmp}
    770 LIBCLEANFILES4+= ${_LIB_pic.a}
    771 .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    772 LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug}
    773 .endif
    774 LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
    775 LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS}
    776 
    777 .if !target(libinstall)							# {
    778 # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
    779 libinstall::
    780 
    781 .if ${MAKELINKLIB} != "no" && ${MAKESTATICLIB} != "no" && ${LINKINSTALL} != "no"
    782 libinstall:: ${_DEST.LIB}/${_LIB.a}
    783 .PRECIOUS: ${_DEST.LIB}/${_LIB.a}
    784 
    785 .if ${MKUPDATE} == "no"
    786 .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
    787 ${_DEST.LIB}/${_LIB.a}! .MADE
    788 .endif
    789 ${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall
    790 .else
    791 .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
    792 ${_DEST.LIB}/${_LIB.a}: .MADE
    793 .endif
    794 ${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall
    795 .endif
    796 .endif
    797 
    798 .if ${MKPROFILE} != "no"
    799 libinstall:: ${_DEST.LIB}/${_LIB_p.a}
    800 .PRECIOUS: ${_DEST.LIB}/${_LIB_p.a}
    801 
    802 .if ${MKUPDATE} == "no"
    803 .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
    804 ${_DEST.LIB}/${_LIB_p.a}! .MADE
    805 .endif
    806 ${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall
    807 .else
    808 .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
    809 ${_DEST.LIB}/${_LIB_p.a}: .MADE
    810 .endif
    811 ${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall
    812 .endif
    813 .endif
    814 
    815 .if ${MKDEBUGLIB} != "no"
    816 libinstall:: ${_DEST.LIB}/${_LIB_g.a}
    817 .PRECIOUS: ${_DEST.LIB}/${_LIB_g.a}
    818 
    819 .if ${MKUPDATE} == "no"
    820 .if !defined(BUILD) && !make(all) && !make(${_LIB_g.a})
    821 ${_DEST.LIB}/${_LIB_g.a}! .MADE
    822 .endif
    823 ${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall
    824 .else
    825 .if !defined(BUILD) && !make(all) && !make(${LIB_g.a})
    826 ${_DEST.LIB}/${_LIB_g.a}: .MADE
    827 .endif
    828 ${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall
    829 .endif
    830 .endif
    831 
    832 .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
    833 libinstall:: ${_DEST.LIB}/${_LIB_pic.a}
    834 .PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a}
    835 
    836 .if ${MKUPDATE} == "no"
    837 .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
    838 ${_DEST.LIB}/${_LIB_pic.a}! .MADE
    839 .endif
    840 .if ${MKPICLIB} == "no"
    841 ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic
    842 .else
    843 ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall
    844 .endif
    845 .else
    846 .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
    847 ${_DEST.LIB}/${_LIB_pic.a}: .MADE
    848 .endif
    849 .if ${MKPICLIB} == "no"
    850 ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic
    851 .else
    852 ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall
    853 .endif
    854 .endif
    855 .endif
    856 
    857 .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    858 
    859 libinstall:: ${_DEST.OBJ}/${_LIB.so.full}
    860 .PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full}
    861 
    862 .if ${MKUPDATE} == "no"
    863 .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
    864 ${_DEST.OBJ}/${_LIB.so.full}! .MADE
    865 .endif
    866 ${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full}
    867 .else
    868 .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
    869 ${_DEST.OBJ}/${_LIB.so.full}: .MADE
    870 .endif
    871 ${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full}
    872 .endif
    873 	${_MKTARGET_INSTALL}
    874 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    875 	    ${.ALLSRC} ${.TARGET}
    876 .if ${_LIBSODIR} != ${LIBDIR}
    877 	${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
    878 	    ${_DEST.LIB}/${_LIB.so.full}
    879 .endif
    880 .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    881     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    882 	${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major}
    883 .if ${_LIBSODIR} != ${LIBDIR}
    884 	${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
    885 	    ${_DEST.LIB}/${_LIB.so.major}
    886 .endif
    887 .endif
    888 .if ${MAKELINKLIB} != "no" && ${LINKINSTALL} != "no"
    889 	${INSTALL_SYMLINK}  ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so}
    890 .if ${_LIBSODIR} != ${LIBDIR}
    891 	${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
    892 	    ${_DEST.LIB}/${_LIB.so}
    893 .endif
    894 .endif
    895 .endif
    896 
    897 .if defined(_LIB.so.debug)
    898 libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug}
    899 .PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug}
    900 
    901 ${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug}
    902 	${_MKTARGET_INSTALL}
    903 	${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
    904 	    ${.ALLSRC} ${.TARGET}
    905 .if ${_LIBSODIR} != ${LIBDIR}
    906 	${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \
    907 	    ${_DEST.ODEBUG}/${_LIB.so.debug}
    908 .endif
    909 .endif
    910 
    911 .if ${_LINTINSTALL} != "no" && !empty(LOBJS)
    912 libinstall:: ${_DEST.LINT}/${_LIB.ln}
    913 .PRECIOUS: ${_DEST.LINT}/${_LIB.ln}
    914 
    915 .if ${MKUPDATE} == "no"
    916 .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
    917 ${_DEST.LINT}/${_LIB.ln}! .MADE
    918 .endif
    919 ${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln}
    920 .else
    921 .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
    922 ${_DEST.LINT}/${_LIB.ln}: .MADE
    923 .endif
    924 ${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln}
    925 .endif
    926 	${_MKTARGET_INSTALL}
    927 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    928 		${.ALLSRC} ${_DEST.LINT}
    929 .endif
    930 .endif	# !target(libinstall)						# }
    931 
    932 ##### Pull in related .mk logic
    933 LINKSOWN?= ${LIBOWN}
    934 LINKSGRP?= ${LIBGRP}
    935 LINKSMODE?= ${LIBMODE}
    936 .include <bsd.man.mk>
    937 .include <bsd.nls.mk>
    938 .include <bsd.files.mk>
    939 .include <bsd.inc.mk>
    940 .include <bsd.links.mk>
    941 .include <bsd.dep.mk>
    942 .include <bsd.clang-analyze.mk>
    943 .include <bsd.clean.mk>
    944 
    945 ${TARGETS}:	# ensure existence
    946