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