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