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