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