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