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