xref: /illumos-gate/usr/src/lib/Makefile (revision 82d0151a507442720a3aea34c8925041894ab173)
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	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	$($(MACH)_HDRSUBDIRS)
495
496i386_HDRSUBDIRS=	\
497	lib9p		\
498	libfdisk	\
499	libppt		\
500	libsaveargs	\
501	libvmm		\
502	libvmmapi
503
504sparc_HDRSUBDIRS=	\
505	libds		\
506	libdscp		\
507	libpri		\
508	libv12n		\
509	storage
510
511all :=		TARGET= all
512check :=	TARGET= check
513clean :=	TARGET= clean
514clobber :=	TARGET= clobber
515install :=	TARGET= install
516install_h :=	TARGET= install_h
517_dc :=		TARGET= _dc
518_msg :=		TARGET= _msg
519
520.KEEP_STATE:
521
522#
523# For the all and install targets, we clearly must respect library
524# dependencies so that the libraries link correctly.  However, for
525# the remaining targets (check, clean, clobber, install_h, _dc
526# and _msg), libraries do not have any dependencies on one another
527# and thus respecting dependencies just slows down the build.
528# As such, for these rules, we use pattern replacement to explicitly
529# avoid triggering the dependency information.  Note that for clean and
530# clobber, we must use $(NOWAIT_SUBDIRS) rather than
531# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
532#
533
534all:			$(SUBDIRS)
535
536install:		$(SUBDIRS) .WAIT install_extra
537
538# extra libraries kept in other source areas
539install_extra:
540	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
541	@pwd
542
543clean clobber:		$(NOWAIT_SUBDIRS:%=%-nodepend)
544
545
546install_h check:	$(HDRSUBDIRS:%=%-nodepend)
547
548_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
549
550_dc:			$(DCSUBDIRS:%=%-nodepend)
551
552# Library interdependencies are called out explicitly here.
553../cmd/sgs/libconv: crt
554../cmd/sgs/libdl: crt
555libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
556
557libm:		libc
558libmd:		libc
559libmp:		libc
560libnsl:		libc libmd libmp
561libnvpair:	libc libnsl
562libsocket:	libc libnsl
563
564basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
565basedeps :=	TARGET=install
566
567# The following dependencies are currently required by libdbus-1 and should
568# be used for anything linking against it.
569dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios \
570		libbsm
571
572# The following dependencies don't need to be listed below as they are built
573# before everything else:
574# libc libm libmd libmp libnsl libnvpair libsocket
575../cmd/sendmail/libmilter:	libsocket libnsl
576abi:		libctf libmapmalloc libproc
577auditd_plugins: libbsm libsecdb libgss libmtmalloc
578brand:		libzonecfg libmapmalloc
579cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
580fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
581		libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
582		libpcidb libdiskmgt
583$(SPARC_BLD)fm:	libpri
584gss_mechs/mech_dh: libgss
585gss_mechs/mech_dummy: libgss
586gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
587gss_mechs/mech_spnego: gss_mechs/mech_krb5
588hal:		dbusdeps
589krb5:		gss_mechs/mech_krb5 libtecla libldap5
590lib9p:		libsec libcustr
591libads:		libnsl
592libadt_jni:	libbsm
593libadutils:	libldap5 libresolv2
594libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl \
595		libzfsbootenv
596libbsm:		libinetutil libscf libsecdb libtsol
597libcfgadm:	libdevinfo
598libcontract:	libnvpair
599libcmdutils:	libavl libnvpair
600libcpc:		libpctx
601libcrypt:	libgen
602libctf:		libdwarf
603libdemangle:	libcustr
604libdevice:	libnvpair
605libdevid:	libdevinfo
606libdevinfo:	libsec libgen
607libdhcpagent:	libdhcputil libuuid libdlpi libcontract
608libdhcputil:	libgen libinetutil libdlpi
609libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
610$(INTEL_BLD)libdiskmgt: libfdisk
611libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
612		libpool
613libdlpi:	libinetutil libdladm
614libds:		libsysevent
615libdtrace:	libproc libgen libctf libmapmalloc
616libdtrace_jni:	libuutil libdtrace
617libdwarf:	../cmd/sgs/libelf
618libefi:		libuuid libsmbios
619libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
620libeti:		libcurses
621libexacct/demo:	libexacct libproject
622libfakekernel:	libumem libcryptoutil
623libfcoe:	libdladm
624libficl:	libuuid libumem
625libfru:		libfruutils
626libfsmgt:	libkstat
627libgrubmgmt:	libdevinfo libzfs libfstyp libefi
628$(INTEL_BLD)libgrubmgmt: libfdisk
629libidmap:	libavl libuutil
630libidspace:	libumem
631libinetsvc:	libscf
632libinetutil:	libsocket
633libinstzones:	libzonecfg libcontract
634libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil \
635		libcmdutils
636libipmi:	libm libnvpair libsocket libnsl
637libipmp:	libinetutil
638libipsecutil:	libtecla libtsol libkmf
639libiscsit:	libstmf libuuid
640libhotplug:	libnvpair
641libkmf:		libcryptoutil pkcs11 libcustr
642libkvm:		../cmd/sgs/libelf
643libldap5:	libsasl
644libmapid:	libresolv2 libscf
645libmlrpc:	libsmbfs libuuid
646libndmp:	libscf
647libnisdb:	libldap5
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
680libtnfctl:	../cmd/sgs/libelf
681libtsalarm:	libpcp
682libtsnet:	libtsol libsecdb
683libtsol:	libsecdb
684libuuid:	libdlpi
685libv12n:	libds libuuid
686libvmm:		libvmmapi
687libvolmgt:	libadm
688libvrrpadm:	libdladm libscf
689libvscan:	libscf libsecdb
690libzfs:		libdevid libgen libuutil libavl libefi libidmap \
691		libumem libtsol libzfs_core libcryptoutil pkcs11 libmd libzutil
692libzfsbootenv:	libzfs libnvpair
693libzfs_core:	libnvpair
694libzfs_jni:	libdiskmgt libzfs libzutil
695libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
696		libuutil libbsm libsecdb
697libzonestat:	libcmdutils libumem
698libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzutil
699libzutil:	libadm libavl libdevid libefi
700madv:		libgen
701mpapi:		libpthread libdevinfo libsysevent
702mpss:		libgen
703nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
704pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
705passwdutil:	libsldap
706pkcs11:		libcryptoutil libgen libuuid
707policykit:	dbusdeps
708print:		libldap5 libmd5 libsendfile
709pylibbe:	libbe libzfs
710pysolaris:	libsec libidmap
711pyzfs:		libzfs
712raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
713rpcsec_gss:	libgss
714sasl_plugins:	pkcs11 libgss libsasl
715scsi:		libfru libumem libdevid libdevinfo
716smbclnt:	libfakekernel pkcs11
717smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
718		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
719		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
720storage:	libdevice libdevinfo libdevid
721sun_fc:		libdevinfo libsysevent
722sun_sas:	libdevinfo libsysevent libkstat libdevid
723udapl:		libdevinfo libdladm
724
725#
726# The reason this rule checks for the existence of the
727# Makefile is that some of the directories do not exist
728# in certain situations (e.g., exportable source builds,
729# OpenSolaris).
730#
731$(SUBDIRS): FRC
732	cd $@; pwd; $(MAKE) $(TARGET)
733
734$(SUBDIRS:%=%-nodepend):
735	cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET)
736
737FRC:
738