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