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