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