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