xref: /freebsd/share/mk/bsd.lib.mk (revision ab1e0d2410ece7d391a5b1e2cbc9d1e9857c2fdb)
1#	from: @(#)bsd.lib.mk	5.26 (Berkeley) 5/2/91
2# $FreeBSD$
3#
4
5.include <bsd.init.mk>
6
7.if defined(LIB_CXX) || defined(SHLIB_CXX)
8_LD=	${CXX}
9.else
10_LD=	${CC}
11.endif
12.if defined(LIB_CXX)
13LIB=	${LIB_CXX}
14.endif
15.if defined(SHLIB_CXX)
16SHLIB=	${SHLIB_CXX}
17.endif
18
19LIB_PRIVATE=	${PRIVATELIB:Dprivate}
20# Set up the variables controlling shared libraries.  After this section,
21# SHLIB_NAME will be defined only if we are to create a shared library.
22# SHLIB_LINK will be defined only if we are to create a link to it.
23# INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive.
24# BUILD_NOSSP_PIC_ARCHIVE will be defined only if we are to create a PIC archive.
25.if defined(NO_PIC)
26.undef SHLIB_NAME
27.undef INSTALL_PIC_ARCHIVE
28.undef BUILD_NOSSP_PIC_ARCHIVE
29.else
30.if !defined(SHLIB) && defined(LIB)
31SHLIB=		${LIB}
32.endif
33.if !defined(SHLIB_NAME) && defined(SHLIB) && defined(SHLIB_MAJOR)
34SHLIB_NAME=	lib${LIB_PRIVATE}${SHLIB}.so.${SHLIB_MAJOR}
35.endif
36.if defined(SHLIB_NAME) && !empty(SHLIB_NAME:M*.so.*)
37SHLIB_LINK?=	${SHLIB_NAME:R}
38.endif
39SONAME?=	${SHLIB_NAME}
40.endif
41
42.if defined(CRUNCH_CFLAGS)
43CFLAGS+=	${CRUNCH_CFLAGS}
44.endif
45
46.if ${MK_ASSERT_DEBUG} == "no"
47CFLAGS+= -DNDEBUG
48NO_WERROR=
49.endif
50
51.if defined(DEBUG_FLAGS)
52CFLAGS+= ${DEBUG_FLAGS}
53
54.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
55CTFFLAGS+= -g
56.endif
57.else
58STRIP?=	-s
59.endif
60
61.if ${SHLIBDIR:M*lib32*}
62TAGS+=	lib32
63.endif
64
65.if defined(NO_ROOT)
66.if !defined(TAGS) || ! ${TAGS:Mpackage=*}
67TAGS+=		package=${PACKAGE:Uruntime}
68.endif
69TAG_ARGS=	-T ${TAGS:[*]:S/ /,/g}
70.endif
71
72# ELF hardening knobs
73.if ${MK_BIND_NOW} != "no"
74LDFLAGS+= -Wl,-znow
75.endif
76.if ${MK_RETPOLINE} != "no"
77CFLAGS+= -mretpoline
78CXXFLAGS+= -mretpoline
79LDFLAGS+= -Wl,-zretpolineplt
80.endif
81
82.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
83    empty(DEBUG_FLAGS:M-gdwarf*)
84CFLAGS+= ${DEBUG_FILES_CFLAGS}
85CXXFLAGS+= ${DEBUG_FILES_CFLAGS}
86CTFFLAGS+= -g
87.endif
88
89.include <bsd.libnames.mk>
90
91# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
92# .pico used for PIC object files
93# .nossppico used for NOSSP PIC object files
94.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
95
96.if !defined(PICFLAG)
97.if ${MACHINE_CPUARCH} == "sparc64"
98PICFLAG=-fPIC
99.else
100PICFLAG=-fpic
101.endif
102.endif
103
104PO_FLAG=-pg
105
106.c.po:
107	${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
108	${CTFCONVERT_CMD}
109
110.c.pico:
111	${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
112	${CTFCONVERT_CMD}
113
114.c.nossppico:
115	${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} ${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
116	${CTFCONVERT_CMD}
117
118.cc.po .C.po .cpp.po .cxx.po:
119	${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
120
121.cc.pico .C.pico .cpp.pico .cxx.pico:
122	${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
123
124.cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico:
125	${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
126
127.f.po:
128	${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
129	${CTFCONVERT_CMD}
130
131.f.pico:
132	${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
133	${CTFCONVERT_CMD}
134
135.f.nossppico:
136	${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC}
137	${CTFCONVERT_CMD}
138
139.s.po .s.pico .s.nossppico:
140	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
141	${CTFCONVERT_CMD}
142
143.asm.po:
144	${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DPROF ${PO_CFLAGS} \
145	    ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
146	${CTFCONVERT_CMD}
147
148.asm.pico:
149	${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
150	    ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
151	${CTFCONVERT_CMD}
152
153.asm.nossppico:
154	${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
155	    ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
156	${CTFCONVERT_CMD}
157
158.S.po:
159	${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \
160	    -o ${.TARGET}
161	${CTFCONVERT_CMD}
162
163.S.pico:
164	${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \
165	    -c ${.IMPSRC} -o ${.TARGET}
166	${CTFCONVERT_CMD}
167
168.S.nossppico:
169	${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} \
170	    -c ${.IMPSRC} -o ${.TARGET}
171	${CTFCONVERT_CMD}
172
173_LIBDIR:=${LIBDIR}
174_SHLIBDIR:=${SHLIBDIR}
175
176.if defined(SHLIB_NAME)
177.if ${MK_DEBUG_FILES} != "no"
178SHLIB_NAME_FULL=${SHLIB_NAME}.full
179# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
180.if ${_SHLIBDIR} == "/boot" ||\
181    ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\
182    ${SHLIBDIR:C%/usr/(tests/)?lib(32|exec)?(/.*)?%/usr/lib%} == "/usr/lib"
183DEBUGFILEDIR=${DEBUGDIR}${_SHLIBDIR}
184.else
185DEBUGFILEDIR=${_SHLIBDIR}/.debug
186.endif
187.if !exists(${DESTDIR}${DEBUGFILEDIR})
188DEBUGMKDIR=
189.endif
190.else
191SHLIB_NAME_FULL=${SHLIB_NAME}
192.endif
193.endif
194
195.include <bsd.symver.mk>
196
197# Allow libraries to specify their own version map or have it
198# automatically generated (see bsd.symver.mk above).
199.if ${MK_SYMVER} == "yes" && !empty(VERSION_MAP)
200${SHLIB_NAME_FULL}:	${VERSION_MAP}
201LDFLAGS+=	-Wl,--version-script=${VERSION_MAP}
202.endif
203
204.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
205OBJS+=		${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/}
206BCOBJS+=	${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g}
207LLOBJS+=	${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g}
208CLEANFILES+=	${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS}
209.endif
210
211.if defined(LIB) && !empty(LIB)
212_LIBS=		lib${LIB_PRIVATE}${LIB}.a
213
214lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS}
215	@${ECHO} building static ${LIB} library
216	@rm -f ${.TARGET}
217	${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \
218	    ${LORDER} ${OBJS} ${STATICOBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD}
219	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
220.endif
221
222.if !defined(INTERNALLIB)
223
224.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
225_LIBS+=		lib${LIB_PRIVATE}${LIB}_p.a
226POBJS+=		${OBJS:.o=.po} ${STATICOBJS:.o=.po}
227DEPENDOBJS+=	${POBJS}
228CLEANFILES+=	${POBJS}
229
230lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS}
231	@${ECHO} building profiled ${LIB} library
232	@rm -f ${.TARGET}
233	${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \
234	    ${LORDER} ${POBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD}
235	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
236.endif
237
238.if defined(LLVM_LINK)
239lib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS}
240	${LLVM_LINK} -o ${.TARGET} ${BCOBJS}
241
242lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS}
243	${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS}
244
245CLEANFILES+=	lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll
246.endif
247
248.if defined(SHLIB_NAME) || \
249    defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
250SOBJS+=		${OBJS:.o=.pico}
251DEPENDOBJS+=	${SOBJS}
252CLEANFILES+=	${SOBJS}
253.endif
254
255.if defined(SHLIB_NAME)
256_LIBS+=		${SHLIB_NAME}
257
258SOLINKOPTS+=	-shared -Wl,-x
259.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no"
260SOLINKOPTS+=	-Wl,--no-fatal-warnings
261.else
262SOLINKOPTS+=	-Wl,--fatal-warnings
263.endif
264SOLINKOPTS+=	-Wl,--warn-shared-textrel
265
266.if target(beforelinking)
267beforelinking: ${SOBJS}
268${SHLIB_NAME_FULL}: beforelinking
269.endif
270
271.if defined(SHLIB_LINK)
272.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
273${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT}
274	sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \
275	    -e 's,@@LIBDIR@@,${_LIBDIR},g' \
276	    ${.ALLSRC} > ${.TARGET}
277
278${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld
279CLEANFILES+=	${SHLIB_LINK:R}.ld
280.endif
281CLEANFILES+=	${SHLIB_LINK}
282.endif
283
284${SHLIB_NAME_FULL}: ${SOBJS}
285	@${ECHO} building shared library ${SHLIB_NAME}
286	@rm -f ${SHLIB_NAME} ${SHLIB_LINK}
287.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no"
288	@${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
289.endif
290	${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
291	    -o ${.TARGET} -Wl,-soname,${SONAME} \
292	    `NM='${NM}' NMFLAGS='${NMFLAGS}' ${LORDER} ${SOBJS} | \
293	    ${TSORT} ${TSORTFLAGS}` ${LDADD}
294.if ${MK_CTF} != "no"
295	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
296.endif
297
298.if ${MK_DEBUG_FILES} != "no"
299CLEANFILES+=	${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
300${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
301	${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \
302	    ${SHLIB_NAME_FULL} ${.TARGET}
303.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
304	@${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
305.endif
306
307${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL}
308	${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET}
309.endif
310.endif #defined(SHLIB_NAME)
311
312.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
313_LIBS+=		lib${LIB_PRIVATE}${LIB}_pic.a
314
315lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS}
316	@${ECHO} building special pic ${LIB} library
317	@rm -f ${.TARGET}
318	${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD}
319	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
320.endif
321
322.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
323NOSSPSOBJS+=	${OBJS:.o=.nossppico}
324DEPENDOBJS+=	${NOSSPSOBJS}
325CLEANFILES+=	${NOSSPSOBJS}
326_LIBS+=		lib${LIB_PRIVATE}${LIB}_nossp_pic.a
327
328lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS}
329	@${ECHO} building special nossp pic ${LIB} library
330	@rm -f ${.TARGET}
331	${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD}
332	${RANLIB} ${RANLIBFLAGS} ${.TARGET}
333.endif
334
335.endif # !defined(INTERNALLIB)
336
337.if defined(_SKIP_BUILD)
338all:
339.else
340.if defined(_LIBS) && !empty(_LIBS)
341all: ${_LIBS}
342.endif
343
344.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
345all: all-man
346.endif
347.endif
348
349CLEANFILES+=	${_LIBS}
350
351_EXTRADEPEND:
352.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME)
353.if defined(DPADD) && !empty(DPADD)
354	echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE}
355.endif
356.endif
357
358.if !target(install)
359
360.if defined(PRECIOUSLIB)
361.if !defined(NO_FSCHG)
362SHLINSTALLFLAGS+= -fschg
363.endif
364.endif
365# Install libraries with -S to avoid risk of modifying in-use libraries when
366# installing to a running system.  It is safe to avoid this for NO_ROOT builds
367# that are only creating an image.
368.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT)
369SHLINSTALLFLAGS+= -S
370.endif
371
372_INSTALLFLAGS:=	${INSTALLFLAGS}
373.for ie in ${INSTALLFLAGS_EDIT}
374_INSTALLFLAGS:=	${_INSTALLFLAGS${ie}}
375.endfor
376_SHLINSTALLFLAGS:=	${SHLINSTALLFLAGS}
377.for ie in ${INSTALLFLAGS_EDIT}
378_SHLINSTALLFLAGS:=	${_SHLINSTALLFLAGS${ie}}
379.endfor
380
381.if !defined(INTERNALLIB)
382realinstall: _libinstall
383.ORDER: beforeinstall _libinstall
384_libinstall:
385.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
386	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
387	    ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}/
388.endif
389.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
390	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},profile} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
391	    ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/
392.endif
393.if defined(SHLIB_NAME)
394	${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
395	    ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
396	    ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/
397.if ${MK_DEBUG_FILES} != "no"
398.if defined(DEBUGMKDIR)
399	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -d ${DESTDIR}${DEBUGFILEDIR}/
400.endif
401	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \
402	    ${_INSTALLFLAGS} \
403	    ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/
404.endif
405.if defined(SHLIB_LINK)
406.if commands(${SHLIB_LINK:R}.ld)
407	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
408	    ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
409	    ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
410.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS}
411	${INSTALL_LIBSYMLINK} ${SHLIB_LINK} ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK}
412.endfor
413.else
414.if ${_SHLIBDIR} == ${_LIBDIR}
415.if ${SHLIB_LINK:Mlib*}
416	${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
417.else
418	${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
419	    ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
420.endif
421.else
422.if ${SHLIB_LINK:Mlib*}
423	${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
424	    ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
425.else
426	${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
427	    ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
428.endif
429.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME})
430	-chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME}
431	rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME}
432.endif
433.endif
434.endif # SHLIB_LDSCRIPT
435.endif # SHLIB_LINK
436.endif # SHIB_NAME
437.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
438	${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
439	    ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/
440.endif
441.endif # !defined(INTERNALLIB)
442
443.if !defined(LIBRARIES_ONLY)
444.include <bsd.nls.mk>
445.include <bsd.confs.mk>
446.include <bsd.files.mk>
447.include <bsd.incs.mk>
448.endif
449
450LINKOWN?=	${LIBOWN}
451LINKGRP?=	${LIBGRP}
452LINKMODE?=	${LIBMODE}
453SYMLINKOWN?=	${LIBOWN}
454SYMLINKGRP?=	${LIBGRP}
455.include <bsd.links.mk>
456
457.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
458realinstall: maninstall
459.ORDER: beforeinstall maninstall
460.endif
461
462.endif
463
464.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
465.include <bsd.man.mk>
466.endif
467
468.if defined(LIB) && !empty(LIB)
469OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
470.for _S in ${SRCS:N*.[hly]}
471OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+=	${_S}
472.endfor
473.endif
474.if defined(SHLIB_NAME) || \
475    defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
476.for _S in ${SRCS:N*.[hly]}
477OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+=	${_S}
478.endfor
479.endif
480.if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
481.for _S in ${SRCS:N*.[hly]}
482OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+=	${_S}
483.endfor
484.endif
485
486.if defined(HAS_TESTS)
487MAKE+=			MK_MAKE_CHECK_USE_SANDBOX=yes
488SUBDIR_TARGETS+=	check
489TESTS_LD_LIBRARY_PATH+=	${.OBJDIR}
490.endif
491
492.include <bsd.dep.mk>
493.include <bsd.clang-analyze.mk>
494.include <bsd.obj.mk>
495.include <bsd.sys.mk>
496