xref: /illumos-gate/usr/src/lib/Makefile (revision fd71220ba0fafcc9cf5ea0785db206f3f31336e7)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright (c) 2012 by Delphix. All rights reserved.
25# Copyright 2020 Joyent, Inc.
26# Copyright (c) 2013 Gary Mills
27# Copyright (c) 2015 Gary Mills
28# Copyright 2022 Garrett D'Amore
29# Copyright 2016 Toomas Soome <tsoome@me.com>
30# Copyright 2018 Nexenta Systems, Inc.
31# Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
32# Copyright 2017 RackTop Systems.
33# Copyright 2018 Jason King
34# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
35#
36
37include ../Makefile.master
38
39#	Note that libcurses installs commands along with its library.
40#	This is a minor bug which probably should be fixed.
41#	Note also that a few extra libraries are kept in cmd source.
42#
43# Certain libraries are linked with, hence depend on, other libraries.
44# Library dependencies are called out explicitly, see "Library
45# interdependencies" below.
46.PARALLEL:
47
48# Build libc and its dependencies
49SUBDIRS=			\
50	ssp_ns			\
51	crt			\
52	../cmd/sgs/libconv	\
53	../cmd/sgs/libdl	\
54	libc			\
55	.WAIT
56
57# Build libraries with lots of dependents
58SUBDIRS +=		\
59	libm		\
60	libmd		\
61	libmp		\
62	libnsl		\
63	libnvpair	\
64	libsocket	\
65	.WAIT
66
67# Build everything else. Aside from explicit dependencies, all libraries
68# are built in parallel.
69SUBDIRS +=				\
70	../cmd/sendmail/libmilter	\
71	../cmd/sgs/libelf	\
72	../cmd/sgs/librtld_db	\
73	abi		\
74	auditd_plugins	\
75	brand		\
76	c_synonyms	\
77	cfgadm_plugins	\
78	crypt_modules	\
79	extendedFILE	\
80	fm		\
81	getloginx	\
82	gss_mechs/mech_dh	\
83	gss_mechs/mech_dummy	\
84	gss_mechs/mech_krb5	\
85	gss_mechs/mech_spnego	\
86	hal		\
87	hbaapi		\
88	iconv_modules	\
89	krb5		\
90	libadm		\
91	libads		\
92	libadt_jni	\
93	libadutils	\
94	libaio		\
95	libavl		\
96	libbe		\
97	libbrand	\
98	libbsdmalloc	\
99	libbsm		\
100	libc_db		\
101	libcfgadm	\
102	libcmdutils	\
103	libcommputil	\
104	libcontract	\
105	libcpc		\
106	libcrypt	\
107	libcryptoutil	\
108	libctf		\
109	libcurses	\
110	libcustr	\
111	libdemangle	\
112	libdevice	\
113	libdevid	\
114	libdevinfo	\
115	libdhcpagent	\
116	libdhcputil	\
117	libdisasm	\
118	libdiskmgt	\
119	libdladm	\
120	libdlpi		\
121	libdns_sd	\
122	libdoor		\
123	libdtrace	\
124	libdtrace_jni	\
125	libdwarf	\
126	libefi		\
127	libelfsign	\
128	libeti		\
129	libexacct	\
130	libexacct/demo	\
131	libfakekernel	\
132	libfcoe		\
133	libficl		\
134	libfru		\
135	libfruutils	\
136	libfsmgt	\
137	libfstyp	\
138	libgen		\
139	libgrubmgmt	\
140	libgss		\
141	libhotplug	\
142	libidmap	\
143	libidspace	\
144	libilb		\
145	libima		\
146	libinetsvc	\
147	libinetutil	\
148	libinstzones	\
149	libintl		\
150	libipadm	\
151	libipd		\
152	libipmi		\
153	libipmp		\
154	libipp		\
155	libipsecutil	\
156	libiscsit	\
157	libjedec	\
158	libkmf		\
159	libkrb5		\
160	libkstat	\
161	libktest	\
162	libkvm		\
163	libldap5	\
164	liblgrp		\
165	liblm		\
166	libm1		\
167	libmail		\
168	libmalloc	\
169	libmapid	\
170	libmapmalloc	\
171	libmd5		\
172	libmlrpc	\
173	libmtmalloc	\
174	libmvec		\
175	libndmp		\
176	libnisdb	\
177	libnls		\
178	libnvme		\
179	libnwam		\
180	libofmt		\
181	libpam		\
182	libpcidb	\
183	libpcsc		\
184	libpctx		\
185	libpicl		\
186	libpicltree	\
187	libpkg		\
188	libpool		\
189	libproc		\
190	libproject	\
191	libpthread	\
192	libraidcfg	\
193	librcm		\
194	librename	\
195	libreparse	\
196	libresolv	\
197	libresolv2	\
198	librestart	\
199	librpcsvc	\
200	librsm		\
201	librstp		\
202	librt		\
203	libsasl		\
204	libscf		\
205	libsched	\
206	libsctp		\
207	libsec		\
208	libsecdb	\
209	libsendfile	\
210	libsff		\
211	libshare	\
212	libsip		\
213	libsldap	\
214	libslp		\
215	libsmbfs	\
216	libsmbios	\
217	libsmedia	\
218	libsqlite	\
219	libsrpt		\
220	libstmf		\
221	libstmfproxy	\
222	libsun_ima	\
223	libsysevent	\
224	libtecla	\
225	libtermcap	\
226	libthread	\
227	libtsnet	\
228	libtsol		\
229	libumem		\
230	libutempter	\
231	libuuid		\
232	libuutil	\
233	libvolmgt	\
234	libvrrpadm	\
235	libvscan	\
236	libw		\
237	libwrap		\
238	libxcurses	\
239	libxcurses2	\
240	libxnet		\
241	libxpio		\
242	libzfs		\
243	libzfsbootenv	\
244	libzfs_core	\
245	libzfs_jni	\
246	libzonecfg	\
247	libzoneinfo	\
248	libzonestat	\
249	libzpool	\
250	libzutil	\
251	madv		\
252	mpapi		\
253	mpss		\
254	nametoaddr	\
255	nsswitch	\
256	pam_modules	\
257	passwdutil	\
258	pkcs11		\
259	policykit	\
260	print		\
261	pylibbe		\
262	pysolaris	\
263	pyzfs		\
264	raidcfg_plugins	\
265	rpcsec_gss	\
266	sasl_plugins	\
267	scsi		\
268	smbclnt		\
269	smbsrv		\
270	smhba		\
271	sun_fc		\
272	sun_sas		\
273	udapl		\
274	varpd		\
275	watchmalloc	\
276	$($(MACH)_SUBDIRS)
277
278i386_SUBDIRS=		\
279	lib9p		\
280	libfdisk	\
281	libppt		\
282	libsaveargs	\
283	libvmm		\
284	libvmmapi
285
286sparc_SUBDIRS=		\
287	libds		\
288	libdscp		\
289	libprtdiag	\
290	libprtdiag_psr	\
291	libpri		\
292	librsc		\
293	storage		\
294	libpcp		\
295	libtsalarm	\
296	libv12n
297
298#
299# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
300# clean and clobber targets (for more information, see those targets, below).
301#
302NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
303
304DCSUBDIRS=
305
306MSGSUBDIRS=		\
307	abi		\
308	auditd_plugins	\
309	brand		\
310	cfgadm_plugins	\
311	gss_mechs/mech_dh	\
312	gss_mechs/mech_krb5	\
313	krb5		\
314	libbsm		\
315	libc		\
316	libcfgadm	\
317	libcontract	\
318	libcurses	\
319	libdhcputil	\
320	libdiskmgt	\
321	libdladm	\
322	libgrubmgmt	\
323	libgss		\
324	libidmap	\
325	libilb		\
326	libinstzones	\
327	libipadm	\
328	libipmp		\
329	libipsecutil	\
330	libldap5	\
331	libnsl		\
332	libnwam		\
333	libofmt		\
334	libpam		\
335	libpicl		\
336	libpkg		\
337	libpool		\
338	libreparse	\
339	libsasl		\
340	libscf		\
341	libsecdb	\
342	libshare	\
343	libsldap	\
344	libslp		\
345	libsmbfs	\
346	libsmedia	\
347	libtsol		\
348	libuutil	\
349	libvrrpadm	\
350	libvscan	\
351	libzfs		\
352	libzonecfg	\
353	madv		\
354	mpss		\
355	pam_modules	\
356	pyzfs		\
357	rpcsec_gss	\
358	$($(MACH)_MSGSUBDIRS)
359
360sparc_MSGSUBDIRS=	\
361	libprtdiag	\
362	libprtdiag_psr
363
364i386_MSGSUBDIRS= libfdisk
365
366HDRSUBDIRS=				\
367	../cmd/sendmail/libmilter	\
368	auditd_plugins	\
369	fm		\
370	hal		\
371	hbaapi		\
372	libads		\
373	libbrand	\
374	libbsm		\
375	libc		\
376	libcmdutils	\
377	libcommputil	\
378	libcontract	\
379	libcpc		\
380	libcryptoutil	\
381	libctf		\
382	libcurses	\
383	libcustr	\
384	libdemangle	\
385	libdevice	\
386	libdevid	\
387	libdevinfo	\
388	libdhcpagent	\
389	libdhcputil	\
390	libdisasm	\
391	libdiskmgt	\
392	libdladm	\
393	libdlpi		\
394	libdns_sd	\
395	libdtrace	\
396	libdtrace_jni	\
397	libelfsign	\
398	libeti		\
399	libfakekernel	\
400	libfcoe		\
401	libfru		\
402	libfstyp	\
403	libgen		\
404	libgrubmgmt	\
405	libidmap	\
406	libidspace	\
407	libilb		\
408	libima		\
409	libinetsvc	\
410	libinetutil	\
411	libinstzones	\
412	libipadm	\
413	libipd		\
414	libipmi		\
415	libipmp		\
416	libipp		\
417	libipsecutil	\
418	libiscsit	\
419	libkrb5		\
420	libkstat	\
421	libktest	\
422	libkvm		\
423	libmail		\
424	libmapid	\
425	libmd		\
426	libmlrpc	\
427	libmtmalloc	\
428	libndmp		\
429	libnsl		\
430	libnvme		\
431	libnvpair	\
432	libnwam		\
433	libofmt		\
434	libpam		\
435	libpcidb	\
436	libpcsc		\
437	libpctx		\
438	libpicl		\
439	libpicltree	\
440	libpool		\
441	libproc		\
442	libraidcfg	\
443	librcm		\
444	librename	\
445	libreparse	\
446	librestart	\
447	librpcsvc	\
448	librsm		\
449	librstp		\
450	libsasl		\
451	libscf		\
452	libsec		\
453	libsff		\
454	libshare	\
455	libsip		\
456	libslp		\
457	libsmbfs	\
458	libsmbios	\
459	libsmedia	\
460	libsocket	\
461	libsqlite	\
462	libsrpt		\
463	libstmf		\
464	libstmfproxy	\
465	libsun_ima	\
466	libsysevent	\
467	libtecla	\
468	libtermcap	\
469	libtsnet	\
470	libtsol		\
471	libumem		\
472	libutempter	\
473	libuutil	\
474	libvolmgt	\
475	libvrrpadm	\
476	libvscan	\
477	libwrap		\
478	libxcurses2	\
479	libxpio		\
480	libzfs		\
481	libzfs_core	\
482	libzfs_jni	\
483	libzoneinfo	\
484	libzonestat	\
485	mpapi		\
486	passwdutil	\
487	pkcs11		\
488	policykit	\
489	scsi		\
490	smbsrv		\
491	smhba		\
492	udapl		\
493	varpd		\
494	$($(MACH)_HDRSUBDIRS)
495
496i386_HDRSUBDIRS=	\
497	lib9p		\
498	libfdisk	\
499	libppt		\
500	libsaveargs	\
501	libvmm		\
502	libvmmapi
503
504sparc_HDRSUBDIRS=	\
505	libds		\
506	libdscp		\
507	libpri		\
508	libv12n		\
509	storage
510
511all :=		TARGET= all
512check :=	TARGET= check
513clean :=	TARGET= clean
514clobber :=	TARGET= clobber
515install :=	TARGET= install
516install_h :=	TARGET= install_h
517_dc :=		TARGET= _dc
518_msg :=		TARGET= _msg
519
520.KEEP_STATE:
521
522#
523# For the all and install targets, we clearly must respect library
524# dependencies so that the libraries link correctly.  However, for
525# the remaining targets (check, clean, clobber, install_h, _dc
526# and _msg), libraries do not have any dependencies on one another
527# and thus respecting dependencies just slows down the build.
528# As such, for these rules, we use pattern replacement to explicitly
529# avoid triggering the dependency information.  Note that for clean and
530# clobber, we must use $(NOWAIT_SUBDIRS) rather than
531# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
532#
533
534all:			$(SUBDIRS)
535
536install:		$(SUBDIRS) .WAIT install_extra
537
538# extra libraries kept in other source areas
539install_extra:
540	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
541	@pwd
542
543clean clobber:		$(NOWAIT_SUBDIRS:%=%-nodepend)
544
545
546install_h check:	$(HDRSUBDIRS:%=%-nodepend)
547
548_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
549
550_dc:			$(DCSUBDIRS:%=%-nodepend)
551
552# Library interdependencies are called out explicitly here.
553../cmd/sgs/libconv: crt
554../cmd/sgs/libdl: crt
555libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
556
557libm:		libc
558libmd:		libc
559libmp:		libc
560libnsl:		libc libmd libmp
561libnvpair:	libc libnsl
562libsocket:	libc libnsl
563
564basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
565basedeps :=	TARGET=install
566
567# The following dependencies are currently required by libdbus-1 and should
568# be used for anything linking against it.
569dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios \
570		libbsm
571
572# The following dependencies don't need to be listed below as they are built
573# before everything else:
574# libc libm libmd libmp libnsl libnvpair libsocket
575../cmd/sendmail/libmilter:	libsocket libnsl
576abi:		libctf libmapmalloc libproc
577auditd_plugins: libbsm libsecdb libgss libmtmalloc
578brand:		libzonecfg libmapmalloc
579cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
580fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
581		libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
582		libpcidb libdiskmgt libjedec libnvme
583$(SPARC_BLD)fm:	libpri
584gss_mechs/mech_dh: libgss
585gss_mechs/mech_dummy: libgss
586gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
587gss_mechs/mech_spnego: gss_mechs/mech_krb5
588hal:		dbusdeps
589krb5:		gss_mechs/mech_krb5 libtecla libldap5
590lib9p:		libsec libcustr
591libads:		libnsl
592libadt_jni:	libbsm
593libadutils:	libldap5 libresolv2
594libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl \
595		libzfsbootenv
596libbsm:		libinetutil libscf libsecdb libtsol
597libcfgadm:	libdevinfo
598libcontract:	libnvpair
599libcmdutils:	libavl libnvpair
600libcpc:		libpctx
601libcrypt:	libgen
602libctf:		libavl libdwarf
603libdemangle:	libcustr
604libdevice:	libnvpair
605libdevid:	libdevinfo
606libdevinfo:	libsec libgen
607libdhcpagent:	libdhcputil libuuid libdlpi libcontract
608libdhcputil:	libgen libinetutil libdlpi
609libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
610$(INTEL_BLD)libdiskmgt: libfdisk
611libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
612		libpool varpd
613libdlpi:	libinetutil libdladm
614libds:		libsysevent
615libdtrace:	libproc libgen libctf libmapmalloc
616libdtrace_jni:	libuutil libdtrace
617libdwarf:	../cmd/sgs/libelf
618libefi:		libuuid libsmbios
619libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
620libeti:		libcurses
621libexacct/demo:	libexacct libproject
622libfakekernel:	libumem libcryptoutil
623libfcoe:	libdladm
624libficl:	libuuid libumem
625libfru:		libfruutils
626libfsmgt:	libkstat
627libgrubmgmt:	libdevinfo libzfs libfstyp libefi
628$(INTEL_BLD)libgrubmgmt: libfdisk
629libidmap:	libavl libuutil
630libidspace:	libumem
631libinetsvc:	libscf
632libinetutil:	libsocket
633libinstzones:	libzonecfg libcontract
634libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil \
635		libcmdutils libipmp
636libipmi:	libm libnvpair libsocket libnsl
637libipmp:	libinetutil
638libipsecutil:	libtecla libtsol libkmf
639libiscsit:	libstmf libuuid
640libhotplug:	libnvpair
641libkmf:		libcryptoutil pkcs11 libcustr
642libktest:	libnvpair
643libkvm:		../cmd/sgs/libelf
644libldap5:	libsasl
645libmapid:	libresolv2 libscf
646libmlrpc:	libsmbfs libuuid
647libndmp:	libscf
648libnisdb:	libldap5
649libnvme:	libdevinfo libnvpair
650libnwam:	libscf libbsm libdladm libipadm
651libpcp:		libumem libdevinfo
652libpctx:	libproc
653libpkg:		libscf libadm
654libpool:	libscf libexacct
655libppt:		libpcidb libdevinfo libcmdutils
656libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
657$(INTEL_BLD)libproc: libsaveargs
658libproject:	libpool libproc libsecdb
659libprtdiag:	libkstat libdevinfo
660libprtdiag_psr:	libprtdiag
661libraidcfg:	libdevinfo
662librcm:		libnvpair
663librestart:	libuutil libscf libpool libproject libsecdb libsysevent
664libsasl:	libgss pkcs11
665libsaveargs:	libdisasm
666libscf:		libuutil libgen libnsl libnvpair libsmbios
667libsec:		libavl libidmap
668libsecdb:	libnsl
669libsff:		libnvpair
670libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
671libsip:		libmd5
672libsldap:	libldap5 libscf
673libsmbfs:	libkrb5 libsec libidmap pkcs11
674libsmbios:	libdevinfo
675libsrpt:	libstmf
676libstmf:	libscf
677libstmfproxy:	libstmf libpthread
678libsun_ima:	libdevinfo libsysevent
679libsysevent:	libsecdb
680libtecla:	libcurses
681libtermcap:	libcurses
682libtsalarm:	libpcp
683libtsnet:	libtsol libsecdb
684libtsol:	libsecdb
685libuuid:	libdlpi
686libv12n:	libds libuuid
687libvmm:		libvmmapi
688libvolmgt:	libadm
689libvrrpadm:	libdladm libscf
690libvscan:	libscf libsecdb
691libxpio:	libdevinfo libnvpair
692libzfs:		libdevid libgen libuutil libavl libefi libidmap \
693		libumem libtsol libzfs_core libcryptoutil pkcs11 libmd libzutil
694libzfsbootenv:	libzfs libnvpair
695libzfs_core:	libnvpair
696libzfs_jni:	libdiskmgt libzfs libzutil
697libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
698		libuutil libbsm libsecdb
699libzonestat:	libcmdutils libumem
700libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzutil
701libzutil:	libadm libavl libdevid libefi
702madv:		libgen
703mpapi:		libpthread libdevinfo libsysevent
704mpss:		libgen
705nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
706pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
707passwdutil:	libsldap
708pkcs11:		libcryptoutil libgen libuuid
709policykit:	dbusdeps
710print:		libldap5 libmd5 libsendfile
711pylibbe:	libbe libzfs
712pysolaris:	libsec libidmap
713pyzfs:		libzfs
714raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
715rpcsec_gss:	libgss
716sasl_plugins:	pkcs11 libgss libsasl
717scsi:		libfru libumem libdevid libdevinfo
718smbclnt:	libfakekernel pkcs11
719smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
720		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
721		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
722storage:	libdevice libdevinfo libdevid
723sun_fc:		libdevinfo libsysevent
724sun_sas:	libdevinfo libsysevent libkstat libdevid
725udapl:		libdevinfo libdladm
726varpd:		libavl libidspace libumem libnsl libnvpair libmd5 librename \
727		libcustr
728
729#
730# The reason this rule checks for the existence of the
731# Makefile is that some of the directories do not exist
732# in certain situations (e.g., exportable source builds,
733# OpenSolaris).
734#
735$(SUBDIRS): FRC
736	cd $@; pwd; $(MAKE) $(TARGET)
737
738$(SUBDIRS:%=%-nodepend):
739	cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET)
740
741FRC:
742