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