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