xref: /illumos-gate/usr/src/lib/Makefile (revision fa4a3e77edc40df6d92e8da6fc4961d275e9896d)
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 2014 Garrett D'Amore <garrett@damore.org>
28# Copyright (c) 2015 Gary Mills
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	libilb		\
144	libima		\
145	libinetsvc	\
146	libinetutil	\
147	libinstzones	\
148	libintl		\
149	libipadm	\
150	libipd		\
151	libipmi		\
152	libipmp		\
153	libipp		\
154	libipsecutil	\
155	libiscsit	\
156	libjedec	\
157	libkmf		\
158	libkrb5		\
159	libkstat	\
160	libkvm		\
161	libldap5	\
162	liblgrp		\
163	liblm		\
164	libm1		\
165	libmail		\
166	libmalloc	\
167	libmapid	\
168	libmapmalloc	\
169	libmd5		\
170	libmlrpc	\
171	libmtmalloc	\
172	libmvec		\
173	libndmp		\
174	libnisdb	\
175	libnls		\
176	libnwam		\
177	libofmt		\
178	libpam		\
179	libpcidb	\
180	libpcsc		\
181	libpctx		\
182	libpicl		\
183	libpicltree	\
184	libpkg		\
185	libpool		\
186	libproc		\
187	libproject	\
188	libpthread	\
189	libraidcfg	\
190	librcm		\
191	libreparse	\
192	libresolv	\
193	libresolv2	\
194	librestart	\
195	librpcsvc	\
196	librsm		\
197	librstp		\
198	librt		\
199	libsasl		\
200	libscf		\
201	libsched	\
202	libsctp		\
203	libsec		\
204	libsecdb	\
205	libsendfile	\
206	libsff		\
207	libshare	\
208	libsip		\
209	libsldap	\
210	libslp		\
211	libsmbfs	\
212	libsmbios	\
213	libsmedia	\
214	libsqlite	\
215	libsrpt		\
216	libstmf		\
217	libstmfproxy	\
218	libsun_ima	\
219	libsysevent	\
220	libtecla	\
221	libtermcap	\
222	libthread	\
223	libtnf		\
224	libtnfctl	\
225	libtnfprobe	\
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	ncad_addr	\
254	nsswitch	\
255	pam_modules	\
256	passwdutil	\
257	pkcs11		\
258	policykit	\
259	print		\
260	pylibbe		\
261	pysolaris	\
262	pyzfs		\
263	raidcfg_plugins	\
264	rpcsec_gss	\
265	sasl_plugins	\
266	scsi		\
267	smbclnt		\
268	smbsrv		\
269	smhba		\
270	sun_fc		\
271	sun_sas		\
272	udapl		\
273	watchmalloc	\
274	$($(MACH)_SUBDIRS)
275
276i386_SUBDIRS=		\
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	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	libreparse	\
440	librestart	\
441	librpcsvc	\
442	librsm		\
443	librstp		\
444	libsasl		\
445	libscf		\
446	libsec		\
447	libsff		\
448	libshare	\
449	libsip		\
450	libslp		\
451	libsmbfs	\
452	libsmbios	\
453	libsmedia	\
454	libsocket	\
455	libsqlite	\
456	libsrpt		\
457	libstmf		\
458	libstmfproxy	\
459	libsun_ima	\
460	libsysevent	\
461	libtecla	\
462	libtermcap	\
463	libtnf		\
464	libtnfctl	\
465	libtnfprobe	\
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	$($(MACH)_HDRSUBDIRS)
490
491i386_HDRSUBDIRS=	\
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
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
584libads:		libnsl
585libadt_jni:	libbsm
586libadutils:	libldap5 libresolv2
587libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl \
588		libzfsbootenv
589libbsm:		libinetutil libscf libsecdb libtsol
590libcfgadm:	libdevinfo
591libcontract:	libnvpair
592libcmdutils:	libavl libnvpair
593libcpc:		libpctx
594libcrypt:	libgen
595libctf:		libdwarf
596libdemangle:	libcustr
597libdevice:	libnvpair
598libdevid:	libdevinfo
599libdevinfo:	libsec libgen
600libdhcpagent:	libdhcputil libuuid libdlpi libcontract
601libdhcputil:	libgen libinetutil libdlpi
602libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
603$(INTEL_BLD)libdiskmgt: libfdisk
604libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
605		libpool
606libdlpi:	libinetutil libdladm
607libds:		libsysevent
608libdtrace:	libproc libgen libctf libmapmalloc
609libdtrace_jni:	libuutil libdtrace
610libdwarf:	../cmd/sgs/libelf
611libefi:		libuuid libsmbios
612libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
613libeti:		libcurses
614libexacct/demo:	libexacct libproject
615libfakekernel:	libumem libcryptoutil
616libfcoe:	libdladm
617libficl:	libuuid libumem
618libfru:		libfruutils
619libfsmgt:	libkstat
620libgrubmgmt:	libdevinfo libzfs libfstyp libefi
621$(INTEL_BLD)libgrubmgmt: libfdisk
622libidmap:	libavl libuutil
623libinetsvc:	libscf
624libinetutil:	libsocket
625libinstzones:	libzonecfg libcontract
626libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
627libipmi:	libm libnvpair libsocket libnsl
628libipmp:	libinetutil
629libipsecutil:	libtecla libtsol libkmf
630libiscsit:	libstmf libuuid
631libhotplug:	libnvpair
632libkmf:		libcryptoutil pkcs11 libcustr
633libkvm:		../cmd/sgs/libelf
634libldap5:	libsasl
635libmapid:	libresolv2 libscf
636libmlrpc:	libsmbfs libuuid
637libndmp:	libscf
638libnisdb:	libldap5
639libnwam:	libscf libbsm libdladm libipadm
640libpcp:		libumem libdevinfo
641libpctx:	libproc
642libpkg:		libscf libadm
643libpool:	libscf libexacct
644libppt:		libpcidb libdevinfo libcmdutils
645libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
646$(INTEL_BLD)libproc: libsaveargs
647libproject:	libpool libproc libsecdb
648libprtdiag:	libkstat libdevinfo
649libprtdiag_psr:	libprtdiag
650libraidcfg:	libdevinfo
651librcm:		libnvpair
652librestart:	libuutil libscf libpool libproject libsecdb libsysevent
653libsasl:	libgss pkcs11
654libsaveargs:	libdisasm
655libscf:		libuutil libgen libnsl libnvpair libsmbios
656libsec:		libavl libidmap
657libsecdb:	libnsl
658libsff:		libnvpair
659libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
660libsip:		libmd5
661libsldap:	libldap5 libscf
662libsmbfs:	libkrb5 libsec libidmap pkcs11
663libsmbios:	libdevinfo
664libsrpt:	libstmf
665libstmf:	libscf
666libstmfproxy:	libstmf libpthread
667libsun_ima:	libdevinfo libsysevent
668libsysevent:	libsecdb
669libtecla:	libcurses
670libtermcap:	libcurses
671libtnfctl:	../cmd/sgs/libelf
672libtsalarm:	libpcp
673libtsnet:	libtsol libsecdb
674libtsol:	libsecdb
675libuuid:	libdlpi
676libv12n:	libds libuuid
677libvmm:		libvmmapi
678libvolmgt:	libadm
679libvrrpadm:	libdladm libscf
680libvscan:	libscf libsecdb
681libzfs:		libdevid libgen libuutil libavl libefi libidmap \
682		libumem libtsol libzfs_core libcryptoutil pkcs11 libmd libzutil
683libzfsbootenv:	libzfs libnvpair
684libzfs_core:	libnvpair
685libzfs_jni:	libdiskmgt libzfs libzutil
686libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
687		libuutil libbsm libsecdb
688libzonestat:	libcmdutils libumem
689libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzutil
690libzutil:	libadm libavl libdevid libefi
691madv:		libgen
692mpapi:		libpthread libdevinfo libsysevent
693mpss:		libgen
694nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
695pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
696passwdutil:	libsldap
697pkcs11:		libcryptoutil libgen libuuid
698policykit:	dbusdeps
699print:		libldap5 libmd5 libsendfile
700pylibbe:	libbe libzfs
701pysolaris:	libsec libidmap
702pyzfs:		libzfs
703raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
704rpcsec_gss:	libgss
705sasl_plugins:	pkcs11 libgss libsasl
706scsi:		libfru libumem libdevid libdevinfo
707smbclnt:	libfakekernel pkcs11
708smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
709		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
710		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
711storage:	libdevice libdevinfo libdevid
712sun_fc:		libdevinfo libsysevent
713sun_sas:	libdevinfo libsysevent libkstat libdevid
714udapl:		libdevinfo libdladm
715
716#
717# The reason this rule checks for the existence of the
718# Makefile is that some of the directories do not exist
719# in certain situations (e.g., exportable source builds,
720# OpenSolaris).
721#
722$(SUBDIRS): FRC
723	cd $@; pwd; $(MAKE) $(TARGET)
724
725$(SUBDIRS:%=%-nodepend):
726	cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET)
727
728FRC:
729