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