src.libnames.mk revision 356775
1# $FreeBSD: stable/11/share/mk/src.libnames.mk 356775 2020-01-16 03:38:06Z kevans $
2#
3# The include file <src.libnames.mk> define library names suitable
4# for INTERNALLIB and PRIVATELIB definition
5
6.if !target(__<bsd.init.mk>__)
7.error src.libnames.mk cannot be included directly.
8.endif
9
10.if !target(__<src.libnames.mk>__)
11__<src.libnames.mk>__:
12
13.include <src.opts.mk>
14
15_PRIVATELIBS=	\
16		atf_c \
17		atf_cxx \
18		bsdstat \
19		devdctl \
20		event \
21		heimipcc \
22		heimipcs \
23		ldns \
24		sqlite3 \
25		ssh \
26		ucl \
27		unbound
28
29_INTERNALLIBS=	\
30		amu \
31		bsnmptools \
32		cron \
33		elftc \
34		fifolog \
35		ipf \
36		lpr \
37		netbsd \
38		ntp \
39		ntpevent \
40		openbsd \
41		opts \
42		parse \
43		pe \
44		readline \
45		sl \
46		sm \
47		smdb \
48		smutil \
49		telnet \
50		vers
51
52_LIBRARIES=	\
53		${_PRIVATELIBS} \
54		${_INTERNALLIBS} \
55		${LOCAL_LIBRARIES} \
56		80211 \
57		alias \
58		archive \
59		asn1 \
60		auditd \
61		avl \
62		be \
63		begemot \
64		bluetooth \
65		bsdxml \
66		bsm \
67		bsnmp \
68		bz2 \
69		c \
70		c_pic \
71		calendar \
72		cam \
73		casper \
74		cap_dns \
75		cap_grp \
76		cap_pwd \
77		cap_random \
78		cap_sysctl \
79		com_err \
80		compiler_rt \
81		crypt \
82		crypto \
83		ctf \
84		cuse \
85		cxxrt \
86		devctl \
87		devdctl \
88		devinfo \
89		devstat \
90		dialog \
91		dl \
92		dpv \
93		dtrace \
94		dwarf \
95		edit \
96		efivar \
97		elf \
98		execinfo \
99		fetch \
100		figpar \
101		geom \
102		gnuregex \
103		gpio \
104		gssapi \
105		gssapi_krb5 \
106		hdb \
107		heimbase \
108		heimntlm \
109		heimsqlite \
110		hx509 \
111		ipsec \
112		jail \
113		kadm5clnt \
114		kadm5srv \
115		kafs5 \
116		kdc \
117		kiconv \
118		krb5 \
119		kvm \
120		l \
121		lzma \
122		m \
123		magic \
124		md \
125		memstat \
126		mp \
127		mt \
128		nandfs \
129		ncurses \
130		ncursesw \
131		netgraph \
132		ngatm \
133		nv \
134		nvpair \
135		opie \
136		pam \
137		panel \
138		panelw \
139		pcap \
140		pcsclite \
141		pjdlog \
142		pmc \
143		proc \
144		procstat \
145		pthread \
146		radius \
147		readline \
148		roken \
149		rpcsec_gss \
150		rpcsvc \
151		rt \
152		rtld_db \
153		sbuf \
154		sdp \
155		sm \
156		smb \
157		ssl \
158		ssp_nonshared \
159		stdthreads \
160		supcplusplus \
161		sysdecode \
162		tacplus \
163		termcap \
164		termcapw \
165		ufs \
166		ugidfw \
167		ulog \
168		umem \
169		usb \
170		usbhid \
171		util \
172		uutil \
173		vmmapi \
174		wind \
175		wrap \
176		xo \
177		y \
178		ypclnt \
179		z \
180		zfs_core \
181		zfs \
182		zpool \
183
184.if ${MK_BLACKLIST} != "no"
185_LIBRARIES+= \
186		blacklist \
187
188.endif
189
190.if ${MK_OFED} != "no"
191_LIBRARIES+= \
192		cxgb4 \
193		ibcm \
194		ibmad \
195		ibnetdisc \
196		ibumad \
197		ibverbs \
198		mlx4 \
199		mlx5 \
200		rdmacm \
201		osmcomp \
202		opensm \
203		osmvendor
204.endif
205
206# Each library's LIBADD needs to be duplicated here for static linkage of
207# 2nd+ order consumers.  Auto-generating this would be better.
208_DP_80211=	sbuf bsdxml
209_DP_archive=	z bz2 lzma bsdxml
210.if ${MK_BLACKLIST} != "no"
211_DP_blacklist+=	pthread
212.endif
213.if ${MK_OPENSSL} != "no"
214_DP_archive+=	crypto
215.else
216_DP_archive+=	md
217.endif
218_DP_sqlite3=	pthread
219_DP_ssl=	crypto
220_DP_ssh=	crypto crypt z
221.if ${MK_LDNS} != "no"
222_DP_ssh+=	ldns
223.endif
224_DP_edit=	ncursesw
225.if ${MK_OPENSSL} != "no"
226_DP_bsnmp=	crypto
227.endif
228_DP_geom=	bsdxml sbuf
229_DP_cam=	sbuf
230_DP_kvm=	elf
231_DP_casper=	nv
232_DP_cap_dns=	nv
233_DP_cap_grp=	nv
234_DP_cap_pwd=	nv
235_DP_cap_random=	nv
236_DP_cap_sysctl=	nv
237.if ${MK_OFED} != "no"
238_DP_pcap=	ibverbs mlx5
239.endif
240_DP_pjdlog=	util
241_DP_opie=	md
242_DP_usb=	pthread
243_DP_unbound=	ssl crypto pthread
244_DP_rt=	pthread
245.if ${MK_OPENSSL} == "no"
246_DP_radius=	md
247.else
248_DP_radius=	crypto
249.endif
250_DP_procstat=	kvm util elf
251.if ${MK_CXX} == "yes"
252.if ${MK_LIBCPLUSPLUS} != "no"
253_DP_proc=	cxxrt
254.else
255_DP_proc=	supcplusplus
256.endif
257.endif
258.if ${MK_CDDL} != "no"
259_DP_proc+=	ctf
260.endif
261_DP_proc+=	elf rtld_db util
262_DP_mp=	crypto
263_DP_memstat=	kvm
264_DP_magic=	z
265_DP_mt=		sbuf bsdxml
266_DP_ldns=	crypto
267.if ${MK_OPENSSL} != "no"
268_DP_fetch=	ssl crypto
269.else
270_DP_fetch=	md
271.endif
272_DP_execinfo=	elf
273_DP_dwarf=	elf
274_DP_dpv=	dialog figpar util ncursesw
275_DP_dialog=	ncursesw m
276_DP_cuse=	pthread
277_DP_atf_cxx=	atf_c
278_DP_devstat=	kvm
279_DP_pam=	radius tacplus opie md util
280.if ${MK_KERBEROS} != "no"
281_DP_pam+=	krb5
282.endif
283.if ${MK_OPENSSH} != "no"
284_DP_pam+=	ssh
285.endif
286.if ${MK_NIS} != "no"
287_DP_pam+=	ypclnt
288.endif
289_DP_readline=	ncursesw
290_DP_roken=	crypt
291_DP_kadm5clnt=	com_err krb5 roken
292_DP_kadm5srv=	com_err hdb krb5 roken
293_DP_heimntlm=	crypto com_err krb5 roken
294_DP_hx509=	asn1 com_err crypto roken wind
295_DP_hdb=	asn1 com_err krb5 roken sqlite3
296_DP_asn1=	com_err roken
297_DP_kdc=	roken hdb hx509 krb5 heimntlm asn1 crypto
298_DP_wind=	com_err roken
299_DP_heimbase=	pthread
300_DP_heimipcc=	heimbase roken pthread
301_DP_heimipcs=	heimbase roken pthread
302_DP_kafs5=	asn1 krb5 roken
303_DP_krb5+=	asn1 com_err crypt crypto hx509 roken wind heimbase heimipcc
304_DP_gssapi_krb5+=	gssapi krb5 crypto roken asn1 com_err
305_DP_lzma=	pthread
306_DP_ucl=	m
307_DP_vmmapi=	util
308_DP_ctf=	z
309_DP_dtrace=	ctf elf proc pthread rtld_db
310_DP_xo=		util
311# The libc dependencies are not strictly needed but are defined to make the
312# assert happy.
313_DP_c=		compiler_rt
314.if ${MK_SSP} != "no"
315_DP_c+=		ssp_nonshared
316.endif
317_DP_stdthreads=	pthread
318_DP_tacplus=	md
319_DP_panel=	ncurses
320_DP_panelw=	ncursesw
321_DP_rpcsec_gss=	gssapi
322_DP_smb=	kiconv
323_DP_ulog=	md
324_DP_fifolog=	z
325_DP_ipf=	kvm
326_DP_zfs=	md pthread umem util uutil m nvpair avl bsdxml geom nvpair z \
327		zfs_core
328_DP_zfs_core=	nvpair
329_DP_zpool=	md pthread z nvpair avl umem
330_DP_be=		zfs nvpair
331
332# OFED support
333.if ${MK_OFED} != "no"
334_DP_cxgb4=	ibverbs pthread
335_DP_ibcm=	ibverbs
336_DP_ibmad=	ibumad
337_DP_ibnetdisc=	osmcomp ibmad ibumad
338_DP_ibumad=	
339_DP_ibverbs=
340_DP_mlx4=	ibverbs pthread
341_DP_mlx5=	ibverbs pthread
342_DP_rdmacm=	ibverbs
343_DP_osmcomp=	pthread
344_DP_opensm=	pthread
345_DP_osmvendor=	ibumad pthread
346.endif
347
348# Define special cases
349LDADD_supcplusplus=	-lsupc++
350LIBATF_C=	${DESTDIR}${LIBDIR_BASE}/libprivateatf-c.a
351LIBATF_CXX=	${DESTDIR}${LIBDIR_BASE}/libprivateatf-c++.a
352LDADD_atf_c=	-lprivateatf-c
353LDADD_atf_cxx=	-lprivateatf-c++
354
355.for _l in ${_PRIVATELIBS}
356LIB${_l:tu}?=	${DESTDIR}${LIBDIR_BASE}/libprivate${_l}.a
357.endfor
358
359.for _l in ${_LIBRARIES}
360.if ${_INTERNALLIBS:M${_l}}
361LDADD_${_l}_L+=		-L${LIB${_l:tu}DIR}
362.endif
363DPADD_${_l}?=	${LIB${_l:tu}}
364.if ${_PRIVATELIBS:M${_l}}
365LDADD_${_l}?=	-lprivate${_l}
366.else
367LDADD_${_l}?=	${LDADD_${_l}_L} -l${_l}
368.endif
369# Add in all dependencies for static linkage.
370.if defined(_DP_${_l}) && (${_INTERNALLIBS:M${_l}} || \
371    (defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")))
372.for _d in ${_DP_${_l}}
373DPADD_${_l}+=	${DPADD_${_d}}
374LDADD_${_l}+=	${LDADD_${_d}}
375.endfor
376.endif
377.endfor
378
379# These are special cases where the library is broken and anything that uses
380# it needs to add more dependencies.  Broken usually means that it has a
381# cyclic dependency and cannot link its own dependencies.  This is bad, please
382# fix the library instead.
383# Unless the library itself is broken then the proper place to define
384# dependencies is _DP_* above.
385
386# libatf-c++ exposes libatf-c abi hence we need to explicit link to atf_c for
387# atf_cxx
388DPADD_atf_cxx+=	${DPADD_atf_c}
389LDADD_atf_cxx+=	${LDADD_atf_c}
390
391# Detect LDADD/DPADD that should be LIBADD, before modifying LDADD here.
392_BADLDADD=
393.for _l in ${LDADD:M-l*:N-l*/*:C,^-l,,}
394.if ${_LIBRARIES:M${_l}} && !${_PRIVATELIBS:M${_l}}
395_BADLDADD+=	${_l}
396.endif
397.endfor
398.if !empty(_BADLDADD)
399.error ${.CURDIR}: These libraries should be LIBADD+=foo rather than DPADD/LDADD+=-lfoo: ${_BADLDADD}
400.endif
401
402.for _l in ${LIBADD}
403DPADD+=		${DPADD_${_l}}
404LDADD+=		${LDADD_${_l}}
405.endfor
406
407# INTERNALLIB definitions.
408LIBELFTCDIR=	${OBJTOP}/lib/libelftc
409LIBELFTC?=	${LIBELFTCDIR}/libelftc.a
410
411LIBPEDIR=	${OBJTOP}/lib/libpe
412LIBPE?=		${LIBPEDIR}/libpe.a
413
414LIBREADLINEDIR=	${OBJTOP}/gnu/lib/libreadline/readline
415LIBREADLINE?=	${LIBREADLINEDIR}/libreadline.a
416
417LIBOPENBSDDIR=	${OBJTOP}/lib/libopenbsd
418LIBOPENBSD?=	${LIBOPENBSDDIR}/libopenbsd.a
419
420LIBSMDIR=	${OBJTOP}/lib/libsm
421LIBSM?=		${LIBSMDIR}/libsm.a
422
423LIBSMDBDIR=	${OBJTOP}/lib/libsmdb
424LIBSMDB?=	${LIBSMDBDIR}/libsmdb.a
425
426LIBSMUTILDIR=	${OBJTOP}/lib/libsmutil
427LIBSMUTIL?=	${LIBSMUTILDIR}/libsmutil.a
428
429LIBNETBSDDIR?=	${OBJTOP}/lib/libnetbsd
430LIBNETBSD?=	${LIBNETBSDDIR}/libnetbsd.a
431
432LIBVERSDIR?=	${OBJTOP}/kerberos5/lib/libvers
433LIBVERS?=	${LIBVERSDIR}/libvers.a
434
435LIBSLDIR=	${OBJTOP}/kerberos5/lib/libsl
436LIBSL?=		${LIBSLDIR}/libsl.a
437
438LIBIPFDIR=	${OBJTOP}/sbin/ipf/libipf
439LIBIPF?=	${LIBIPFDIR}/libipf.a
440
441LIBTELNETDIR=	${OBJTOP}/lib/libtelnet
442LIBTELNET?=	${LIBTELNETDIR}/libtelnet.a
443
444LIBCRONDIR=	${OBJTOP}/usr.sbin/cron/lib
445LIBCRON?=	${LIBCRONDIR}/libcron.a
446
447LIBNTPDIR=	${OBJTOP}/usr.sbin/ntp/libntp
448LIBNTP?=	${LIBNTPDIR}/libntp.a
449
450LIBNTPEVENTDIR=	${OBJTOP}/usr.sbin/ntp/libntpevent
451LIBNTPEVENT?=	${LIBNTPEVENTDIR}/libntpevent.a
452
453LIBOPTSDIR=	${OBJTOP}/usr.sbin/ntp/libopts
454LIBOPTS?=	${LIBOPTSDIR}/libopts.a
455
456LIBPARSEDIR=	${OBJTOP}/usr.sbin/ntp/libparse
457LIBPARSE?=	${LIBPARSEDIR}/libparse.a
458
459LIBLPRDIR=	${OBJTOP}/usr.sbin/lpr/common_source
460LIBLPR?=	${LIBLPRDIR}/liblpr.a
461
462LIBFIFOLOGDIR=	${OBJTOP}/usr.sbin/fifolog/lib
463LIBFIFOLOG?=	${LIBFIFOLOGDIR}/libfifolog.a
464
465LIBBSNMPTOOLSDIR=	${OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools
466LIBBSNMPTOOLS?=	${LIBBSNMPTOOLSDIR}/libbsnmptools.a
467
468LIBAMUDIR=	${OBJTOP}/usr.sbin/amd/libamu
469LIBAMU?=	${LIBAMUDIR}/libamu.a
470
471LIBBE?=		${LIBBEDIR}/libbe.a
472
473# Define a directory for each library.  This is useful for adding -L in when
474# not using a --sysroot or for meta mode bootstrapping when there is no
475# Makefile.depend.  These are sorted by directory.
476LIBAVLDIR=	${OBJTOP}/cddl/lib/libavl
477LIBCTFDIR=	${OBJTOP}/cddl/lib/libctf
478LIBDTRACEDIR=	${OBJTOP}/cddl/lib/libdtrace
479LIBNVPAIRDIR=	${OBJTOP}/cddl/lib/libnvpair
480LIBUMEMDIR=	${OBJTOP}/cddl/lib/libumem
481LIBUUTILDIR=	${OBJTOP}/cddl/lib/libuutil
482LIBZFSDIR=	${OBJTOP}/cddl/lib/libzfs
483LIBZFS_COREDIR=	${OBJTOP}/cddl/lib/libzfs_core
484LIBZPOOLDIR=	${OBJTOP}/cddl/lib/libzpool
485
486# OFED support
487LIBCXGB4DIR=	${OBJTOP}/lib/ofed/libcxgb4
488LIBIBCMDIR=	${OBJTOP}/lib/ofed/libibcm
489LIBIBMADDIR=	${OBJTOP}/lib/ofed/libibmad
490LIBIBNETDISCDIR=${OBJTOP}/lib/ofed/libibnetdisc
491LIBIBUMADDIR=	${OBJTOP}/lib/ofed/libibumad
492LIBIBVERBSDIR=	${OBJTOP}/lib/ofed/libibverbs
493LIBMLX4DIR=	${OBJTOP}/lib/ofed/libmlx4
494LIBMLX5DIR=	${OBJTOP}/lib/ofed/libmlx5
495LIBRDMACMDIR=	${OBJTOP}/lib/ofed/librdmacm
496LIBOSMCOMPDIR=	${OBJTOP}/lib/ofed/complib
497LIBOPENSMDIR=	${OBJTOP}/lib/ofed/libopensm
498LIBOSMVENDORDIR=${OBJTOP}/lib/ofed/libvendor
499
500LIBDIALOGDIR=	${OBJTOP}/gnu/lib/libdialog
501LIBGCOVDIR=	${OBJTOP}/gnu/lib/libgcov
502LIBGOMPDIR=	${OBJTOP}/gnu/lib/libgomp
503LIBGNUREGEXDIR=	${OBJTOP}/gnu/lib/libregex
504LIBSSPDIR=	${OBJTOP}/lib/libssp
505LIBSSP_NONSHAREDDIR=	${OBJTOP}/lib/libssp_nonshared
506LIBSUPCPLUSPLUSDIR=	${OBJTOP}/gnu/lib/libsupc++
507LIBASN1DIR=	${OBJTOP}/kerberos5/lib/libasn1
508LIBGSSAPI_KRB5DIR=	${OBJTOP}/kerberos5/lib/libgssapi_krb5
509LIBGSSAPI_NTLMDIR=	${OBJTOP}/kerberos5/lib/libgssapi_ntlm
510LIBGSSAPI_SPNEGODIR=	${OBJTOP}/kerberos5/lib/libgssapi_spnego
511LIBHDBDIR=	${OBJTOP}/kerberos5/lib/libhdb
512LIBHEIMBASEDIR=	${OBJTOP}/kerberos5/lib/libheimbase
513LIBHEIMIPCCDIR=	${OBJTOP}/kerberos5/lib/libheimipcc
514LIBHEIMIPCSDIR=	${OBJTOP}/kerberos5/lib/libheimipcs
515LIBHEIMNTLMDIR=	${OBJTOP}/kerberos5/lib/libheimntlm
516LIBHX509DIR=	${OBJTOP}/kerberos5/lib/libhx509
517LIBKADM5CLNTDIR=	${OBJTOP}/kerberos5/lib/libkadm5clnt
518LIBKADM5SRVDIR=	${OBJTOP}/kerberos5/lib/libkadm5srv
519LIBKAFS5DIR=	${OBJTOP}/kerberos5/lib/libkafs5
520LIBKDCDIR=	${OBJTOP}/kerberos5/lib/libkdc
521LIBKRB5DIR=	${OBJTOP}/kerberos5/lib/libkrb5
522LIBROKENDIR=	${OBJTOP}/kerberos5/lib/libroken
523LIBWINDDIR=	${OBJTOP}/kerberos5/lib/libwind
524LIBATF_CDIR=	${OBJTOP}/lib/atf/libatf-c
525LIBATF_CXXDIR=	${OBJTOP}/lib/atf/libatf-c++
526LIBALIASDIR=	${OBJTOP}/lib/libalias/libalias
527LIBBLACKLISTDIR=	${OBJTOP}/lib/libblacklist
528LIBBLOCKSRUNTIMEDIR=	${OBJTOP}/lib/libblocksruntime
529LIBBSNMPDIR=	${OBJTOP}/lib/libbsnmp/libbsnmp
530LIBCASPERDIR=	${OBJTOP}/lib/libcasper/libcasper
531LIBCAP_DNSDIR=	${OBJTOP}/lib/libcasper/services/cap_dns
532LIBCAP_GRPDIR=	${OBJTOP}/lib/libcasper/services/cap_grp
533LIBCAP_PWDDIR=	${OBJTOP}/lib/libcasper/services/cap_pwd
534LIBCAP_RANDOMDIR=	${OBJTOP}/lib/libcasper/services/cap_random
535LIBCAP_SYSCTLDIR=	${OBJTOP}/lib/libcasper/services/cap_sysctl
536LIBBSDXMLDIR=	${OBJTOP}/lib/libexpat
537LIBKVMDIR=	${OBJTOP}/lib/libkvm
538LIBPTHREADDIR=	${OBJTOP}/lib/libthr
539LIBMDIR=	${OBJTOP}/lib/msun
540LIBFORMDIR=	${OBJTOP}/lib/ncurses/form
541LIBFORMLIBWDIR=	${OBJTOP}/lib/ncurses/formw
542LIBMENUDIR=	${OBJTOP}/lib/ncurses/menu
543LIBMENULIBWDIR=	${OBJTOP}/lib/ncurses/menuw
544LIBNCURSESDIR=	${OBJTOP}/lib/ncurses/ncurses
545LIBNCURSESWDIR=	${OBJTOP}/lib/ncurses/ncursesw
546LIBPANELDIR=	${OBJTOP}/lib/ncurses/panel
547LIBPANELWDIR=	${OBJTOP}/lib/ncurses/panelw
548LIBCRYPTODIR=	${OBJTOP}/secure/lib/libcrypto
549LIBSSHDIR=	${OBJTOP}/secure/lib/libssh
550LIBSSLDIR=	${OBJTOP}/secure/lib/libssl
551LIBTEKENDIR=	${OBJTOP}/sys/teken/libteken
552LIBEGACYDIR=	${OBJTOP}/tools/build
553LIBLNDIR=	${OBJTOP}/usr.bin/lex/lib
554
555LIBTERMCAPDIR=	${LIBNCURSESDIR}
556LIBTERMCAPWDIR=	${LIBNCURSESWDIR}
557
558# Default other library directories to lib/libNAME.
559.for lib in ${_LIBRARIES}
560LIB${lib:tu}DIR?=	${OBJTOP}/lib/lib${lib}
561.endfor
562
563# Validate that listed LIBADD are valid.
564.for _l in ${LIBADD}
565.if empty(_LIBRARIES:M${_l})
566_BADLIBADD+= ${_l}
567.endif
568.endfor
569.if !empty(_BADLIBADD)
570.error ${.CURDIR}: Invalid LIBADD used which may need to be added to ${_this:T}: ${_BADLIBADD}
571.endif
572
573# Sanity check that libraries are defined here properly when building them.
574.if defined(LIB) && ${_LIBRARIES:M${LIB}} != ""
575.if !empty(LIBADD) && \
576    (!defined(_DP_${LIB}) || ${LIBADD:O:u} != ${_DP_${LIB}:O:u})
577.error ${.CURDIR}: Missing or incorrect _DP_${LIB} entry in ${_this:T}.  Should match LIBADD for ${LIB} ('${LIBADD}' vs '${_DP_${LIB}}')
578.endif
579# Note that OBJTOP is not yet defined here but for the purpose of the check
580# it is fine as it resolves to the SRC directory.
581.if !defined(LIB${LIB:tu}DIR) || !exists(${SRCTOP}/${LIB${LIB:tu}DIR:S,^${OBJTOP}/,,})
582.error ${.CURDIR}: Missing or incorrect value for LIB${LIB:tu}DIR in ${_this:T}: ${LIB${LIB:tu}DIR:S,^${OBJTOP}/,,}
583.endif
584.if ${_INTERNALLIBS:M${LIB}} != "" && !defined(LIB${LIB:tu})
585.error ${.CURDIR}: Missing value for LIB${LIB:tu} in ${_this:T}.  Likely should be: LIB${LIB:tu}?= $${LIB${LIB:tu}DIR}/lib${LIB}.a
586.endif
587.endif
588
589.endif	# !target(__<src.libnames.mk>__)
590