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