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 50# XXX: shouldn't we ensure that !asserts marks potentially unused variables as 51# __unused instead of disabling -Werror globally? 52MK_WERROR= no 53.endif 54 55.if defined(DEBUG_FLAGS) 56CFLAGS+= ${DEBUG_FLAGS} 57 58.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" 59CTFFLAGS+= -g 60.endif 61.else 62STRIP?= -s 63.endif 64 65.if ${SHLIBDIR:M*lib32*} 66TAGS+= lib32 67.endif 68 69.if defined(NO_ROOT) 70.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 71TAGS+= package=${PACKAGE:Uutilities} 72.endif 73TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 74.endif 75 76# ELF hardening knobs 77.if ${MK_BIND_NOW} != "no" 78LDFLAGS+= -Wl,-znow 79.endif 80.if ${MK_RETPOLINE} != "no" 81.if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline} 82CFLAGS+= -mretpoline 83CXXFLAGS+= -mretpoline 84LDFLAGS+= -Wl,-zretpolineplt 85.else 86.warning Retpoline requested but not supported by compiler or linker 87.endif 88.endif 89 90# Initialize stack variables on function entry 91.if ${MK_INIT_ALL_ZERO} == "yes" 92.if ${COMPILER_FEATURES:Minit-all} 93CFLAGS+= -ftrivial-auto-var-init=zero \ 94 -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 95CXXFLAGS+= -ftrivial-auto-var-init=zero \ 96 -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 97.else 98.warning InitAll (zeros) requested but not support by compiler 99.endif 100.elif ${MK_INIT_ALL_PATTERN} == "yes" 101.if ${COMPILER_FEATURES:Minit-all} 102CFLAGS+= -ftrivial-auto-var-init=pattern 103CXXFLAGS+= -ftrivial-auto-var-init=pattern 104.else 105.warning InitAll (pattern) requested but not support by compiler 106.endif 107.endif 108 109.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ 110 empty(DEBUG_FLAGS:M-gdwarf*) 111CFLAGS+= ${DEBUG_FILES_CFLAGS} 112CXXFLAGS+= ${DEBUG_FILES_CFLAGS} 113CTFFLAGS+= -g 114.endif 115 116# clang currently defaults to dynamic TLS for mips64 object files without -fPIC 117.if ${MACHINE_ARCH:Mmips64*} && ${COMPILER_TYPE} == "clang" 118STATIC_CFLAGS+= -ftls-model=initial-exec 119STATIC_CXXFLAGS+= -ftls-model=initial-exec 120.endif 121 122.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" 123CFLAGS += -mno-relax 124.endif 125 126.include <bsd.libnames.mk> 127 128# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries 129# .pico used for PIC object files 130# .nossppico used for NOSSP PIC object files 131# .pieo used for PIE object files 132.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .pieo .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln 133 134.if !defined(PICFLAG) 135PICFLAG=-fpic 136PIEFLAG=-fpie 137.endif 138 139PO_FLAG=-pg 140 141.c.po: 142 ${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 143 ${CTFCONVERT_CMD} 144 145.c.pico: 146 ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 147 ${CTFCONVERT_CMD} 148 149.c.nossppico: 150 ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} ${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} 151 ${CTFCONVERT_CMD} 152 153.c.pieo: 154 ${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 155 ${CTFCONVERT_CMD} 156 157.cc.po .C.po .cpp.po .cxx.po: 158 ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 159 160.cc.pico .C.pico .cpp.pico .cxx.pico: 161 ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 162 163.cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico: 164 ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} 165 166.cc.pieo .C.pieo .cpp.pieo .cxx.pieo: 167 ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 168 169.f.po: 170 ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 171 ${CTFCONVERT_CMD} 172 173.f.pico: 174 ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 175 ${CTFCONVERT_CMD} 176 177.f.nossppico: 178 ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC} 179 ${CTFCONVERT_CMD} 180 181.s.po .s.pico .s.nossppico .s.pieo: 182 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 183 ${CTFCONVERT_CMD} 184 185.asm.po: 186 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DPROF ${PO_CFLAGS} \ 187 ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 188 ${CTFCONVERT_CMD} 189 190.asm.pico: 191 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ 192 ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 193 ${CTFCONVERT_CMD} 194 195.asm.nossppico: 196 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ 197 ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 198 ${CTFCONVERT_CMD} 199 200.asm.pieo: 201 ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \ 202 ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 203 ${CTFCONVERT_CMD} 204 205.S.po: 206 ${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \ 207 -o ${.TARGET} 208 ${CTFCONVERT_CMD} 209 210.S.pico: 211 ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ 212 -c ${.IMPSRC} -o ${.TARGET} 213 ${CTFCONVERT_CMD} 214 215.S.nossppico: 216 ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} \ 217 -c ${.IMPSRC} -o ${.TARGET} 218 ${CTFCONVERT_CMD} 219 220.S.pieo: 221 ${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ 222 -c ${.IMPSRC} -o ${.TARGET} 223 ${CTFCONVERT_CMD} 224 225_LIBDIR:=${LIBDIR} 226_SHLIBDIR:=${SHLIBDIR} 227 228.if defined(SHLIB_NAME) 229.if ${MK_DEBUG_FILES} != "no" 230SHLIB_NAME_FULL=${SHLIB_NAME}.full 231# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory 232.if ${_SHLIBDIR} == "/boot" ||\ 233 ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ 234 ${SHLIBDIR:C%/usr/(tests/)?lib(32|exec)?(/.*)?%/usr/lib%} == "/usr/lib" 235DEBUGFILEDIR=${DEBUGDIR}${_SHLIBDIR} 236.else 237DEBUGFILEDIR=${_SHLIBDIR}/.debug 238.endif 239.if !exists(${DESTDIR}${DEBUGFILEDIR}) 240DEBUGMKDIR= 241.endif 242.else 243SHLIB_NAME_FULL=${SHLIB_NAME} 244.endif 245.endif 246 247.include <bsd.symver.mk> 248 249# Allow libraries to specify their own version map or have it 250# automatically generated (see bsd.symver.mk above). 251.if !empty(VERSION_MAP) 252${SHLIB_NAME_FULL}: ${VERSION_MAP} 253LDFLAGS+= -Wl,--version-script=${VERSION_MAP} 254.endif 255 256.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) 257OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/} 258BCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} 259LLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} 260CLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS} 261.endif 262 263.if defined(LIB) && !empty(LIB) 264_LIBS= lib${LIB_PRIVATE}${LIB}.a 265 266lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS} 267 @${ECHO} building static ${LIB} library 268 @rm -f ${.TARGET} 269 ${AR} ${ARFLAGS} ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD} 270.endif 271 272.if !defined(INTERNALLIB) 273 274.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) 275_LIBS+= lib${LIB_PRIVATE}${LIB}_p.a 276POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} 277DEPENDOBJS+= ${POBJS} 278CLEANFILES+= ${POBJS} 279 280lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS} 281 @${ECHO} building profiled ${LIB} library 282 @rm -f ${.TARGET} 283 ${AR} ${ARFLAGS} ${.TARGET} ${POBJS} ${ARADD} 284.endif 285 286.if defined(LLVM_LINK) 287lib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS} 288 ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} 289 290lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS} 291 ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} 292 293CLEANFILES+= lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll 294.endif 295 296.if defined(SHLIB_NAME) || \ 297 defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 298SOBJS+= ${OBJS:.o=.pico} 299DEPENDOBJS+= ${SOBJS} 300CLEANFILES+= ${SOBJS} 301.endif 302 303.if defined(SHLIB_NAME) 304_LIBS+= ${SHLIB_NAME} 305 306SOLINKOPTS+= -shared -Wl,-x 307.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" 308SOLINKOPTS+= -Wl,--no-fatal-warnings 309.else 310SOLINKOPTS+= -Wl,--fatal-warnings 311.endif 312SOLINKOPTS+= -Wl,--warn-shared-textrel 313 314.if target(beforelinking) 315beforelinking: ${SOBJS} 316${SHLIB_NAME_FULL}: beforelinking 317.endif 318 319.if defined(SHLIB_LINK) 320.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT}) 321${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT} 322 sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \ 323 -e 's,@@LIBDIR@@,${_LIBDIR},g' \ 324 ${.ALLSRC} > ${.TARGET} 325 326${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld 327CLEANFILES+= ${SHLIB_LINK:R}.ld 328.endif 329CLEANFILES+= ${SHLIB_LINK} 330.endif 331 332${SHLIB_NAME_FULL}: ${SOBJS} 333 @${ECHO} building shared library ${SHLIB_NAME} 334 @rm -f ${SHLIB_NAME} ${SHLIB_LINK} 335.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no" 336 # Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR 337 @${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} 338.endif 339 ${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ 340 -o ${.TARGET} -Wl,-soname,${SONAME} ${SOBJS} ${LDADD} 341.if ${MK_CTF} != "no" 342 ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} 343.endif 344 345.if ${MK_DEBUG_FILES} != "no" 346CLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 347${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 348 ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \ 349 ${SHLIB_NAME_FULL} ${.TARGET} 350.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) 351 # Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR 352 @${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} 353.endif 354 355${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} 356 ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} 357.endif 358.endif #defined(SHLIB_NAME) 359 360.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" 361_LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a 362 363lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS} 364 @${ECHO} building special pic ${LIB} library 365 @rm -f ${.TARGET} 366 ${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD} 367.endif 368 369.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 370NOSSPSOBJS+= ${OBJS:.o=.nossppico} 371DEPENDOBJS+= ${NOSSPSOBJS} 372CLEANFILES+= ${NOSSPSOBJS} 373_LIBS+= lib${LIB_PRIVATE}${LIB}_nossp_pic.a 374 375lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} 376 @${ECHO} building special nossp pic ${LIB} library 377 @rm -f ${.TARGET} 378 ${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD} 379.endif 380 381.endif # !defined(INTERNALLIB) 382 383.if defined(INTERNALLIB) && ${MK_PIE} != "no" 384PIEOBJS+= ${OBJS:.o=.pieo} 385DEPENDOBJS+= ${PIEOBJS} 386CLEANFILES+= ${PIEOBJS} 387 388_LIBS+= lib${LIB_PRIVATE}${LIB}_pie.a 389 390lib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS} 391 @${ECHO} building pie ${LIB} library 392 @rm -f ${.TARGET} 393 ${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD} 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# 428# XXX: Since Makefile.inc1 ends up building lib/libc both as part of 429# _startup_libs and as part of _generic_libs it ends up getting installed a 430# second time during the parallel build, and although the .WAIT in lib/Makefile 431# stops that mattering for lib, other directories like secure/lib are built in 432# parallel at the top level and are unaffected by that, so can sometimes race 433# with the libc.so.7 reinstall and see a missing or corrupt file. Ideally the 434# build system would be fixed to not build/install libc to WORLDTMP the second 435# time round, but for now using -S ensures the install is atomic and thus we 436# never see a broken intermediate state, so use it even for NO_ROOT builds. 437.if !defined(NO_SAFE_LIBINSTALL) #&& !defined(NO_ROOT) 438SHLINSTALLFLAGS+= -S 439SHLINSTALLSYMLINKFLAGS+= -S 440.endif 441 442_INSTALLFLAGS:= ${INSTALLFLAGS} 443.for ie in ${INSTALLFLAGS_EDIT} 444_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 445.endfor 446_SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS} 447_SHLINSTALLSYMLINKFLAGS:= ${SHLINSTALLSYMLINKFLAGS} 448.for ie in ${INSTALLFLAGS_EDIT} 449_SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} 450.endfor 451 452.if defined(PCFILES) 453.for pcfile in ${PCFILES} 454installpcfiles: installpcfiles-${pcfile} 455 456installpcfiles-${pcfile}: ${pcfile} 457 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 458 ${_INSTALLFLAGS} \ 459 ${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig 460.endfor 461.endif 462installpcfiles: .PHONY 463 464.if !defined(INTERNALLIB) 465realinstall: _libinstall installpcfiles 466.ORDER: beforeinstall _libinstall 467_libinstall: 468.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" 469 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 470 ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}/ 471.endif 472.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) 473 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 474 ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/ 475.endif 476.if defined(SHLIB_NAME) 477 ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 478 ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ 479 ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ 480.if ${MK_DEBUG_FILES} != "no" 481.if defined(DEBUGMKDIR) 482 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/ 483.endif 484 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \ 485 ${_INSTALLFLAGS} \ 486 ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/ 487.endif 488.if defined(SHLIB_LINK) 489.if commands(${SHLIB_LINK:R}.ld) 490 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 491 ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \ 492 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 493.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS} 494 ${INSTALL_LIBSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${SHLIB_LINK} \ 495 ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK} 496.endfor 497.else 498.if ${_SHLIBDIR} == ${_LIBDIR} 499.if ${SHLIB_LINK:Mlib*} 500 ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \ 501 ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 502.else 503 ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 504 ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 505.endif 506.else 507.if ${SHLIB_LINK:Mlib*} 508 ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \ 509 ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 510.else 511 ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} \ 512 ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 513.endif 514.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME}) 515 -chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 516 rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 517.endif 518.endif # _SHLIBDIR == _LIBDIR 519.endif # SHLIB_LDSCRIPT 520.endif # SHLIB_LINK 521.endif # SHIB_NAME 522.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" 523 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 524 ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/ 525.endif 526.endif # !defined(INTERNALLIB) 527 528.if !defined(LIBRARIES_ONLY) 529.include <bsd.nls.mk> 530.include <bsd.confs.mk> 531.include <bsd.files.mk> 532#No need to install header for INTERNALLIB 533.if !defined(INTERNALLIB) 534.include <bsd.incs.mk> 535.endif 536.endif 537 538LINKOWN?= ${LIBOWN} 539LINKGRP?= ${LIBGRP} 540LINKMODE?= ${LIBMODE} 541SYMLINKOWN?= ${LIBOWN} 542SYMLINKGRP?= ${LIBGRP} 543.include <bsd.links.mk> 544 545.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 546realinstall: maninstall 547.ORDER: beforeinstall maninstall 548.endif 549 550.endif 551 552.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 553.include <bsd.man.mk> 554.endif 555 556.if defined(LIB) && !empty(LIB) 557OBJS_DEPEND_GUESS+= ${SRCS:M*.h} 558.for _S in ${SRCS:N*.[hly]} 559OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S} 560.endfor 561.endif 562.if defined(SHLIB_NAME) || \ 563 defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 564.for _S in ${SRCS:N*.[hly]} 565OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S} 566.endfor 567.endif 568.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 569.for _S in ${SRCS:N*.[hly]} 570OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+= ${_S} 571.endfor 572.endif 573 574.if defined(HAS_TESTS) 575MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 576SUBDIR_TARGETS+= check 577TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 578.endif 579 580.include <bsd.dep.mk> 581.include <bsd.clang-analyze.mk> 582.include <bsd.obj.mk> 583.include <bsd.sys.mk> 584