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