1# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 2# $FreeBSD$ 3# 4 5.include <bsd.init.mk> 6.include <bsd.compiler.mk> 7.include <bsd.linker.mk> 8 9.if defined(LIB_CXX) || defined(SHLIB_CXX) 10_LD= ${CXX} 11.else 12_LD= ${CC} 13.endif 14.if defined(LIB_CXX) 15LIB= ${LIB_CXX} 16.endif 17.if defined(SHLIB_CXX) 18SHLIB= ${SHLIB_CXX} 19.endif 20 21LIB_PRIVATE= ${PRIVATELIB:Dprivate} 22# Set up the variables controlling shared libraries. After this section, 23# SHLIB_NAME will be defined only if we are to create a shared library. 24# SHLIB_LINK will be defined only if we are to create a link to it. 25# INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive. 26# BUILD_NOSSP_PIC_ARCHIVE will be defined only if we are to create a PIC archive. 27.if defined(NO_PIC) 28.undef SHLIB_NAME 29.undef INSTALL_PIC_ARCHIVE 30.undef BUILD_NOSSP_PIC_ARCHIVE 31.else 32.if !defined(SHLIB) && defined(LIB) 33SHLIB= ${LIB} 34.endif 35.if !defined(SHLIB_NAME) && defined(SHLIB) && defined(SHLIB_MAJOR) 36SHLIB_NAME= lib${LIB_PRIVATE}${SHLIB}.so.${SHLIB_MAJOR} 37.endif 38.if defined(SHLIB_NAME) && !empty(SHLIB_NAME:M*.so.*) 39SHLIB_LINK?= ${SHLIB_NAME:R} 40.endif 41SONAME?= ${SHLIB_NAME} 42.endif 43 44.if defined(CRUNCH_CFLAGS) 45CFLAGS+= ${CRUNCH_CFLAGS} 46.endif 47 48.if ${MK_ASSERT_DEBUG} == "no" 49CFLAGS+= -DNDEBUG 50NO_WERROR= 51.endif 52 53.if defined(DEBUG_FLAGS) 54CFLAGS+= ${DEBUG_FLAGS} 55 56.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" 57CTFFLAGS+= -g 58.endif 59.else 60STRIP?= -s 61.endif 62 63.if ${SHLIBDIR:M*lib32*} 64TAGS+= lib32 65.endif 66 67.if defined(NO_ROOT) 68.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 69TAGS+= package=${PACKAGE:Uutilities} 70.endif 71TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 72.endif 73 74# ELF hardening knobs 75.if ${MK_BIND_NOW} != "no" 76LDFLAGS+= -Wl,-znow 77.endif 78.if ${MK_RETPOLINE} != "no" 79.if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline} 80CFLAGS+= -mretpoline 81CXXFLAGS+= -mretpoline 82LDFLAGS+= -Wl,-zretpolineplt 83.else 84.warning Retpoline requested but not supported by compiler or linker 85.endif 86.endif 87 88.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ 89 empty(DEBUG_FLAGS:M-gdwarf*) 90CFLAGS+= ${DEBUG_FILES_CFLAGS} 91CXXFLAGS+= ${DEBUG_FILES_CFLAGS} 92CTFFLAGS+= -g 93.endif 94 95# clang currently defaults to dynamic TLS for mips64 object files without -fPIC 96.if ${MACHINE_ARCH:Mmips64*} && ${COMPILER_TYPE} == "clang" 97STATIC_CFLAGS+= -ftls-model=initial-exec 98STATIC_CXXFLAGS+= -ftls-model=initial-exec 99.endif 100 101.include <bsd.libnames.mk> 102 103# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries 104# .pico used for PIC object files 105# .nossppico used for NOSSP PIC object files 106# .pieo used for PIE object files 107.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .pieo .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln 108 109.if !defined(PICFLAG) 110.if ${MACHINE_CPUARCH} == "sparc64" 111PICFLAG=-fPIC 112PIEFLAG=-fPIE 113.else 114PICFLAG=-fpic 115PIEFLAG=-fpie 116.endif 117.endif 118 119PO_FLAG=-pg 120 121.c.po: 122 ${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 123 ${CTFCONVERT_CMD} 124 125.c.pico: 126 ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 127 ${CTFCONVERT_CMD} 128 129.c.nossppico: 130 ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} ${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} 131 ${CTFCONVERT_CMD} 132 133.c.pieo: 134 ${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 135 ${CTFCONVERT_CMD} 136 137.cc.po .C.po .cpp.po .cxx.po: 138 ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 139 140.cc.pico .C.pico .cpp.pico .cxx.pico: 141 ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 142 143.cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico: 144 ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} 145 146.cc.pieo .C.pieo .cpp.pieo .cxx.pieo: 147 ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 148 149.f.po: 150 ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 151 ${CTFCONVERT_CMD} 152 153.f.pico: 154 ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 155 ${CTFCONVERT_CMD} 156 157.f.nossppico: 158 ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC} 159 ${CTFCONVERT_CMD} 160 161.s.po .s.pico .s.nossppico .s.pieo: 162 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 163 ${CTFCONVERT_CMD} 164 165.asm.po: 166 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DPROF ${PO_CFLAGS} \ 167 ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 168 ${CTFCONVERT_CMD} 169 170.asm.pico: 171 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ 172 ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 173 ${CTFCONVERT_CMD} 174 175.asm.nossppico: 176 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ 177 ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 178 ${CTFCONVERT_CMD} 179 180.asm.pieo: 181 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \ 182 ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 183 ${CTFCONVERT_CMD} 184 185.S.po: 186 ${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \ 187 -o ${.TARGET} 188 ${CTFCONVERT_CMD} 189 190.S.pico: 191 ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ 192 -c ${.IMPSRC} -o ${.TARGET} 193 ${CTFCONVERT_CMD} 194 195.S.nossppico: 196 ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} \ 197 -c ${.IMPSRC} -o ${.TARGET} 198 ${CTFCONVERT_CMD} 199 200.S.pieo: 201 ${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ 202 -c ${.IMPSRC} -o ${.TARGET} 203 ${CTFCONVERT_CMD} 204 205_LIBDIR:=${LIBDIR} 206_SHLIBDIR:=${SHLIBDIR} 207 208.if defined(SHLIB_NAME) 209.if ${MK_DEBUG_FILES} != "no" 210SHLIB_NAME_FULL=${SHLIB_NAME}.full 211# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory 212.if ${_SHLIBDIR} == "/boot" ||\ 213 ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ 214 ${SHLIBDIR:C%/usr/(tests/)?lib(32|exec)?(/.*)?%/usr/lib%} == "/usr/lib" 215DEBUGFILEDIR=${DEBUGDIR}${_SHLIBDIR} 216.else 217DEBUGFILEDIR=${_SHLIBDIR}/.debug 218.endif 219.if !exists(${DESTDIR}${DEBUGFILEDIR}) 220DEBUGMKDIR= 221.endif 222.else 223SHLIB_NAME_FULL=${SHLIB_NAME} 224.endif 225.endif 226 227.include <bsd.symver.mk> 228 229# Allow libraries to specify their own version map or have it 230# automatically generated (see bsd.symver.mk above). 231.if ${MK_SYMVER} == "yes" && !empty(VERSION_MAP) 232${SHLIB_NAME_FULL}: ${VERSION_MAP} 233LDFLAGS+= -Wl,--version-script=${VERSION_MAP} 234.endif 235 236.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) 237OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/} 238BCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} 239LLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} 240CLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS} 241.endif 242 243.if defined(LIB) && !empty(LIB) 244_LIBS= lib${LIB_PRIVATE}${LIB}.a 245 246lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS} 247 @${ECHO} building static ${LIB} library 248 @rm -f ${.TARGET} 249 ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \ 250 ${LORDER} ${OBJS} ${STATICOBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD} 251 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 252.endif 253 254.if !defined(INTERNALLIB) 255 256.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) 257_LIBS+= lib${LIB_PRIVATE}${LIB}_p.a 258POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} 259DEPENDOBJS+= ${POBJS} 260CLEANFILES+= ${POBJS} 261 262lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS} 263 @${ECHO} building profiled ${LIB} library 264 @rm -f ${.TARGET} 265 ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \ 266 ${LORDER} ${POBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD} 267 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 268.endif 269 270.if defined(LLVM_LINK) 271lib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS} 272 ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} 273 274lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS} 275 ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} 276 277CLEANFILES+= lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll 278.endif 279 280.if defined(SHLIB_NAME) || \ 281 defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 282SOBJS+= ${OBJS:.o=.pico} 283DEPENDOBJS+= ${SOBJS} 284CLEANFILES+= ${SOBJS} 285.endif 286 287.if defined(SHLIB_NAME) 288_LIBS+= ${SHLIB_NAME} 289 290.if ${CFLAGS:M-fexceptions} || defined(SHLIB_CXX) || defined(LIB_CXX) 291ALLOW_MIPS_SHARED_TEXTREL= 292.endif 293 294SOLINKOPTS+= -shared -Wl,-x 295.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" 296SOLINKOPTS+= -Wl,--no-fatal-warnings 297.else 298SOLINKOPTS+= -Wl,--fatal-warnings 299.endif 300SOLINKOPTS+= -Wl,--warn-shared-textrel 301 302.if defined(ALLOW_MIPS_SHARED_TEXTREL) && ${MACHINE_CPUARCH:Mmips} 303# Check if we should be defining ALLOW_SHARED_TEXTREL... basically, C++ 304# or -fexceptions in CFLAGS on MIPS. This works around clang/lld attempting 305# to generate text relocations in read-only .eh_frame. A future version of 306# clang/lld should instead transform them into relative references at link 307# time, and then we can stop doing this. 308SOLINKOPTS+= -Wl,-z,notext 309.endif 310 311.if target(beforelinking) 312beforelinking: ${SOBJS} 313${SHLIB_NAME_FULL}: beforelinking 314.endif 315 316.if defined(SHLIB_LINK) 317.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT}) 318${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT} 319 sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \ 320 -e 's,@@LIBDIR@@,${_LIBDIR},g' \ 321 ${.ALLSRC} > ${.TARGET} 322 323${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld 324CLEANFILES+= ${SHLIB_LINK:R}.ld 325.endif 326CLEANFILES+= ${SHLIB_LINK} 327.endif 328 329${SHLIB_NAME_FULL}: ${SOBJS} 330 @${ECHO} building shared library ${SHLIB_NAME} 331 @rm -f ${SHLIB_NAME} ${SHLIB_LINK} 332.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no" 333 @${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK} 334.endif 335 ${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ 336 -o ${.TARGET} -Wl,-soname,${SONAME} \ 337 `NM='${NM}' NMFLAGS='${NMFLAGS}' ${LORDER} ${SOBJS} | \ 338 ${TSORT} ${TSORTFLAGS}` ${LDADD} 339.if ${MK_CTF} != "no" 340 ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} 341.endif 342 343.if ${MK_DEBUG_FILES} != "no" 344CLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 345${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 346 ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \ 347 ${SHLIB_NAME_FULL} ${.TARGET} 348.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) 349 @${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK} 350.endif 351 352${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} 353 ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} 354.endif 355.endif #defined(SHLIB_NAME) 356 357.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" 358_LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a 359 360lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS} 361 @${ECHO} building special pic ${LIB} library 362 @rm -f ${.TARGET} 363 ${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD} 364 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 365.endif 366 367.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 368NOSSPSOBJS+= ${OBJS:.o=.nossppico} 369DEPENDOBJS+= ${NOSSPSOBJS} 370CLEANFILES+= ${NOSSPSOBJS} 371_LIBS+= lib${LIB_PRIVATE}${LIB}_nossp_pic.a 372 373lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} 374 @${ECHO} building special nossp pic ${LIB} library 375 @rm -f ${.TARGET} 376 ${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD} 377 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 378.endif 379 380.endif # !defined(INTERNALLIB) 381 382.if defined(INTERNALLIB) && ${MK_PIE} != "no" 383PIEOBJS+= ${OBJS:.o=.pieo} 384DEPENDOBJS+= ${PIEOBJS} 385CLEANFILES+= ${PIEOBJS} 386 387_LIBS+= lib${LIB_PRIVATE}${LIB}_pie.a 388 389lib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS} 390 @${ECHO} building pie ${LIB} library 391 @rm -f ${.TARGET} 392 ${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD} 393 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 394.endif 395 396.if defined(_SKIP_BUILD) 397all: 398.else 399.if defined(_LIBS) && !empty(_LIBS) 400all: ${_LIBS} 401.endif 402 403.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 404all: all-man 405.endif 406.endif 407 408CLEANFILES+= ${_LIBS} 409 410_EXTRADEPEND: 411.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) 412.if defined(DPADD) && !empty(DPADD) 413 echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE} 414.endif 415.endif 416 417.if !target(install) 418 419.if defined(PRECIOUSLIB) 420.if !defined(NO_FSCHG) 421SHLINSTALLFLAGS+= -fschg 422.endif 423.endif 424# Install libraries with -S to avoid risk of modifying in-use libraries when 425# installing to a running system. It is safe to avoid this for NO_ROOT builds 426# that are only creating an image. 427.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT) 428SHLINSTALLFLAGS+= -S 429.endif 430 431_INSTALLFLAGS:= ${INSTALLFLAGS} 432.for ie in ${INSTALLFLAGS_EDIT} 433_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 434.endfor 435_SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS} 436.for ie in ${INSTALLFLAGS_EDIT} 437_SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} 438.endfor 439 440.if !defined(INTERNALLIB) 441realinstall: _libinstall 442.ORDER: beforeinstall _libinstall 443_libinstall: 444.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" 445 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 446 ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}/ 447.endif 448.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) 449 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},profile} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 450 ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/ 451.endif 452.if defined(SHLIB_NAME) 453 ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 454 ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ 455 ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ 456.if ${MK_DEBUG_FILES} != "no" 457.if defined(DEBUGMKDIR) 458 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -d ${DESTDIR}${DEBUGFILEDIR}/ 459.endif 460 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \ 461 ${_INSTALLFLAGS} \ 462 ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/ 463.endif 464.if defined(SHLIB_LINK) 465.if commands(${SHLIB_LINK:R}.ld) 466 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 467 ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \ 468 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 469.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS} 470 ${INSTALL_LIBSYMLINK} ${TAG_ARGS} ${SHLIB_LINK} ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK} 471.endfor 472.else 473.if ${_SHLIBDIR} == ${_LIBDIR} 474.if ${SHLIB_LINK:Mlib*} 475 ${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 476.else 477 ${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 478 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 479.endif 480.else 481.if ${SHLIB_LINK:Mlib*} 482 ${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 483 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 484.else 485 ${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 486 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 487.endif 488.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME}) 489 -chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 490 rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 491.endif 492.endif 493.endif # SHLIB_LDSCRIPT 494.endif # SHLIB_LINK 495.endif # SHIB_NAME 496.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" 497 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 498 ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/ 499.endif 500.endif # !defined(INTERNALLIB) 501 502.if !defined(LIBRARIES_ONLY) 503.include <bsd.nls.mk> 504.include <bsd.confs.mk> 505.include <bsd.files.mk> 506.include <bsd.incs.mk> 507.endif 508 509LINKOWN?= ${LIBOWN} 510LINKGRP?= ${LIBGRP} 511LINKMODE?= ${LIBMODE} 512SYMLINKOWN?= ${LIBOWN} 513SYMLINKGRP?= ${LIBGRP} 514.include <bsd.links.mk> 515 516.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 517realinstall: maninstall 518.ORDER: beforeinstall maninstall 519.endif 520 521.endif 522 523.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 524.include <bsd.man.mk> 525.endif 526 527.if defined(LIB) && !empty(LIB) 528OBJS_DEPEND_GUESS+= ${SRCS:M*.h} 529.for _S in ${SRCS:N*.[hly]} 530OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S} 531.endfor 532.endif 533.if defined(SHLIB_NAME) || \ 534 defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 535.for _S in ${SRCS:N*.[hly]} 536OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S} 537.endfor 538.endif 539.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 540.for _S in ${SRCS:N*.[hly]} 541OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+= ${_S} 542.endfor 543.endif 544 545.if defined(HAS_TESTS) 546MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 547SUBDIR_TARGETS+= check 548TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 549.endif 550 551.include <bsd.dep.mk> 552.include <bsd.clang-analyze.mk> 553.include <bsd.obj.mk> 554.include <bsd.sys.mk> 555