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 290SOLINKOPTS+= -shared -Wl,-x 291.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" 292SOLINKOPTS+= -Wl,--no-fatal-warnings 293.else 294SOLINKOPTS+= -Wl,--fatal-warnings 295.endif 296SOLINKOPTS+= -Wl,--warn-shared-textrel 297 298.if target(beforelinking) 299beforelinking: ${SOBJS} 300${SHLIB_NAME_FULL}: beforelinking 301.endif 302 303.if defined(SHLIB_LINK) 304.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT}) 305${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT} 306 sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \ 307 -e 's,@@LIBDIR@@,${_LIBDIR},g' \ 308 ${.ALLSRC} > ${.TARGET} 309 310${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld 311CLEANFILES+= ${SHLIB_LINK:R}.ld 312.endif 313CLEANFILES+= ${SHLIB_LINK} 314.endif 315 316${SHLIB_NAME_FULL}: ${SOBJS} 317 @${ECHO} building shared library ${SHLIB_NAME} 318 @rm -f ${SHLIB_NAME} ${SHLIB_LINK} 319.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no" 320 @${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK} 321.endif 322 ${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ 323 -o ${.TARGET} -Wl,-soname,${SONAME} \ 324 `NM='${NM}' NMFLAGS='${NMFLAGS}' ${LORDER} ${SOBJS} | \ 325 ${TSORT} ${TSORTFLAGS}` ${LDADD} 326.if ${MK_CTF} != "no" 327 ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} 328.endif 329 330.if ${MK_DEBUG_FILES} != "no" 331CLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 332${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 333 ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \ 334 ${SHLIB_NAME_FULL} ${.TARGET} 335.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) 336 @${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK} 337.endif 338 339${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} 340 ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} 341.endif 342.endif #defined(SHLIB_NAME) 343 344.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" 345_LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a 346 347lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS} 348 @${ECHO} building special pic ${LIB} library 349 @rm -f ${.TARGET} 350 ${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD} 351 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 352.endif 353 354.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 355NOSSPSOBJS+= ${OBJS:.o=.nossppico} 356DEPENDOBJS+= ${NOSSPSOBJS} 357CLEANFILES+= ${NOSSPSOBJS} 358_LIBS+= lib${LIB_PRIVATE}${LIB}_nossp_pic.a 359 360lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} 361 @${ECHO} building special nossp pic ${LIB} library 362 @rm -f ${.TARGET} 363 ${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD} 364 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 365.endif 366 367.endif # !defined(INTERNALLIB) 368 369.if defined(INTERNALLIB) && ${MK_PIE} != "no" 370PIEOBJS+= ${OBJS:.o=.pieo} 371DEPENDOBJS+= ${PIEOBJS} 372CLEANFILES+= ${PIEOBJS} 373 374_LIBS+= lib${LIB_PRIVATE}${LIB}_pie.a 375 376lib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS} 377 @${ECHO} building pie ${LIB} library 378 @rm -f ${.TARGET} 379 ${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD} 380 ${RANLIB} ${RANLIBFLAGS} ${.TARGET} 381.endif 382 383.if defined(_SKIP_BUILD) 384all: 385.else 386.if defined(_LIBS) && !empty(_LIBS) 387all: ${_LIBS} 388.endif 389 390.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 391all: all-man 392.endif 393.endif 394 395CLEANFILES+= ${_LIBS} 396 397_EXTRADEPEND: 398.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) 399.if defined(DPADD) && !empty(DPADD) 400 echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE} 401.endif 402.endif 403 404.if !target(install) 405 406.if defined(PRECIOUSLIB) 407.if !defined(NO_FSCHG) 408SHLINSTALLFLAGS+= -fschg 409.endif 410.endif 411# Install libraries with -S to avoid risk of modifying in-use libraries when 412# installing to a running system. It is safe to avoid this for NO_ROOT builds 413# that are only creating an image. 414.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT) 415SHLINSTALLFLAGS+= -S 416.endif 417 418_INSTALLFLAGS:= ${INSTALLFLAGS} 419.for ie in ${INSTALLFLAGS_EDIT} 420_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 421.endfor 422_SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS} 423.for ie in ${INSTALLFLAGS_EDIT} 424_SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} 425.endfor 426 427.if !defined(INTERNALLIB) 428realinstall: _libinstall 429.ORDER: beforeinstall _libinstall 430_libinstall: 431.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" 432 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 433 ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}/ 434.endif 435.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) 436 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},profile} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 437 ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/ 438.endif 439.if defined(SHLIB_NAME) 440 ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 441 ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ 442 ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ 443.if ${MK_DEBUG_FILES} != "no" 444.if defined(DEBUGMKDIR) 445 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -d ${DESTDIR}${DEBUGFILEDIR}/ 446.endif 447 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \ 448 ${_INSTALLFLAGS} \ 449 ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/ 450.endif 451.if defined(SHLIB_LINK) 452.if commands(${SHLIB_LINK:R}.ld) 453 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 454 ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \ 455 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 456.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS} 457 ${INSTALL_LIBSYMLINK} ${TAG_ARGS} ${SHLIB_LINK} ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK} 458.endfor 459.else 460.if ${_SHLIBDIR} == ${_LIBDIR} 461.if ${SHLIB_LINK:Mlib*} 462 ${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 463.else 464 ${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 465 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 466.endif 467.else 468.if ${SHLIB_LINK:Mlib*} 469 ${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 470 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 471.else 472 ${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 473 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 474.endif 475.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME}) 476 -chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 477 rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 478.endif 479.endif 480.endif # SHLIB_LDSCRIPT 481.endif # SHLIB_LINK 482.endif # SHIB_NAME 483.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" 484 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 485 ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/ 486.endif 487.endif # !defined(INTERNALLIB) 488 489.if !defined(LIBRARIES_ONLY) 490.include <bsd.nls.mk> 491.include <bsd.confs.mk> 492.include <bsd.files.mk> 493.include <bsd.incs.mk> 494.endif 495 496LINKOWN?= ${LIBOWN} 497LINKGRP?= ${LIBGRP} 498LINKMODE?= ${LIBMODE} 499SYMLINKOWN?= ${LIBOWN} 500SYMLINKGRP?= ${LIBGRP} 501.include <bsd.links.mk> 502 503.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 504realinstall: maninstall 505.ORDER: beforeinstall maninstall 506.endif 507 508.endif 509 510.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 511.include <bsd.man.mk> 512.endif 513 514.if defined(LIB) && !empty(LIB) 515OBJS_DEPEND_GUESS+= ${SRCS:M*.h} 516.for _S in ${SRCS:N*.[hly]} 517OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S} 518.endfor 519.endif 520.if defined(SHLIB_NAME) || \ 521 defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 522.for _S in ${SRCS:N*.[hly]} 523OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S} 524.endfor 525.endif 526.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 527.for _S in ${SRCS:N*.[hly]} 528OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+= ${_S} 529.endfor 530.endif 531 532.if defined(HAS_TESTS) 533MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 534SUBDIR_TARGETS+= check 535TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 536.endif 537 538.include <bsd.dep.mk> 539.include <bsd.clang-analyze.mk> 540.include <bsd.obj.mk> 541.include <bsd.sys.mk> 542