xref: /freebsd/share/mk/bsd.lib.mk (revision 0e4c4cc4916c965f7f3116e1840396755d6b21f4)
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
1212a44cccdSAlexander Leidinger# Zero used registers on return (mitigate some ROP)
1222a44cccdSAlexander Leidinger.if ${MK_ZEROREGS} != "no"
1232a44cccdSAlexander Leidinger.if ${COMPILER_FEATURES:Mzeroregs}
1242a44cccdSAlexander LeidingerZEROREG_TYPE?= used
1252a44cccdSAlexander LeidingerCFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE}
1262a44cccdSAlexander LeidingerCXXFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE}
1272a44cccdSAlexander Leidinger.endif
1282a44cccdSAlexander Leidinger.endif
1292a44cccdSAlexander 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
151*0e4c4cc4SJohn Baldwin# prefer .s to a .c, 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
155*0e4c4cc4SJohn Baldwin.SUFFIXES: .out .o .bc .ll .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
1622b4da8aaSMarcel Moolenaar.c.pico:
1639a1f7ce5SEnji Cooper	${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
16478e7e3ecSMax Khon	${CTFCONVERT_CMD}
1653585b293SGarrett Wollman
166db08bfceSKonstantin Belousov.c.nossppico:
1671c2ae923SAlexander Leidinger	${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET}
168db08bfceSKonstantin Belousov	${CTFCONVERT_CMD}
169db08bfceSKonstantin Belousov
170bcf99d2dSEd Maste.c.pieo:
171bcf99d2dSEd Maste	${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
172bcf99d2dSEd Maste	${CTFCONVERT_CMD}
173bcf99d2dSEd Maste
1742b4da8aaSMarcel Moolenaar.cc.pico .C.pico .cpp.pico .cxx.pico:
1759a1f7ce5SEnji Cooper	${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
1763585b293SGarrett Wollman
177db08bfceSKonstantin Belousov.cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico:
1781c2ae923SAlexander Leidinger	${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET}
179db08bfceSKonstantin Belousov
180bcf99d2dSEd Maste.cc.pieo .C.pieo .cpp.pieo .cxx.pieo:
181bcf99d2dSEd Maste	${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
182bcf99d2dSEd Maste
1832b4da8aaSMarcel Moolenaar.f.pico:
1843585b293SGarrett Wollman	${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
18578e7e3ecSMax Khon	${CTFCONVERT_CMD}
1863585b293SGarrett Wollman
187db08bfceSKonstantin Belousov.f.nossppico:
1881c2ae923SAlexander Leidinger	${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} -o ${.TARGET} -c ${.IMPSRC}
189db08bfceSKonstantin Belousov	${CTFCONVERT_CMD}
190db08bfceSKonstantin Belousov
191*0e4c4cc4SJohn Baldwin.s.pico .s.nossppico .s.pieo:
192b2dcde7eSEd Maste	${CC:N${CCACHE_BIN}} -x assembler ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
19378e7e3ecSMax Khon	${CTFCONVERT_CMD}
1943585b293SGarrett Wollman
1952b4da8aaSMarcel Moolenaar.asm.pico:
1969160419cSBryan Drewery	${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
1979160419cSBryan Drewery	    ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
19878e7e3ecSMax Khon	${CTFCONVERT_CMD}
199d58e932fSRuslan Ermilov
200db08bfceSKonstantin Belousov.asm.nossppico:
201db08bfceSKonstantin Belousov	${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
2021c2ae923SAlexander Leidinger	    ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
203db08bfceSKonstantin Belousov	${CTFCONVERT_CMD}
204db08bfceSKonstantin Belousov
205bcf99d2dSEd Maste.asm.pieo:
206bcf99d2dSEd Maste	${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \
207bcf99d2dSEd Maste	    ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
208bcf99d2dSEd Maste	${CTFCONVERT_CMD}
209bcf99d2dSEd Maste
2102b4da8aaSMarcel Moolenaar.S.pico:
2119160419cSBryan Drewery	${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \
2129160419cSBryan Drewery	    -c ${.IMPSRC} -o ${.TARGET}
21378e7e3ecSMax Khon	${CTFCONVERT_CMD}
2143585b293SGarrett Wollman
215db08bfceSKonstantin Belousov.S.nossppico:
2161c2ae923SAlexander Leidinger	${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} ${ACFLAGS} \
217db08bfceSKonstantin Belousov	    -c ${.IMPSRC} -o ${.TARGET}
218db08bfceSKonstantin Belousov	${CTFCONVERT_CMD}
219db08bfceSKonstantin Belousov
220bcf99d2dSEd Maste.S.pieo:
221bcf99d2dSEd Maste	${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \
222bcf99d2dSEd Maste	    -c ${.IMPSRC} -o ${.TARGET}
223bcf99d2dSEd Maste	${CTFCONVERT_CMD}
224bcf99d2dSEd Maste
2252442cc58SDag-Erling Smørgrav_LIBDIR:=${LIBDIR}
2262442cc58SDag-Erling Smørgrav_SHLIBDIR:=${SHLIBDIR}
2272442cc58SDag-Erling Smørgrav
2280d1fce25SEd Maste.if defined(SHLIB_NAME)
22942f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no"
23042f8c5b5SEd MasteSHLIB_NAME_FULL=${SHLIB_NAME}.full
23142f8c5b5SEd Maste# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
2322442cc58SDag-Erling Smørgrav.if ${_SHLIBDIR} == "/boot" ||\
23342f8c5b5SEd Maste    ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\
234955f974aSJose Luis Duran    ${SHLIBDIR:C%/usr/lib(32|exec)?(/.*)?%/usr/lib%} == "/usr/lib" ||\
23588d448ecSJose Luis Duran    ${SHLIBDIR:C%/usr/tests(/.*)?%/usr/tests%} == "/usr/tests"
2362442cc58SDag-Erling SmørgravDEBUGFILEDIR=${DEBUGDIR}${_SHLIBDIR}
23742f8c5b5SEd Maste.else
2382442cc58SDag-Erling SmørgravDEBUGFILEDIR=${_SHLIBDIR}/.debug
239a324b0f0SBryan Drewery.endif
240a324b0f0SBryan Drewery.if !exists(${DESTDIR}${DEBUGFILEDIR})
24142f8c5b5SEd MasteDEBUGMKDIR=
24242f8c5b5SEd Maste.endif
2430d1fce25SEd Maste.else
2440d1fce25SEd MasteSHLIB_NAME_FULL=${SHLIB_NAME}
2450d1fce25SEd Maste.endif
2460d1fce25SEd Maste.endif
2470d1fce25SEd Maste
2482da4e470SAlexander Kabaev.include <bsd.symver.mk>
249ab52e991SDaniel Eischen
250046f4ebaSAlexander Kabaev# Allow libraries to specify their own version map or have it
2512da4e470SAlexander Kabaev# automatically generated (see bsd.symver.mk above).
252371f3da6SJohn Baldwin.if !empty(VERSION_MAP)
2530d1fce25SEd Maste${SHLIB_NAME_FULL}:	${VERSION_MAP}
254ab52e991SDaniel EischenLDFLAGS+=	-Wl,--version-script=${VERSION_MAP}
2552ba84b4bSDimitry Andric
2562956f588SBrooks Davis# Ideally we'd always enable --no-undefined-version (default for lld >= 16),
2572956f588SBrooks Davis# but we have several symbols in our version maps that may or may not exist,
2582956f588SBrooks Davis# depending on compile-time defines and that needs to be handled first.
2592956f588SBrooks Davis.if ${MK_UNDEFINED_VERSION} == "no"
2602956f588SBrooks DavisLDFLAGS+=	-Wl,--no-undefined-version
2612956f588SBrooks Davis.else
2622ba84b4bSDimitry AndricLDFLAGS+=	-Wl,--undefined-version
2632ba84b4bSDimitry Andric.endif
264ab52e991SDaniel Eischen.endif
265ab52e991SDaniel Eischen
2664d7d5e7cSRuslan Ermilov.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
2672506d700SSimon J. GerratyOBJS+=		${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/}
2684f2fac37SJonathan AndersonBCOBJS+=	${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g}
2694f2fac37SJonathan AndersonLLOBJS+=	${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g}
2704f2fac37SJonathan AndersonCLEANFILES+=	${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS}
2714d7d5e7cSRuslan Ermilov.endif
2724d7d5e7cSRuslan Ermilov
2732a53f3fbSRuslan Ermilov.if defined(LIB) && !empty(LIB)
2749294a2c7SBaptiste Daroussin.if defined(STATIC_LDSCRIPT)
2759294a2c7SBaptiste Daroussin_STATICLIB_SUFFIX=	_real
2769294a2c7SBaptiste Daroussin.endif
2779294a2c7SBaptiste Daroussin_LIBS=		lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a
278afe61c15SRodney W. Grimes
2799294a2c7SBaptiste Daroussinlib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a: ${OBJS} ${STATICOBJS}
280c6e56e65SMinsoo Choo	@${ECHO} Building static ${LIB} library
2812a53f3fbSRuslan Ermilov	@rm -f ${.TARGET}
2820e1e341bSAlex Richardson	${AR} ${ARFLAGS} ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD}
2834d7d5e7cSRuslan Ermilov.endif
284afe61c15SRodney W. Grimes
2852a53f3fbSRuslan Ermilov.if !defined(INTERNALLIB)
2862a53f3fbSRuslan Ermilov
287e4195e2eSJonathan Anderson.if defined(LLVM_LINK)
288e4195e2eSJonathan Andersonlib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS}
289e4195e2eSJonathan Anderson	${LLVM_LINK} -o ${.TARGET} ${BCOBJS}
290e4195e2eSJonathan Anderson
291e4195e2eSJonathan Andersonlib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS}
292e4195e2eSJonathan Anderson	${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS}
293fd8103edSJonathan Anderson
294fd8103edSJonathan AndersonCLEANFILES+=	lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll
295e4195e2eSJonathan Anderson.endif
296e4195e2eSJonathan Anderson
2974d7d5e7cSRuslan Ermilov.if defined(SHLIB_NAME) || \
2984d7d5e7cSRuslan Ermilov    defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
2992b4da8aaSMarcel MoolenaarSOBJS+=		${OBJS:.o=.pico}
30010f696a5SBryan DreweryDEPENDOBJS+=	${SOBJS}
301491b2960SBryan DreweryCLEANFILES+=	${SOBJS}
3024d7d5e7cSRuslan Ermilov.endif
3038c05a446SPeter Wemm
304f67eb0dcSJohn Polstra.if defined(SHLIB_NAME)
3052a53f3fbSRuslan Ermilov_LIBS+=		${SHLIB_NAME}
3062a53f3fbSRuslan Ermilov
307ee05c0f1SBryan DrewerySOLINKOPTS+=	-shared -Wl,-x
30870d099afSBaptiste Daroussin.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no"
30970d099afSBaptiste DaroussinSOLINKOPTS+=	-Wl,--no-fatal-warnings
31070d099afSBaptiste Daroussin.else
31170d099afSBaptiste DaroussinSOLINKOPTS+=	-Wl,--fatal-warnings
31270d099afSBaptiste Daroussin.endif
31370d099afSBaptiste DaroussinSOLINKOPTS+=	-Wl,--warn-shared-textrel
314bd4632e6SKonstantin Belousov
315c2c48445SRui Paulo.if target(beforelinking)
316593c0b49SMark Johnstonbeforelinking: ${SOBJS}
317593c0b49SMark Johnston${SHLIB_NAME_FULL}: beforelinking
318c2c48445SRui Paulo.endif
319f187ca8cSSimon J. Gerraty
320f187ca8cSSimon J. Gerraty.if defined(SHLIB_LINK)
321f187ca8cSSimon J. Gerraty.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
3225852ae2dSBryan Drewery${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT}
3231b337a34SBryan Drewery	sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \
3241b337a34SBryan Drewery	    -e 's,@@LIBDIR@@,${_LIBDIR},g' \
325f187ca8cSSimon J. Gerraty	    ${.ALLSRC} > ${.TARGET}
326f187ca8cSSimon J. Gerraty
327f187ca8cSSimon J. Gerraty${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld
328491b2960SBryan DreweryCLEANFILES+=	${SHLIB_LINK:R}.ld
329f187ca8cSSimon J. Gerraty.endif
330491b2960SBryan DreweryCLEANFILES+=	${SHLIB_LINK}
331f187ca8cSSimon J. Gerraty.endif
332f187ca8cSSimon J. Gerraty
3335852ae2dSBryan Drewery${SHLIB_NAME_FULL}: ${SOBJS}
334c6e56e65SMinsoo Choo	@${ECHO} Building shared library ${SHLIB_NAME}
335e97696b5SEd Maste	@rm -f ${SHLIB_NAME} ${SHLIB_LINK}
336447bb5a3SBryan Drewery.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no"
337c3d67d6cSAlex Richardson	# Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR
338c3d67d6cSAlex Richardson	@${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK}
339f67eb0dcSJohn Polstra.endif
3409160419cSBryan Drewery	${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
3410e1e341bSAlex Richardson	    -o ${.TARGET} -Wl,-soname,${SONAME} ${SOBJS} ${LDADD}
34283cb5baeSMax Khon.if ${MK_CTF} != "no"
343cd49c2e8SMax Khon	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
344cd49c2e8SMax Khon.endif
345e97696b5SEd Maste
34642f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no"
34742f8c5b5SEd MasteCLEANFILES+=	${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
3485852ae2dSBryan Drewery${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
34942f8c5b5SEd Maste	${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \
350593c0b49SMark Johnston	    ${SHLIB_NAME_FULL} ${.TARGET}
351447bb5a3SBryan Drewery.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
352c3d67d6cSAlex Richardson	# Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR
353c3d67d6cSAlex Richardson	@${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK}
354447bb5a3SBryan Drewery.endif
355e97696b5SEd Maste
3565852ae2dSBryan Drewery${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL}
357593c0b49SMark Johnston	${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET}
358e97696b5SEd Maste.endif
35922f3da67SMark Johnston.endif #defined(SHLIB_NAME)
3603585b293SGarrett Wollman
3615f2e8401SEd Maste.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
3625551c573SBaptiste Daroussin_LIBS+=		lib${LIB_PRIVATE}${LIB}_pic.a
3632a53f3fbSRuslan Ermilov
3645852ae2dSBryan Drewerylib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS}
365c6e56e65SMinsoo Choo	@${ECHO} Building special pic ${LIB} library
3662a53f3fbSRuslan Ermilov	@rm -f ${.TARGET}
367b322948eSBryan Drewery	${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD}
36886af0db9SBruce Evans.endif
369afe61c15SRodney W. Grimes
370db08bfceSKonstantin Belousov.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
371db08bfceSKonstantin BelousovNOSSPSOBJS+=	${OBJS:.o=.nossppico}
372db08bfceSKonstantin BelousovDEPENDOBJS+=	${NOSSPSOBJS}
373db08bfceSKonstantin BelousovCLEANFILES+=	${NOSSPSOBJS}
374db08bfceSKonstantin Belousov_LIBS+=		lib${LIB_PRIVATE}${LIB}_nossp_pic.a
375db08bfceSKonstantin Belousov
376db08bfceSKonstantin Belousovlib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS}
377c6e56e65SMinsoo Choo	@${ECHO} Building special nossp pic ${LIB} library
378db08bfceSKonstantin Belousov	@rm -f ${.TARGET}
379db08bfceSKonstantin Belousov	${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD}
380db08bfceSKonstantin Belousov.endif
381db08bfceSKonstantin Belousov
38284aac273SHartmut Brandt.endif # !defined(INTERNALLIB)
3832a53f3fbSRuslan Ermilov
3847c0226caSEd Maste.if defined(INTERNALLIB) && ${MK_PIE} != "no" && defined(LIB) && !empty(LIB)
385bcf99d2dSEd MastePIEOBJS+=	${OBJS:.o=.pieo}
386bcf99d2dSEd MasteDEPENDOBJS+=	${PIEOBJS}
387bcf99d2dSEd MasteCLEANFILES+=	${PIEOBJS}
388bcf99d2dSEd Maste
389bcf99d2dSEd Maste_LIBS+=		lib${LIB_PRIVATE}${LIB}_pie.a
390bcf99d2dSEd Maste
391bcf99d2dSEd Mastelib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS}
392c6e56e65SMinsoo Choo	@${ECHO} Building pie ${LIB} library
393bcf99d2dSEd Maste	@rm -f ${.TARGET}
394bcf99d2dSEd Maste	${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD}
395bcf99d2dSEd Maste.endif
396bcf99d2dSEd Maste
3977750ad47SMarcel Moolenaar.if defined(_SKIP_BUILD)
3987750ad47SMarcel Moolenaarall:
3997750ad47SMarcel Moolenaar.else
400491b2960SBryan Drewery.if defined(_LIBS) && !empty(_LIBS)
4012a53f3fbSRuslan Ermilovall: ${_LIBS}
402491b2960SBryan Drewery.endif
4032a53f3fbSRuslan Ermilov
404740e5b17SBryan Drewery.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
405f1702f87SBryan Dreweryall: all-man
406afe61c15SRodney W. Grimes.endif
4077750ad47SMarcel Moolenaar.endif
408afe61c15SRodney W. Grimes
4091deef6e4SBryan DreweryCLEANFILES+=	${_LIBS}
4101deef6e4SBryan Drewery
411fcccc50bSBruce Evans_EXTRADEPEND:
412a399b3b4SRuslan Ermilov.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME)
413e3ace70eSBruce Evans.if defined(DPADD) && !empty(DPADD)
41437fd8bc2SJohn Baldwin	echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE}
4158c05a446SPeter Wemm.endif
4168c05a446SPeter Wemm.endif
417afe61c15SRodney W. Grimes
418afe61c15SRodney W. Grimes.if !target(install)
419afe61c15SRodney W. Grimes
420da6620e4SVal PackettINSTALLFLAGS+= -C
421c33bd5d6SRuslan Ermilov.if defined(PRECIOUSLIB)
42200fbd407SRuslan Ermilov.if !defined(NO_FSCHG)
423c59ae063SGarrett WollmanSHLINSTALLFLAGS+= -fschg
424c59ae063SGarrett Wollman.endif
42504594feeSBryan Drewery.endif
4265179958aSBryan Drewery# Install libraries with -S to avoid risk of modifying in-use libraries when
4275179958aSBryan Drewery# installing to a running system.  It is safe to avoid this for NO_ROOT builds
4285179958aSBryan Drewery# that are only creating an image.
429dabbf11fSAlex Richardson#
430dabbf11fSAlex Richardson# XXX: Since Makefile.inc1 ends up building lib/libc both as part of
431dabbf11fSAlex Richardson# _startup_libs and as part of _generic_libs it ends up getting installed a
432dabbf11fSAlex Richardson# second time during the parallel build, and although the .WAIT in lib/Makefile
433dabbf11fSAlex Richardson# stops that mattering for lib, other directories like secure/lib are built in
434dabbf11fSAlex Richardson# parallel at the top level and are unaffected by that, so can sometimes race
435dabbf11fSAlex Richardson# with the libc.so.7 reinstall and see a missing or corrupt file. Ideally the
436dabbf11fSAlex Richardson# build system would be fixed to not build/install libc to WORLDTMP the second
437dabbf11fSAlex Richardson# time round, but for now using -S ensures the install is atomic and thus we
438dabbf11fSAlex Richardson# never see a broken intermediate state, so use it even for NO_ROOT builds.
439dabbf11fSAlex Richardson.if !defined(NO_SAFE_LIBINSTALL) #&& !defined(NO_ROOT)
440c33bd5d6SRuslan ErmilovSHLINSTALLFLAGS+= -S
4417afab8a6SMark JohnstonSHLINSTALLSYMLINKFLAGS+= -S
442c33bd5d6SRuslan Ermilov.endif
443c59ae063SGarrett Wollman
444e902c1bbSTim Vanderhoek_INSTALLFLAGS:=	${INSTALLFLAGS}
445e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT}
446e902c1bbSTim Vanderhoek_INSTALLFLAGS:=	${_INSTALLFLAGS${ie}}
447e902c1bbSTim Vanderhoek.endfor
4481a66233dSRuslan Ermilov_SHLINSTALLFLAGS:=	${SHLINSTALLFLAGS}
4497afab8a6SMark Johnston_SHLINSTALLSYMLINKFLAGS:= ${SHLINSTALLSYMLINKFLAGS}
450e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT}
451e902c1bbSTim Vanderhoek_SHLINSTALLFLAGS:=	${_SHLINSTALLFLAGS${ie}}
452e902c1bbSTim Vanderhoek.endfor
453e902c1bbSTim Vanderhoek
4548a84b373SEmmanuel Vadot.if defined(PCFILES)
4558a84b373SEmmanuel Vadot.for pcfile in ${PCFILES}
4568a84b373SEmmanuel Vadotinstallpcfiles: installpcfiles-${pcfile}
4578a84b373SEmmanuel Vadot
4588a84b373SEmmanuel Vadotinstallpcfiles-${pcfile}: ${pcfile}
4598a84b373SEmmanuel Vadot	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4608a84b373SEmmanuel Vadot	    ${_INSTALLFLAGS} \
461ac175bd3SAlex Richardson	    ${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig/
4628a84b373SEmmanuel Vadot.endfor
4638a84b373SEmmanuel Vadot.endif
4648a84b373SEmmanuel Vadotinstallpcfiles: .PHONY
4658a84b373SEmmanuel Vadot
4664d7d5e7cSRuslan Ermilov.if !defined(INTERNALLIB)
4678a84b373SEmmanuel Vadotrealinstall: _libinstall installpcfiles
468badb7c1cSRuslan Ermilov.ORDER: beforeinstall _libinstall
469b25a566dSRuslan Ermilov_libinstall:
4705551c573SBaptiste Daroussin.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
471da6620e4SVal Packett	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
4729294a2c7SBaptiste Daroussin	    ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a ${DESTDIR}${_LIBDIR}/
473fc073e67SEd Maste.endif
474a89bd620SDavid E. O'Brien.if defined(SHLIB_NAME)
475dc6d22c9SBaptiste Daroussin	${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
476e902c1bbSTim Vanderhoek	    ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
47761c20fc7SBryan Drewery	    ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/
47842f8c5b5SEd Maste.if ${MK_DEBUG_FILES} != "no"
47942f8c5b5SEd Maste.if defined(DEBUGMKDIR)
480697b271dSEd Maste	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/
48142f8c5b5SEd Maste.endif
482697b271dSEd Maste	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \
483facaa6eeSEd Maste	    ${_INSTALLFLAGS} \
48461c20fc7SBryan Drewery	    ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/
485e97696b5SEd Maste.endif
4865551c573SBaptiste Daroussin.if defined(SHLIB_LINK)
487f187ca8cSSimon J. Gerraty.if commands(${SHLIB_LINK:R}.ld)
488da6620e4SVal Packett	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
489f187ca8cSSimon J. Gerraty	    ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
4902442cc58SDag-Erling Smørgrav	    ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
491f051a5b3SColin Percival.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS}
4927afab8a6SMark Johnston	${INSTALL_LIBSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${SHLIB_LINK} \
4937afab8a6SMark Johnston	    ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK}
494f051a5b3SColin Percival.endfor
49551a65f35SJeremie Le Hen.else
4962442cc58SDag-Erling Smørgrav.if ${_SHLIBDIR} == ${_LIBDIR}
497a0b88a5dSBaptiste Daroussin.if ${SHLIB_LINK:Mlib*}
4987afab8a6SMark Johnston	${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \
4997afab8a6SMark Johnston	    ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
500be01c222SRuslan Ermilov.else
5017afab8a6SMark Johnston	${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
5022442cc58SDag-Erling Smørgrav	    ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
503a0b88a5dSBaptiste Daroussin.endif
504a0b88a5dSBaptiste Daroussin.else
505a0b88a5dSBaptiste Daroussin.if ${SHLIB_LINK:Mlib*}
5067afab8a6SMark Johnston	${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \
5077afab8a6SMark Johnston	    ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
508a0b88a5dSBaptiste Daroussin.else
5097afab8a6SMark Johnston	${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} \
5107afab8a6SMark Johnston	    ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
511a0b88a5dSBaptiste Daroussin.endif
5122442cc58SDag-Erling Smørgrav.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME})
5132442cc58SDag-Erling Smørgrav	-chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME}
5142442cc58SDag-Erling Smørgrav	rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME}
515be01c222SRuslan Ermilov.endif
5167afab8a6SMark Johnston.endif # _SHLIBDIR == _LIBDIR
51751a65f35SJeremie Le Hen.endif # SHLIB_LDSCRIPT
51851a65f35SJeremie Le Hen.endif # SHLIB_LINK
51951a65f35SJeremie Le Hen.endif # SHIB_NAME
5205f2e8401SEd Maste.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
521697b271dSEd Maste	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
52261c20fc7SBryan Drewery	    ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/
5233585b293SGarrett Wollman.endif
52484aac273SHartmut Brandt.endif # !defined(INTERNALLIB)
525c7b111cbSRuslan Ermilov
526afd9b463SBrooks Davis.if !defined(LIBRARIES_ONLY)
527b9f5e422SAlexey Zelkin.include <bsd.nls.mk>
5288f958ba9SBrad Davis.include <bsd.confs.mk>
529af2dc868SRuslan Ermilov.include <bsd.files.mk>
530970d1bbfSEmmanuel Vadot#No need to install header for INTERNALLIB
531970d1bbfSEmmanuel Vadot.if !defined(INTERNALLIB)
5325d862037SRuslan Ermilov.include <bsd.incs.mk>
533afd9b463SBrooks Davis.endif
534970d1bbfSEmmanuel Vadot.endif
535afd9b463SBrooks Davis
536fa8c921eSBrooks DavisLINKOWN?=	${LIBOWN}
537fa8c921eSBrooks DavisLINKGRP?=	${LIBGRP}
538fa8c921eSBrooks DavisLINKMODE?=	${LIBMODE}
539fa8c921eSBrooks DavisSYMLINKOWN?=	${LIBOWN}
540fa8c921eSBrooks DavisSYMLINKGRP?=	${LIBGRP}
5414e899378SDoug RabsonLINKTAGS=	dev
54284f94a79SRuslan Ermilov.include <bsd.links.mk>
543afe61c15SRodney W. Grimes
544dda3ce5aSBrooks Davis.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
545f1702f87SBryan Dreweryrealinstall: maninstall
546f1702f87SBryan Drewery.ORDER: beforeinstall maninstall
547b90dab70SRuslan Ermilov.endif
548b90dab70SRuslan Ermilov
549afe61c15SRodney W. Grimes.endif
550afe61c15SRodney W. Grimes
551afd9b463SBrooks Davis.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
552afe61c15SRodney W. Grimes.include <bsd.man.mk>
553918fb560SRuslan Ermilov.endif
5543585b293SGarrett Wollman
5554d7d5e7cSRuslan Ermilov.if defined(LIB) && !empty(LIB)
556d7beff08SBryan DreweryOBJS_DEPEND_GUESS+= ${SRCS:M*.h}
5574d7d5e7cSRuslan Ermilov.endif
5584d7d5e7cSRuslan Ermilov.if defined(SHLIB_NAME) || \
5594d7d5e7cSRuslan Ermilov    defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
5606b14fdfaSRuslan Ermilov.for _S in ${SRCS:N*.[hly]}
5612506d700SSimon J. GerratyOBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+=	${_S}
5626b14fdfaSRuslan Ermilov.endfor
56314172e46SBruce Evans.endif
564db08bfceSKonstantin Belousov.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
565db08bfceSKonstantin Belousov.for _S in ${SRCS:N*.[hly]}
566db08bfceSKonstantin BelousovOBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+=	${_S}
567db08bfceSKonstantin Belousov.endfor
568db08bfceSKonstantin Belousov.endif
56914172e46SBruce Evans
57038f8fddfSEnji Cooper.if defined(HAS_TESTS)
57138f8fddfSEnji CooperMAKE+=			MK_MAKE_CHECK_USE_SANDBOX=yes
57238f8fddfSEnji CooperSUBDIR_TARGETS+=	check
57338f8fddfSEnji CooperTESTS_LD_LIBRARY_PATH+=	${.OBJDIR}
57438f8fddfSEnji Cooper.endif
57538f8fddfSEnji Cooper
576d7beff08SBryan Drewery.include <bsd.dep.mk>
577aae63957SBryan Drewery.include <bsd.clang-analyze.mk>
578cd9a2f5cSJordan K. Hubbard.include <bsd.obj.mk>
579d510ecb4SKris Kennaway.include <bsd.sys.mk>
580