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