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