xref: /illumos-gate/usr/src/lib/Makefile (revision 32002227574cf0a435dc03de622191ca53724f0a)
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	libi2c		\
143	libidmap	\
144	libidspace	\
145	libilb		\
146	libima		\
147	libinetsvc	\
148	libinetutil	\
149	libinstzones	\
150	libintl		\
151	libipadm	\
152	libipd		\
153	libipmi		\
154	libipmp		\
155	libipp		\
156	libipsecutil	\
157	libiscsit	\
158	libjedec	\
159	libkmf		\
160	libkrb5		\
161	libkstat	\
162	libktest	\
163	libkvm		\
164	libldap5	\
165	liblgrp		\
166	liblm		\
167	libm1		\
168	libmail		\
169	libmalloc	\
170	libmapid	\
171	libmapmalloc	\
172	libmd5		\
173	libmlrpc	\
174	libmtmalloc	\
175	libmvec		\
176	libndmp		\
177	libnisdb	\
178	libnls		\
179	libnvme		\
180	libnwam		\
181	libofmt		\
182	libpam		\
183	libpcidb	\
184	libpcsc		\
185	libpctx		\
186	libpicl		\
187	libpicltree	\
188	libpkg		\
189	libpool		\
190	libproc		\
191	libproject	\
192	libpthread	\
193	libraidcfg	\
194	librcm		\
195	librename	\
196	libreparse	\
197	libresolv	\
198	libresolv2	\
199	librestart	\
200	librpcsvc	\
201	librsm		\
202	librstp		\
203	librt		\
204	libsasl		\
205	libscf		\
206	libsched	\
207	libsctp		\
208	libsec		\
209	libsecdb	\
210	libsendfile	\
211	libsff		\
212	libshare	\
213	libsip		\
214	libsldap	\
215	libslp		\
216	libsmbfs	\
217	libsmbios	\
218	libsmedia	\
219	libsqlite	\
220	libsrpt		\
221	libstmf		\
222	libstmfproxy	\
223	libsun_ima	\
224	libsysevent	\
225	libtecla	\
226	libtermcap	\
227	libthread	\
228	libtsnet	\
229	libtsol		\
230	libumem		\
231	libutempter	\
232	libuuid		\
233	libuutil	\
234	libvolmgt	\
235	libvrrpadm	\
236	libvscan	\
237	libw		\
238	libwrap		\
239	libxcurses	\
240	libxcurses2	\
241	libxnet		\
242	libxpio		\
243	libzfs		\
244	libzfsbootenv	\
245	libzfs_core	\
246	libzfs_jni	\
247	libzonecfg	\
248	libzoneinfo	\
249	libzonestat	\
250	libzpool	\
251	libzutil	\
252	madv		\
253	mpapi		\
254	mpss		\
255	nametoaddr	\
256	nsswitch	\
257	pam_modules	\
258	passwdutil	\
259	pkcs11		\
260	policykit	\
261	print		\
262	pylibbe		\
263	pysolaris	\
264	pyzfs		\
265	raidcfg_plugins	\
266	rpcsec_gss	\
267	sasl_plugins	\
268	scsi		\
269	smbclnt		\
270	smbsrv		\
271	smhba		\
272	sun_fc		\
273	sun_sas		\
274	udapl		\
275	varpd		\
276	watchmalloc	\
277	$($(MACH)_SUBDIRS)
278
279i386_SUBDIRS=		\
280	lib9p		\
281	libfdisk	\
282	libppt		\
283	libsaveargs	\
284	libvmm		\
285	libvmmapi
286
287sparc_SUBDIRS=		\
288	libds		\
289	libdscp		\
290	libprtdiag	\
291	libprtdiag_psr	\
292	libpri		\
293	librsc		\
294	storage		\
295	libpcp		\
296	libtsalarm	\
297	libv12n
298
299#
300# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
301# clean and clobber targets (for more information, see those targets, below).
302#
303NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
304
305DCSUBDIRS=
306
307MSGSUBDIRS=		\
308	abi		\
309	auditd_plugins	\
310	brand		\
311	cfgadm_plugins	\
312	gss_mechs/mech_dh	\
313	gss_mechs/mech_krb5	\
314	krb5		\
315	libbsm		\
316	libc		\
317	libcfgadm	\
318	libcontract	\
319	libcurses	\
320	libdhcputil	\
321	libdiskmgt	\
322	libdladm	\
323	libgrubmgmt	\
324	libgss		\
325	libidmap	\
326	libilb		\
327	libinstzones	\
328	libipadm	\
329	libipmp		\
330	libipsecutil	\
331	libldap5	\
332	libnsl		\
333	libnwam		\
334	libofmt		\
335	libpam		\
336	libpicl		\
337	libpkg		\
338	libpool		\
339	libreparse	\
340	libsasl		\
341	libscf		\
342	libsecdb	\
343	libshare	\
344	libsldap	\
345	libslp		\
346	libsmbfs	\
347	libsmedia	\
348	libtsol		\
349	libuutil	\
350	libvrrpadm	\
351	libvscan	\
352	libzfs		\
353	libzonecfg	\
354	madv		\
355	mpss		\
356	pam_modules	\
357	pyzfs		\
358	rpcsec_gss	\
359	$($(MACH)_MSGSUBDIRS)
360
361sparc_MSGSUBDIRS=	\
362	libprtdiag	\
363	libprtdiag_psr
364
365i386_MSGSUBDIRS= libfdisk
366
367HDRSUBDIRS=				\
368	../cmd/sendmail/libmilter	\
369	auditd_plugins	\
370	fm		\
371	hal		\
372	hbaapi		\
373	libads		\
374	libbrand	\
375	libbsm		\
376	libc		\
377	libcmdutils	\
378	libcommputil	\
379	libcontract	\
380	libcpc		\
381	libcryptoutil	\
382	libctf		\
383	libcurses	\
384	libcustr	\
385	libdemangle	\
386	libdevice	\
387	libdevid	\
388	libdevinfo	\
389	libdhcpagent	\
390	libdhcputil	\
391	libdisasm	\
392	libdiskmgt	\
393	libdladm	\
394	libdlpi		\
395	libdns_sd	\
396	libdtrace	\
397	libdtrace_jni	\
398	libelfsign	\
399	libeti		\
400	libfakekernel	\
401	libfcoe		\
402	libfru		\
403	libfstyp	\
404	libgen		\
405	libgrubmgmt	\
406	libi2c		\
407	libidmap	\
408	libidspace	\
409	libilb		\
410	libima		\
411	libinetsvc	\
412	libinetutil	\
413	libinstzones	\
414	libipadm	\
415	libipd		\
416	libipmi		\
417	libipmp		\
418	libipp		\
419	libipsecutil	\
420	libiscsit	\
421	libkrb5		\
422	libkstat	\
423	libktest	\
424	libkvm		\
425	libmail		\
426	libmapid	\
427	libmd		\
428	libmlrpc	\
429	libmtmalloc	\
430	libndmp		\
431	libnsl		\
432	libnvme		\
433	libnvpair	\
434	libnwam		\
435	libofmt		\
436	libpam		\
437	libpcidb	\
438	libpcsc		\
439	libpctx		\
440	libpicl		\
441	libpicltree	\
442	libpool		\
443	libproc		\
444	libraidcfg	\
445	librcm		\
446	librename	\
447	libreparse	\
448	librestart	\
449	librpcsvc	\
450	librsm		\
451	librstp		\
452	libsasl		\
453	libscf		\
454	libsec		\
455	libsff		\
456	libshare	\
457	libsip		\
458	libslp		\
459	libsmbfs	\
460	libsmbios	\
461	libsmedia	\
462	libsocket	\
463	libsqlite	\
464	libsrpt		\
465	libstmf		\
466	libstmfproxy	\
467	libsun_ima	\
468	libsysevent	\
469	libtecla	\
470	libtermcap	\
471	libtsnet	\
472	libtsol		\
473	libumem		\
474	libutempter	\
475	libuutil	\
476	libvolmgt	\
477	libvrrpadm	\
478	libvscan	\
479	libwrap		\
480	libxcurses2	\
481	libxpio		\
482	libzfs		\
483	libzfs_core	\
484	libzfs_jni	\
485	libzoneinfo	\
486	libzonestat	\
487	mpapi		\
488	passwdutil	\
489	pkcs11		\
490	policykit	\
491	scsi		\
492	smbsrv		\
493	smhba		\
494	udapl		\
495	varpd		\
496	$($(MACH)_HDRSUBDIRS)
497
498i386_HDRSUBDIRS=	\
499	lib9p		\
500	libfdisk	\
501	libppt		\
502	libsaveargs	\
503	libvmm		\
504	libvmmapi
505
506sparc_HDRSUBDIRS=	\
507	libds		\
508	libdscp		\
509	libpri		\
510	libv12n		\
511	storage
512
513all :=		TARGET= all
514check :=	TARGET= check
515clean :=	TARGET= clean
516clobber :=	TARGET= clobber
517install :=	TARGET= install
518install_h :=	TARGET= install_h
519_dc :=		TARGET= _dc
520_msg :=		TARGET= _msg
521
522.KEEP_STATE:
523
524#
525# For the all and install targets, we clearly must respect library
526# dependencies so that the libraries link correctly.  However, for
527# the remaining targets (check, clean, clobber, install_h, _dc
528# and _msg), libraries do not have any dependencies on one another
529# and thus respecting dependencies just slows down the build.
530# As such, for these rules, we use pattern replacement to explicitly
531# avoid triggering the dependency information.  Note that for clean and
532# clobber, we must use $(NOWAIT_SUBDIRS) rather than
533# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
534#
535
536all:			$(SUBDIRS)
537
538install:		$(SUBDIRS) .WAIT install_extra
539
540# extra libraries kept in other source areas
541install_extra:
542	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
543	@pwd
544
545clean clobber:		$(NOWAIT_SUBDIRS:%=%-nodepend)
546
547
548install_h check:	$(HDRSUBDIRS:%=%-nodepend)
549
550_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
551
552_dc:			$(DCSUBDIRS:%=%-nodepend)
553
554# Library interdependencies are called out explicitly here.
555../cmd/sgs/libconv: crt
556../cmd/sgs/libdl: crt
557libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
558
559libm:		libc
560libmd:		libc
561libmp:		libc
562libnsl:		libc libmd libmp
563libnvpair:	libc libnsl
564libsocket:	libc libnsl
565
566basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
567basedeps :=	TARGET=install
568
569# The following dependencies are currently required by libdbus-1 and should
570# be used for anything linking against it.
571dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios \
572		libbsm
573
574# The following dependencies don't need to be listed below as they are built
575# before everything else:
576# libc libm libmd libmp libnsl libnvpair libsocket
577../cmd/sendmail/libmilter:	libsocket libnsl
578abi:		libctf libmapmalloc libproc
579auditd_plugins: libbsm libsecdb libgss libmtmalloc
580brand:		libzonecfg libmapmalloc
581cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
582fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
583		libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
584		libpcidb libdiskmgt libjedec libnvme
585$(SPARC_BLD)fm:	libpri
586gss_mechs/mech_dh: libgss
587gss_mechs/mech_dummy: libgss
588gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
589gss_mechs/mech_spnego: gss_mechs/mech_krb5
590hal:		dbusdeps
591krb5:		gss_mechs/mech_krb5 libtecla libldap5
592lib9p:		libsec libcustr
593libads:		libnsl
594libadt_jni:	libbsm
595libadutils:	libldap5 libresolv2
596libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl \
597		libzfsbootenv
598libbsm:		libinetutil libscf libsecdb libtsol
599libcfgadm:	libdevinfo
600libcontract:	libnvpair
601libcmdutils:	libavl libnvpair
602libcpc:		libpctx
603libcrypt:	libgen
604libctf:		libavl libdwarf
605libdemangle:	libcustr
606libdevice:	libnvpair
607libdevid:	libdevinfo
608libdevinfo:	libsec libgen
609libdhcpagent:	libdhcputil libuuid libdlpi libcontract
610libdhcputil:	libgen libinetutil libdlpi
611libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
612$(INTEL_BLD)libdiskmgt: libfdisk
613libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
614		libpool varpd
615libdlpi:	libinetutil libdladm
616libds:		libsysevent
617libdtrace:	libproc libgen libctf libmapmalloc
618libdtrace_jni:	libuutil libdtrace
619libdwarf:	../cmd/sgs/libelf
620libefi:		libuuid libsmbios
621libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
622libeti:		libcurses
623libexacct/demo:	libexacct libproject
624libfakekernel:	libumem libcryptoutil
625libfcoe:	libdladm
626libficl:	libuuid libumem
627libfru:		libfruutils
628libfsmgt:	libkstat
629libgrubmgmt:	libdevinfo libzfs libfstyp libefi
630$(INTEL_BLD)libgrubmgmt: libfdisk
631libi2c:		libdevinfo
632libidmap:	libavl libuutil
633libidspace:	libumem
634libinetsvc:	libscf
635libinetutil:	libsocket
636libinstzones:	libzonecfg libcontract
637libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil \
638		libcmdutils libipmp
639libipmi:	libm libnvpair libsocket libnsl
640libipmp:	libinetutil
641libipsecutil:	libtecla libtsol libkmf
642libiscsit:	libstmf libuuid
643libhotplug:	libnvpair
644libkmf:		libcryptoutil pkcs11 libcustr
645libktest:	libnvpair
646libkvm:		../cmd/sgs/libelf
647libldap5:	libsasl
648libmapid:	libresolv2 libscf
649libmlrpc:	libsmbfs libuuid
650libndmp:	libscf
651libnisdb:	libldap5
652libnvme:	libdevinfo libnvpair
653libnwam:	libscf libbsm libdladm libipadm
654libpcp:		libumem libdevinfo
655libpctx:	libproc
656libpkg:		libscf libadm
657libpool:	libscf libexacct
658libppt:		libpcidb libdevinfo libcmdutils
659libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
660$(INTEL_BLD)libproc: libsaveargs
661libproject:	libpool libproc libsecdb
662libprtdiag:	libkstat libdevinfo
663libprtdiag_psr:	libprtdiag
664libraidcfg:	libdevinfo
665librcm:		libnvpair
666librestart:	libuutil libscf libpool libproject libsecdb libsysevent
667libsasl:	libgss pkcs11
668libsaveargs:	libdisasm
669libscf:		libuutil libgen libnsl libnvpair libsmbios
670libsec:		libavl libidmap
671libsecdb:	libnsl
672libsff:		libnvpair
673libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
674libsip:		libmd5
675libsldap:	libldap5 libscf
676libsmbfs:	libkrb5 libsec libidmap pkcs11
677libsmbios:	libdevinfo
678libsrpt:	libstmf
679libstmf:	libscf
680libstmfproxy:	libstmf libpthread
681libsun_ima:	libdevinfo libsysevent
682libsysevent:	libsecdb
683libtecla:	libcurses
684libtermcap:	libcurses
685libtsalarm:	libpcp
686libtsnet:	libtsol libsecdb
687libtsol:	libsecdb
688libuuid:	libdlpi
689libv12n:	libds libuuid
690libvmm:		libvmmapi
691libvolmgt:	libadm
692libvrrpadm:	libdladm libscf
693libvscan:	libscf libsecdb
694libxpio:	libdevinfo libnvpair
695libzfs:		libdevid libgen libuutil libavl libefi libidmap \
696		libumem libtsol libzfs_core libcryptoutil pkcs11 libmd libzutil
697libzfsbootenv:	libzfs libnvpair
698libzfs_core:	libnvpair
699libzfs_jni:	libdiskmgt libzfs libzutil
700libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
701		libuutil libbsm libsecdb
702libzonestat:	libcmdutils libumem
703libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzutil
704libzutil:	libadm libavl libdevid libefi
705madv:		libgen
706mpapi:		libpthread libdevinfo libsysevent
707mpss:		libgen
708nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
709pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
710passwdutil:	libsldap
711pkcs11:		libcryptoutil libgen libuuid
712policykit:	dbusdeps
713print:		libldap5 libmd5 libsendfile
714pylibbe:	libbe libzfs
715pysolaris:	libsec libidmap
716pyzfs:		libzfs
717raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
718rpcsec_gss:	libgss
719sasl_plugins:	pkcs11 libgss libsasl
720scsi:		libfru libumem libdevid libdevinfo
721smbclnt:	libfakekernel pkcs11
722smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
723		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
724		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
725storage:	libdevice libdevinfo libdevid
726sun_fc:		libdevinfo libsysevent
727sun_sas:	libdevinfo libsysevent libkstat libdevid
728udapl:		libdevinfo libdladm
729varpd:		libavl libidspace libumem libnsl libnvpair libmd5 librename \
730		libcustr
731
732#
733# The reason this rule checks for the existence of the
734# Makefile is that some of the directories do not exist
735# in certain situations (e.g., exportable source builds,
736# OpenSolaris).
737#
738$(SUBDIRS): FRC
739	cd $@; pwd; $(MAKE) $(TARGET)
740
741$(SUBDIRS:%=%-nodepend):
742	cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET)
743
744FRC:
745