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