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