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