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