1afe61c15SRodney W. Grimes 22bdaf7e8SRuslan Ermilov.include <bsd.init.mk> 3e5c6deceSEd Maste.include <bsd.compiler.mk> 4e5c6deceSEd Maste.include <bsd.linker.mk> 587177389SJessica Clarke.include <bsd.compat.pre.mk> 6afe61c15SRodney W. Grimes 77bc797e3SAlex Richardson__<bsd.lib.mk>__: 87bc797e3SAlex Richardson 921e27456SBryan Drewery.if defined(LIB_CXX) || defined(SHLIB_CXX) 10215d02b7SBryan Drewery_LD= ${CXX} 11215d02b7SBryan Drewery.else 12215d02b7SBryan Drewery_LD= ${CC} 13215d02b7SBryan Drewery.endif 1421e27456SBryan Drewery.if defined(LIB_CXX) 1521e27456SBryan DreweryLIB= ${LIB_CXX} 1621e27456SBryan Drewery.endif 1721e27456SBryan Drewery.if defined(SHLIB_CXX) 1821e27456SBryan DrewerySHLIB= ${SHLIB_CXX} 1921e27456SBryan Drewery.endif 20215d02b7SBryan Drewery 215551c573SBaptiste DaroussinLIB_PRIVATE= ${PRIVATELIB:Dprivate} 22f67eb0dcSJohn Polstra# Set up the variables controlling shared libraries. After this section, 23f67eb0dcSJohn Polstra# SHLIB_NAME will be defined only if we are to create a shared library. 24f67eb0dcSJohn Polstra# SHLIB_LINK will be defined only if we are to create a link to it. 25f67eb0dcSJohn Polstra# INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive. 26db08bfceSKonstantin Belousov# BUILD_NOSSP_PIC_ARCHIVE will be defined only if we are to create a PIC archive. 27ab7a2947SRuslan Ermilov.if defined(NO_PIC) 28f67eb0dcSJohn Polstra.undef SHLIB_NAME 29f67eb0dcSJohn Polstra.undef INSTALL_PIC_ARCHIVE 30db08bfceSKonstantin Belousov.undef BUILD_NOSSP_PIC_ARCHIVE 31f67eb0dcSJohn Polstra.else 3210717e2eSDag-Erling Smørgrav.if !defined(SHLIB) && defined(LIB) 3310717e2eSDag-Erling SmørgravSHLIB= ${LIB} 3410717e2eSDag-Erling Smørgrav.endif 3510717e2eSDag-Erling Smørgrav.if !defined(SHLIB_NAME) && defined(SHLIB) && defined(SHLIB_MAJOR) 365551c573SBaptiste DaroussinSHLIB_NAME= lib${LIB_PRIVATE}${SHLIB}.so.${SHLIB_MAJOR} 3742c0ad02SRuslan Ermilov.endif 3865d2bdc6SRuslan Ermilov.if defined(SHLIB_NAME) && !empty(SHLIB_NAME:M*.so.*) 3942c0ad02SRuslan ErmilovSHLIB_LINK?= ${SHLIB_NAME:R} 40f67eb0dcSJohn Polstra.endif 41f67eb0dcSJohn PolstraSONAME?= ${SHLIB_NAME} 42e782d0b5SPeter Wemm.endif 43e782d0b5SPeter Wemm 4441f89315SRuslan Ermilov.if defined(CRUNCH_CFLAGS) 453c9b8563SGordon TetlowCFLAGS+= ${CRUNCH_CFLAGS} 4641f89315SRuslan Ermilov.endif 473c9b8563SGordon Tetlow 484df1f59eSWarner Losh.if ${MK_ASSERT_DEBUG} == "no" 494df1f59eSWarner LoshCFLAGS+= -DNDEBUG 507fa2f2a6SAlex Richardson# XXX: shouldn't we ensure that !asserts marks potentially unused variables as 517fa2f2a6SAlex Richardson# __unused instead of disabling -Werror globally? 527fa2f2a6SAlex RichardsonMK_WERROR= no 534df1f59eSWarner Losh.endif 544df1f59eSWarner Losh 55e82b0b99SJordan K. Hubbard.if defined(DEBUG_FLAGS) 56e82b0b99SJordan K. HubbardCFLAGS+= ${DEBUG_FLAGS} 57770ac3b2SJohn Birrell 58e977d70fSMark Johnston.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" 59770ac3b2SJohn BirrellCTFFLAGS+= -g 60770ac3b2SJohn Birrell.endif 610d947ed1SEd Maste.else 62afe61c15SRodney W. GrimesSTRIP?= -s 63e82b0b99SJordan K. Hubbard.endif 64afe61c15SRodney W. Grimes 6587177389SJessica Clarke.for _libcompat in ${_ALL_libcompats} 6687177389SJessica Clarke.if ${SHLIBDIR:M*/lib${_libcompat}} || ${SHLIBDIR:M*/lib${_libcompat}/*} 6787177389SJessica ClarkeTAGS+= lib${_libcompat} 686c2fad0aSBaptiste Daroussin.endif 6987177389SJessica Clarke.endfor 706c2fad0aSBaptiste Daroussin 71dc6d22c9SBaptiste Daroussin.if defined(NO_ROOT) 72dc6d22c9SBaptiste Daroussin.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 734c1a82ceSEmmanuel VadotTAGS+= package=${PACKAGE:Uutilities} 74dc6d22c9SBaptiste Daroussin.endif 75dc6d22c9SBaptiste DaroussinTAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 76dc6d22c9SBaptiste Daroussin.endif 77dc6d22c9SBaptiste Daroussin 78bf81eb3cSEd Maste# ELF hardening knobs 79bf81eb3cSEd Maste.if ${MK_BIND_NOW} != "no" 80bf81eb3cSEd MasteLDFLAGS+= -Wl,-znow 81bf81eb3cSEd Maste.endif 824ca6ecf1SJessica Clarke.if ${LINKER_TYPE} != "mac" 832f3a9614SEd Maste.if ${MK_RELRO} == "no" 842f3a9614SEd MasteLDFLAGS+= -Wl,-znorelro 852f3a9614SEd Maste.else 862f3a9614SEd MasteLDFLAGS+= -Wl,-zrelro 872f3a9614SEd Maste.endif 887927452aSEd Maste.endif 89fc191b11SEd Maste.if ${MK_RETPOLINE} != "no" 90e5c6deceSEd Maste.if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline} 91fc191b11SEd MasteCFLAGS+= -mretpoline 92fc191b11SEd MasteCXXFLAGS+= -mretpoline 93fc191b11SEd MasteLDFLAGS+= -Wl,-zretpolineplt 94e5c6deceSEd Maste.else 95e5c6deceSEd Maste.warning Retpoline requested but not supported by compiler or linker 96e5c6deceSEd Maste.endif 97fc191b11SEd Maste.endif 9892053e4fSJohn Baldwin# LLD sensibly defaults to -znoexecstack, so do the same for BFD 9992053e4fSJohn BaldwinLDFLAGS.bfd+= -Wl,-znoexecstack 10082854693SAndrew Turner.if ${MK_BRANCH_PROTECTION} != "no" 10182854693SAndrew TurnerCFLAGS+= -mbranch-protection=standard 102973bbdabSJose Luis Duran.if ${LINKER_FEATURES:Mbti-report} && defined(BTI_REPORT_ERROR) 10382854693SAndrew TurnerLDFLAGS+= -Wl,-zbti-report=error 10482854693SAndrew Turner.endif 10582854693SAndrew Turner.endif 106fc191b11SEd Maste 107e268fd0aSBrooks Davis# Initialize stack variables on function entry 1082befa269SBrooks Davis.if ${OPT_INIT_ALL} != "none" 109e268fd0aSBrooks Davis.if ${COMPILER_FEATURES:Minit-all} 1102befa269SBrooks DavisCFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} 1112befa269SBrooks DavisCXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} 1122befa269SBrooks Davis.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 1133006f6dfSDimitry AndricCFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 1143006f6dfSDimitry AndricCXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang 1153006f6dfSDimitry Andric.endif 116e268fd0aSBrooks Davis.else 1172befa269SBrooks Davis.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler 118e268fd0aSBrooks Davis.endif 119e268fd0aSBrooks Davis.endif 120e268fd0aSBrooks Davis 121*2a44cccdSAlexander Leidinger# Zero used registers on return (mitigate some ROP) 122*2a44cccdSAlexander Leidinger.if ${MK_ZEROREGS} != "no" 123*2a44cccdSAlexander Leidinger.if ${COMPILER_FEATURES:Mzeroregs} 124*2a44cccdSAlexander LeidingerZEROREG_TYPE?= used 125*2a44cccdSAlexander LeidingerCFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} 126*2a44cccdSAlexander LeidingerCXXFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} 127*2a44cccdSAlexander Leidinger.endif 128*2a44cccdSAlexander Leidinger.endif 129*2a44cccdSAlexander Leidinger 130428a32edSAlex Richardson# bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). 131428a32edSAlex Richardson.sinclude "bsd.sanitizer.mk" 1327bc797e3SAlex Richardson 13342f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ 13442f8c5b5SEd Maste empty(DEBUG_FLAGS:M-gdwarf*) 135c910570eSEd Maste.if !${COMPILER_FEATURES:Mcompressed-debug} 136c910570eSEd MasteCFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} 137c910570eSEd MasteCXXFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} 138c910570eSEd Maste.else 139de6feefdSJohn BaldwinCFLAGS+= ${DEBUG_FILES_CFLAGS} 140de6feefdSJohn BaldwinCXXFLAGS+= ${DEBUG_FILES_CFLAGS} 141c910570eSEd Maste.endif 14242f8c5b5SEd MasteCTFFLAGS+= -g 14342f8c5b5SEd Maste.endif 14442f8c5b5SEd Maste 14579f59915SJohn Baldwin.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" 14679f59915SJohn BaldwinCFLAGS += -mno-relax 14779f59915SJohn Baldwin.endif 14879f59915SJohn Baldwin 1491a5ed802SBruce Evans.include <bsd.libnames.mk> 1501a5ed802SBruce Evans 151afe61c15SRodney W. Grimes# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries 1522b4da8aaSMarcel Moolenaar# .pico used for PIC object files 153db08bfceSKonstantin Belousov# .nossppico used for NOSSP PIC object files 154bcf99d2dSEd Maste# .pieo used for PIE object files 155bcf99d2dSEd Maste.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .pieo .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln 156766f7d6eSMark Murray 1572a53f3fbSRuslan Ermilov.if !defined(PICFLAG) 1582a53f3fbSRuslan ErmilovPICFLAG=-fpic 159bcf99d2dSEd MastePIEFLAG=-fpie 1602a53f3fbSRuslan Ermilov.endif 1612a53f3fbSRuslan Ermilov 16206d6e4fcSTom RhodesPO_FLAG=-pg 16306d6e4fcSTom Rhodes 1645852ae2dSBryan Drewery.c.po: 1652ba29593SDag-Erling Smørgrav ${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 16678e7e3ecSMax Khon ${CTFCONVERT_CMD} 167afe61c15SRodney W. Grimes 1682b4da8aaSMarcel Moolenaar.c.pico: 1699a1f7ce5SEnji Cooper ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 17078e7e3ecSMax Khon ${CTFCONVERT_CMD} 1713585b293SGarrett Wollman 172db08bfceSKonstantin Belousov.c.nossppico: 1737bc797e3SAlex Richardson ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} ${CFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} 174db08bfceSKonstantin Belousov ${CTFCONVERT_CMD} 175db08bfceSKonstantin Belousov 176bcf99d2dSEd Maste.c.pieo: 177bcf99d2dSEd Maste ${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} 178bcf99d2dSEd Maste ${CTFCONVERT_CMD} 179bcf99d2dSEd Maste 1805852ae2dSBryan Drewery.cc.po .C.po .cpp.po .cxx.po: 1812ba29593SDag-Erling Smørgrav ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 1823585b293SGarrett Wollman 1832b4da8aaSMarcel Moolenaar.cc.pico .C.pico .cpp.pico .cxx.pico: 1849a1f7ce5SEnji Cooper ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 1853585b293SGarrett Wollman 186db08bfceSKonstantin Belousov.cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico: 1877bc797e3SAlex Richardson ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} 188db08bfceSKonstantin Belousov 189bcf99d2dSEd Maste.cc.pieo .C.pieo .cpp.pieo .cxx.pieo: 190bcf99d2dSEd Maste ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} 191bcf99d2dSEd Maste 1925852ae2dSBryan Drewery.f.po: 1939c8ff5b5SJohn Polstra ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 19478e7e3ecSMax Khon ${CTFCONVERT_CMD} 1953585b293SGarrett Wollman 1962b4da8aaSMarcel Moolenaar.f.pico: 1973585b293SGarrett Wollman ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} 19878e7e3ecSMax Khon ${CTFCONVERT_CMD} 1993585b293SGarrett Wollman 200db08bfceSKonstantin Belousov.f.nossppico: 201db08bfceSKonstantin Belousov ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC} 202db08bfceSKonstantin Belousov ${CTFCONVERT_CMD} 203db08bfceSKonstantin Belousov 204bcf99d2dSEd Maste.s.po .s.pico .s.nossppico .s.pieo: 205b2dcde7eSEd Maste ${CC:N${CCACHE_BIN}} -x assembler ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 20678e7e3ecSMax Khon ${CTFCONVERT_CMD} 2073585b293SGarrett Wollman 2085852ae2dSBryan Drewery.asm.po: 2099160419cSBryan Drewery ${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DPROF ${PO_CFLAGS} \ 2109160419cSBryan Drewery ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 21178e7e3ecSMax Khon ${CTFCONVERT_CMD} 212d58e932fSRuslan Ermilov 2132b4da8aaSMarcel Moolenaar.asm.pico: 2149160419cSBryan Drewery ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ 2159160419cSBryan Drewery ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 21678e7e3ecSMax Khon ${CTFCONVERT_CMD} 217d58e932fSRuslan Ermilov 218db08bfceSKonstantin Belousov.asm.nossppico: 219db08bfceSKonstantin Belousov ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ 220db08bfceSKonstantin Belousov ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 221db08bfceSKonstantin Belousov ${CTFCONVERT_CMD} 222db08bfceSKonstantin Belousov 223bcf99d2dSEd Maste.asm.pieo: 224bcf99d2dSEd Maste ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \ 225bcf99d2dSEd Maste ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} 226bcf99d2dSEd Maste ${CTFCONVERT_CMD} 227bcf99d2dSEd Maste 2285852ae2dSBryan Drewery.S.po: 2299160419cSBryan Drewery ${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \ 2309160419cSBryan Drewery -o ${.TARGET} 23178e7e3ecSMax Khon ${CTFCONVERT_CMD} 2323585b293SGarrett Wollman 2332b4da8aaSMarcel Moolenaar.S.pico: 2349160419cSBryan Drewery ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ 2359160419cSBryan Drewery -c ${.IMPSRC} -o ${.TARGET} 23678e7e3ecSMax Khon ${CTFCONVERT_CMD} 2373585b293SGarrett Wollman 238db08bfceSKonstantin Belousov.S.nossppico: 239db08bfceSKonstantin Belousov ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} \ 240db08bfceSKonstantin Belousov -c ${.IMPSRC} -o ${.TARGET} 241db08bfceSKonstantin Belousov ${CTFCONVERT_CMD} 242db08bfceSKonstantin Belousov 243bcf99d2dSEd Maste.S.pieo: 244bcf99d2dSEd Maste ${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ 245bcf99d2dSEd Maste -c ${.IMPSRC} -o ${.TARGET} 246bcf99d2dSEd Maste ${CTFCONVERT_CMD} 247bcf99d2dSEd Maste 2482442cc58SDag-Erling Smørgrav_LIBDIR:=${LIBDIR} 2492442cc58SDag-Erling Smørgrav_SHLIBDIR:=${SHLIBDIR} 2502442cc58SDag-Erling Smørgrav 2510d1fce25SEd Maste.if defined(SHLIB_NAME) 25242f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 25342f8c5b5SEd MasteSHLIB_NAME_FULL=${SHLIB_NAME}.full 25442f8c5b5SEd Maste# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory 2552442cc58SDag-Erling Smørgrav.if ${_SHLIBDIR} == "/boot" ||\ 25642f8c5b5SEd Maste ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ 25729f29742SBryan Drewery ${SHLIBDIR:C%/usr/(tests/)?lib(32|exec)?(/.*)?%/usr/lib%} == "/usr/lib" 2582442cc58SDag-Erling SmørgravDEBUGFILEDIR=${DEBUGDIR}${_SHLIBDIR} 25942f8c5b5SEd Maste.else 2602442cc58SDag-Erling SmørgravDEBUGFILEDIR=${_SHLIBDIR}/.debug 261a324b0f0SBryan Drewery.endif 262a324b0f0SBryan Drewery.if !exists(${DESTDIR}${DEBUGFILEDIR}) 26342f8c5b5SEd MasteDEBUGMKDIR= 26442f8c5b5SEd Maste.endif 2650d1fce25SEd Maste.else 2660d1fce25SEd MasteSHLIB_NAME_FULL=${SHLIB_NAME} 2670d1fce25SEd Maste.endif 2680d1fce25SEd Maste.endif 2690d1fce25SEd Maste 2702da4e470SAlexander Kabaev.include <bsd.symver.mk> 271ab52e991SDaniel Eischen 272046f4ebaSAlexander Kabaev# Allow libraries to specify their own version map or have it 2732da4e470SAlexander Kabaev# automatically generated (see bsd.symver.mk above). 274371f3da6SJohn Baldwin.if !empty(VERSION_MAP) 2750d1fce25SEd Maste${SHLIB_NAME_FULL}: ${VERSION_MAP} 276ab52e991SDaniel EischenLDFLAGS+= -Wl,--version-script=${VERSION_MAP} 2772ba84b4bSDimitry Andric 2782956f588SBrooks Davis# Ideally we'd always enable --no-undefined-version (default for lld >= 16), 2792956f588SBrooks Davis# but we have several symbols in our version maps that may or may not exist, 2802956f588SBrooks Davis# depending on compile-time defines and that needs to be handled first. 2812956f588SBrooks Davis.if ${MK_UNDEFINED_VERSION} == "no" 2822956f588SBrooks DavisLDFLAGS+= -Wl,--no-undefined-version 2832956f588SBrooks Davis.else 2842ba84b4bSDimitry AndricLDFLAGS+= -Wl,--undefined-version 2852ba84b4bSDimitry Andric.endif 286ab52e991SDaniel Eischen.endif 287ab52e991SDaniel Eischen 2884d7d5e7cSRuslan Ermilov.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) 2892506d700SSimon J. GerratyOBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/} 2904f2fac37SJonathan AndersonBCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} 2914f2fac37SJonathan AndersonLLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} 2924f2fac37SJonathan AndersonCLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS} 2934d7d5e7cSRuslan Ermilov.endif 2944d7d5e7cSRuslan Ermilov 2952a53f3fbSRuslan Ermilov.if defined(LIB) && !empty(LIB) 2969294a2c7SBaptiste Daroussin.if defined(STATIC_LDSCRIPT) 2979294a2c7SBaptiste Daroussin_STATICLIB_SUFFIX= _real 2989294a2c7SBaptiste Daroussin.endif 2999294a2c7SBaptiste Daroussin_LIBS= lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a 300afe61c15SRodney W. Grimes 3019294a2c7SBaptiste Daroussinlib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a: ${OBJS} ${STATICOBJS} 302c6e56e65SMinsoo Choo @${ECHO} Building static ${LIB} library 3032a53f3fbSRuslan Ermilov @rm -f ${.TARGET} 3040e1e341bSAlex Richardson ${AR} ${ARFLAGS} ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD} 3054d7d5e7cSRuslan Ermilov.endif 306afe61c15SRodney W. Grimes 3072a53f3fbSRuslan Ermilov.if !defined(INTERNALLIB) 3082a53f3fbSRuslan Ermilov 309e4195e2eSJonathan Anderson.if defined(LLVM_LINK) 310e4195e2eSJonathan Andersonlib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS} 311e4195e2eSJonathan Anderson ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} 312e4195e2eSJonathan Anderson 313e4195e2eSJonathan Andersonlib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS} 314e4195e2eSJonathan Anderson ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} 315fd8103edSJonathan Anderson 316fd8103edSJonathan AndersonCLEANFILES+= lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll 317e4195e2eSJonathan Anderson.endif 318e4195e2eSJonathan Anderson 3194d7d5e7cSRuslan Ermilov.if defined(SHLIB_NAME) || \ 3204d7d5e7cSRuslan Ermilov defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 3212b4da8aaSMarcel MoolenaarSOBJS+= ${OBJS:.o=.pico} 32210f696a5SBryan DreweryDEPENDOBJS+= ${SOBJS} 323491b2960SBryan DreweryCLEANFILES+= ${SOBJS} 3244d7d5e7cSRuslan Ermilov.endif 3258c05a446SPeter Wemm 326f67eb0dcSJohn Polstra.if defined(SHLIB_NAME) 3272a53f3fbSRuslan Ermilov_LIBS+= ${SHLIB_NAME} 3282a53f3fbSRuslan Ermilov 329ee05c0f1SBryan DrewerySOLINKOPTS+= -shared -Wl,-x 33070d099afSBaptiste Daroussin.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" 33170d099afSBaptiste DaroussinSOLINKOPTS+= -Wl,--no-fatal-warnings 33270d099afSBaptiste Daroussin.else 33370d099afSBaptiste DaroussinSOLINKOPTS+= -Wl,--fatal-warnings 33470d099afSBaptiste Daroussin.endif 33570d099afSBaptiste DaroussinSOLINKOPTS+= -Wl,--warn-shared-textrel 336bd4632e6SKonstantin Belousov 337c2c48445SRui Paulo.if target(beforelinking) 338593c0b49SMark Johnstonbeforelinking: ${SOBJS} 339593c0b49SMark Johnston${SHLIB_NAME_FULL}: beforelinking 340c2c48445SRui Paulo.endif 341f187ca8cSSimon J. Gerraty 342f187ca8cSSimon J. Gerraty.if defined(SHLIB_LINK) 343f187ca8cSSimon J. Gerraty.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT}) 3445852ae2dSBryan Drewery${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT} 3451b337a34SBryan Drewery sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \ 3461b337a34SBryan Drewery -e 's,@@LIBDIR@@,${_LIBDIR},g' \ 347f187ca8cSSimon J. Gerraty ${.ALLSRC} > ${.TARGET} 348f187ca8cSSimon J. Gerraty 349f187ca8cSSimon J. Gerraty${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld 350491b2960SBryan DreweryCLEANFILES+= ${SHLIB_LINK:R}.ld 351f187ca8cSSimon J. Gerraty.endif 352491b2960SBryan DreweryCLEANFILES+= ${SHLIB_LINK} 353f187ca8cSSimon J. Gerraty.endif 354f187ca8cSSimon J. Gerraty 3555852ae2dSBryan Drewery${SHLIB_NAME_FULL}: ${SOBJS} 356c6e56e65SMinsoo Choo @${ECHO} Building shared library ${SHLIB_NAME} 357e97696b5SEd Maste @rm -f ${SHLIB_NAME} ${SHLIB_LINK} 358447bb5a3SBryan Drewery.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no" 359c3d67d6cSAlex Richardson # Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR 360c3d67d6cSAlex Richardson @${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} 361f67eb0dcSJohn Polstra.endif 3629160419cSBryan Drewery ${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ 3630e1e341bSAlex Richardson -o ${.TARGET} -Wl,-soname,${SONAME} ${SOBJS} ${LDADD} 36483cb5baeSMax Khon.if ${MK_CTF} != "no" 365cd49c2e8SMax Khon ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} 366cd49c2e8SMax Khon.endif 367e97696b5SEd Maste 36842f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 36942f8c5b5SEd MasteCLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 3705852ae2dSBryan Drewery${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug 37142f8c5b5SEd Maste ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \ 372593c0b49SMark Johnston ${SHLIB_NAME_FULL} ${.TARGET} 373447bb5a3SBryan Drewery.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) 374c3d67d6cSAlex Richardson # Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR 375c3d67d6cSAlex Richardson @${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} 376447bb5a3SBryan Drewery.endif 377e97696b5SEd Maste 3785852ae2dSBryan Drewery${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} 379593c0b49SMark Johnston ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} 380e97696b5SEd Maste.endif 38122f3da67SMark Johnston.endif #defined(SHLIB_NAME) 3823585b293SGarrett Wollman 3835f2e8401SEd Maste.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 3845551c573SBaptiste Daroussin_LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a 3852a53f3fbSRuslan Ermilov 3865852ae2dSBryan Drewerylib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS} 387c6e56e65SMinsoo Choo @${ECHO} Building special pic ${LIB} library 3882a53f3fbSRuslan Ermilov @rm -f ${.TARGET} 389b322948eSBryan Drewery ${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD} 39086af0db9SBruce Evans.endif 391afe61c15SRodney W. Grimes 392db08bfceSKonstantin Belousov.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 393db08bfceSKonstantin BelousovNOSSPSOBJS+= ${OBJS:.o=.nossppico} 394db08bfceSKonstantin BelousovDEPENDOBJS+= ${NOSSPSOBJS} 395db08bfceSKonstantin BelousovCLEANFILES+= ${NOSSPSOBJS} 396db08bfceSKonstantin Belousov_LIBS+= lib${LIB_PRIVATE}${LIB}_nossp_pic.a 397db08bfceSKonstantin Belousov 398db08bfceSKonstantin Belousovlib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} 399c6e56e65SMinsoo Choo @${ECHO} Building special nossp pic ${LIB} library 400db08bfceSKonstantin Belousov @rm -f ${.TARGET} 401db08bfceSKonstantin Belousov ${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD} 402db08bfceSKonstantin Belousov.endif 403db08bfceSKonstantin Belousov 40484aac273SHartmut Brandt.endif # !defined(INTERNALLIB) 4052a53f3fbSRuslan Ermilov 4067c0226caSEd Maste.if defined(INTERNALLIB) && ${MK_PIE} != "no" && defined(LIB) && !empty(LIB) 407bcf99d2dSEd MastePIEOBJS+= ${OBJS:.o=.pieo} 408bcf99d2dSEd MasteDEPENDOBJS+= ${PIEOBJS} 409bcf99d2dSEd MasteCLEANFILES+= ${PIEOBJS} 410bcf99d2dSEd Maste 411bcf99d2dSEd Maste_LIBS+= lib${LIB_PRIVATE}${LIB}_pie.a 412bcf99d2dSEd Maste 413bcf99d2dSEd Mastelib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS} 414c6e56e65SMinsoo Choo @${ECHO} Building pie ${LIB} library 415bcf99d2dSEd Maste @rm -f ${.TARGET} 416bcf99d2dSEd Maste ${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD} 417bcf99d2dSEd Maste.endif 418bcf99d2dSEd Maste 4197750ad47SMarcel Moolenaar.if defined(_SKIP_BUILD) 4207750ad47SMarcel Moolenaarall: 4217750ad47SMarcel Moolenaar.else 422491b2960SBryan Drewery.if defined(_LIBS) && !empty(_LIBS) 4232a53f3fbSRuslan Ermilovall: ${_LIBS} 424491b2960SBryan Drewery.endif 4252a53f3fbSRuslan Ermilov 426740e5b17SBryan Drewery.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 427f1702f87SBryan Dreweryall: all-man 428afe61c15SRodney W. Grimes.endif 4297750ad47SMarcel Moolenaar.endif 430afe61c15SRodney W. Grimes 4311deef6e4SBryan DreweryCLEANFILES+= ${_LIBS} 4321deef6e4SBryan Drewery 433fcccc50bSBruce Evans_EXTRADEPEND: 434a399b3b4SRuslan Ermilov.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) 435e3ace70eSBruce Evans.if defined(DPADD) && !empty(DPADD) 43637fd8bc2SJohn Baldwin echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE} 4378c05a446SPeter Wemm.endif 4388c05a446SPeter Wemm.endif 439afe61c15SRodney W. Grimes 440afe61c15SRodney W. Grimes.if !target(install) 441afe61c15SRodney W. Grimes 442da6620e4SVal PackettINSTALLFLAGS+= -C 443c33bd5d6SRuslan Ermilov.if defined(PRECIOUSLIB) 44400fbd407SRuslan Ermilov.if !defined(NO_FSCHG) 445c59ae063SGarrett WollmanSHLINSTALLFLAGS+= -fschg 446c59ae063SGarrett Wollman.endif 44704594feeSBryan Drewery.endif 4485179958aSBryan Drewery# Install libraries with -S to avoid risk of modifying in-use libraries when 4495179958aSBryan Drewery# installing to a running system. It is safe to avoid this for NO_ROOT builds 4505179958aSBryan Drewery# that are only creating an image. 451dabbf11fSAlex Richardson# 452dabbf11fSAlex Richardson# XXX: Since Makefile.inc1 ends up building lib/libc both as part of 453dabbf11fSAlex Richardson# _startup_libs and as part of _generic_libs it ends up getting installed a 454dabbf11fSAlex Richardson# second time during the parallel build, and although the .WAIT in lib/Makefile 455dabbf11fSAlex Richardson# stops that mattering for lib, other directories like secure/lib are built in 456dabbf11fSAlex Richardson# parallel at the top level and are unaffected by that, so can sometimes race 457dabbf11fSAlex Richardson# with the libc.so.7 reinstall and see a missing or corrupt file. Ideally the 458dabbf11fSAlex Richardson# build system would be fixed to not build/install libc to WORLDTMP the second 459dabbf11fSAlex Richardson# time round, but for now using -S ensures the install is atomic and thus we 460dabbf11fSAlex Richardson# never see a broken intermediate state, so use it even for NO_ROOT builds. 461dabbf11fSAlex Richardson.if !defined(NO_SAFE_LIBINSTALL) #&& !defined(NO_ROOT) 462c33bd5d6SRuslan ErmilovSHLINSTALLFLAGS+= -S 4637afab8a6SMark JohnstonSHLINSTALLSYMLINKFLAGS+= -S 464c33bd5d6SRuslan Ermilov.endif 465c59ae063SGarrett Wollman 466e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${INSTALLFLAGS} 467e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 468e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 469e902c1bbSTim Vanderhoek.endfor 4701a66233dSRuslan Ermilov_SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS} 4717afab8a6SMark Johnston_SHLINSTALLSYMLINKFLAGS:= ${SHLINSTALLSYMLINKFLAGS} 472e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 473e902c1bbSTim Vanderhoek_SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} 474e902c1bbSTim Vanderhoek.endfor 475e902c1bbSTim Vanderhoek 4768a84b373SEmmanuel Vadot.if defined(PCFILES) 4778a84b373SEmmanuel Vadot.for pcfile in ${PCFILES} 4788a84b373SEmmanuel Vadotinstallpcfiles: installpcfiles-${pcfile} 4798a84b373SEmmanuel Vadot 4808a84b373SEmmanuel Vadotinstallpcfiles-${pcfile}: ${pcfile} 4818a84b373SEmmanuel Vadot ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 4828a84b373SEmmanuel Vadot ${_INSTALLFLAGS} \ 483ac175bd3SAlex Richardson ${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig/ 4848a84b373SEmmanuel Vadot.endfor 4858a84b373SEmmanuel Vadot.endif 4868a84b373SEmmanuel Vadotinstallpcfiles: .PHONY 4878a84b373SEmmanuel Vadot 4884d7d5e7cSRuslan Ermilov.if !defined(INTERNALLIB) 4898a84b373SEmmanuel Vadotrealinstall: _libinstall installpcfiles 490badb7c1cSRuslan Ermilov.ORDER: beforeinstall _libinstall 491b25a566dSRuslan Ermilov_libinstall: 4925551c573SBaptiste Daroussin.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" 493da6620e4SVal Packett ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 4949294a2c7SBaptiste Daroussin ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a ${DESTDIR}${_LIBDIR}/ 495fc073e67SEd Maste.endif 496a89bd620SDavid E. O'Brien.if defined(SHLIB_NAME) 497dc6d22c9SBaptiste Daroussin ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 498e902c1bbSTim Vanderhoek ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ 49961c20fc7SBryan Drewery ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ 50042f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no" 50142f8c5b5SEd Maste.if defined(DEBUGMKDIR) 502697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/ 50342f8c5b5SEd Maste.endif 504697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \ 505facaa6eeSEd Maste ${_INSTALLFLAGS} \ 50661c20fc7SBryan Drewery ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/ 507e97696b5SEd Maste.endif 5085551c573SBaptiste Daroussin.if defined(SHLIB_LINK) 509f187ca8cSSimon J. Gerraty.if commands(${SHLIB_LINK:R}.ld) 510da6620e4SVal Packett ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 511f187ca8cSSimon J. Gerraty ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \ 5122442cc58SDag-Erling Smørgrav ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 513f051a5b3SColin Percival.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS} 5147afab8a6SMark Johnston ${INSTALL_LIBSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${SHLIB_LINK} \ 5157afab8a6SMark Johnston ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK} 516f051a5b3SColin Percival.endfor 51751a65f35SJeremie Le Hen.else 5182442cc58SDag-Erling Smørgrav.if ${_SHLIBDIR} == ${_LIBDIR} 519a0b88a5dSBaptiste Daroussin.if ${SHLIB_LINK:Mlib*} 5207afab8a6SMark Johnston ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \ 5217afab8a6SMark Johnston ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 522be01c222SRuslan Ermilov.else 5237afab8a6SMark Johnston ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ 5242442cc58SDag-Erling Smørgrav ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 525a0b88a5dSBaptiste Daroussin.endif 526a0b88a5dSBaptiste Daroussin.else 527a0b88a5dSBaptiste Daroussin.if ${SHLIB_LINK:Mlib*} 5287afab8a6SMark Johnston ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \ 5297afab8a6SMark Johnston ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 530a0b88a5dSBaptiste Daroussin.else 5317afab8a6SMark Johnston ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} \ 5327afab8a6SMark Johnston ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} 533a0b88a5dSBaptiste Daroussin.endif 5342442cc58SDag-Erling Smørgrav.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME}) 5352442cc58SDag-Erling Smørgrav -chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 5362442cc58SDag-Erling Smørgrav rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} 537be01c222SRuslan Ermilov.endif 5387afab8a6SMark Johnston.endif # _SHLIBDIR == _LIBDIR 53951a65f35SJeremie Le Hen.endif # SHLIB_LDSCRIPT 54051a65f35SJeremie Le Hen.endif # SHLIB_LINK 54151a65f35SJeremie Le Hen.endif # SHIB_NAME 5425f2e8401SEd Maste.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 543697b271dSEd Maste ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 54461c20fc7SBryan Drewery ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/ 5453585b293SGarrett Wollman.endif 54684aac273SHartmut Brandt.endif # !defined(INTERNALLIB) 547c7b111cbSRuslan Ermilov 548afd9b463SBrooks Davis.if !defined(LIBRARIES_ONLY) 549b9f5e422SAlexey Zelkin.include <bsd.nls.mk> 5508f958ba9SBrad Davis.include <bsd.confs.mk> 551af2dc868SRuslan Ermilov.include <bsd.files.mk> 552970d1bbfSEmmanuel Vadot#No need to install header for INTERNALLIB 553970d1bbfSEmmanuel Vadot.if !defined(INTERNALLIB) 5545d862037SRuslan Ermilov.include <bsd.incs.mk> 555afd9b463SBrooks Davis.endif 556970d1bbfSEmmanuel Vadot.endif 557afd9b463SBrooks Davis 558fa8c921eSBrooks DavisLINKOWN?= ${LIBOWN} 559fa8c921eSBrooks DavisLINKGRP?= ${LIBGRP} 560fa8c921eSBrooks DavisLINKMODE?= ${LIBMODE} 561fa8c921eSBrooks DavisSYMLINKOWN?= ${LIBOWN} 562fa8c921eSBrooks DavisSYMLINKGRP?= ${LIBGRP} 5634e899378SDoug RabsonLINKTAGS= dev 56484f94a79SRuslan Ermilov.include <bsd.links.mk> 565afe61c15SRodney W. Grimes 566dda3ce5aSBrooks Davis.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 567f1702f87SBryan Dreweryrealinstall: maninstall 568f1702f87SBryan Drewery.ORDER: beforeinstall maninstall 569b90dab70SRuslan Ermilov.endif 570b90dab70SRuslan Ermilov 571afe61c15SRodney W. Grimes.endif 572afe61c15SRodney W. Grimes 573afd9b463SBrooks Davis.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) 574afe61c15SRodney W. Grimes.include <bsd.man.mk> 575918fb560SRuslan Ermilov.endif 5763585b293SGarrett Wollman 5774d7d5e7cSRuslan Ermilov.if defined(LIB) && !empty(LIB) 578d7beff08SBryan DreweryOBJS_DEPEND_GUESS+= ${SRCS:M*.h} 5796b14fdfaSRuslan Ermilov.for _S in ${SRCS:N*.[hly]} 5802506d700SSimon J. GerratyOBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S} 5816b14fdfaSRuslan Ermilov.endfor 5824d7d5e7cSRuslan Ermilov.endif 5834d7d5e7cSRuslan Ermilov.if defined(SHLIB_NAME) || \ 5844d7d5e7cSRuslan Ermilov defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 5856b14fdfaSRuslan Ermilov.for _S in ${SRCS:N*.[hly]} 5862506d700SSimon J. GerratyOBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S} 5876b14fdfaSRuslan Ermilov.endfor 58814172e46SBruce Evans.endif 589db08bfceSKonstantin Belousov.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) 590db08bfceSKonstantin Belousov.for _S in ${SRCS:N*.[hly]} 591db08bfceSKonstantin BelousovOBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+= ${_S} 592db08bfceSKonstantin Belousov.endfor 593db08bfceSKonstantin Belousov.endif 59414172e46SBruce Evans 59538f8fddfSEnji Cooper.if defined(HAS_TESTS) 59638f8fddfSEnji CooperMAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes 59738f8fddfSEnji CooperSUBDIR_TARGETS+= check 59838f8fddfSEnji CooperTESTS_LD_LIBRARY_PATH+= ${.OBJDIR} 59938f8fddfSEnji Cooper.endif 60038f8fddfSEnji Cooper 601d7beff08SBryan Drewery.include <bsd.dep.mk> 602aae63957SBryan Drewery.include <bsd.clang-analyze.mk> 603cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk> 604d510ecb4SKris Kennaway.include <bsd.sys.mk> 605