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