xref: /illumos-gate/usr/src/lib/Makefile (revision b0d8599cdab985a41de495bf1f4f1bb56cdbef3c)
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
546lint:
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
586libads:		libnsl
587libadt_jni:	libbsm
588libadutils:	libldap5 libresolv2
589libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl \
590		libzfsbootenv
591libbsm:		libinetutil libscf libsecdb libtsol
592libcfgadm:	libdevinfo
593libcontract:	libnvpair
594libcmdutils:	libavl libnvpair
595libcpc:		libpctx
596libcrypt:	libgen
597libctf:		libdwarf
598libdemangle:	libcustr
599libdevice:	libnvpair
600libdevid:	libdevinfo
601libdevinfo:	libsec libgen
602libdhcpagent:	libdhcputil libuuid libdlpi libcontract
603libdhcputil:	libgen libinetutil libdlpi
604libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
605$(INTEL_BLD)libdiskmgt: libfdisk
606libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
607		libpool
608libdlpi:	libinetutil libdladm
609libds:		libsysevent
610libdtrace:	libproc libgen libctf libmapmalloc
611libdtrace_jni:	libuutil libdtrace
612libdwarf:	../cmd/sgs/libelf
613libefi:		libuuid libsmbios
614libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
615libeti:		libcurses
616libexacct/demo:	libexacct libproject
617libfakekernel:	libumem libcryptoutil
618libfcoe:	libdladm
619libficl:	libuuid libumem
620libfru:		libfruutils
621libfsmgt:	libkstat
622libgrubmgmt:	libdevinfo libzfs libfstyp libefi
623$(INTEL_BLD)libgrubmgmt: libfdisk
624libidmap:	libavl libuutil
625libinetsvc:	libscf
626libinetutil:	libsocket
627libinstzones:	libzonecfg libcontract
628libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
629libipmi:	libm libnvpair libsocket libnsl
630libipmp:	libinetutil
631libipsecutil:	libtecla libtsol libkmf
632libiscsit:	libstmf libuuid
633libhotplug:	libnvpair
634libkmf:		libcryptoutil pkcs11 libcustr
635libkvm:		../cmd/sgs/libelf
636libldap5:	libsasl
637libmapid:	libresolv2 libscf
638libmlrpc:	libsmbfs libuuid
639libndmp:	libscf
640libnisdb:	libldap5
641libnwam:	libscf libbsm libdladm libipadm
642libpcp:		libumem libdevinfo
643libpctx:	libproc
644libpkg:		libscf libadm
645libpool:	libscf libexacct
646libppt:		libpcidb libdevinfo libcmdutils
647libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
648$(INTEL_BLD)libproc: libsaveargs
649libproject:	libpool libproc libsecdb
650libprtdiag:	libkstat libdevinfo
651libprtdiag_psr:	libprtdiag
652libraidcfg:	libdevinfo
653librcm:		libnvpair
654librestart:	libuutil libscf libpool libproject libsecdb libsysevent
655libsasl:	libgss pkcs11
656libsaveargs:	libdisasm
657libscf:		libuutil libgen libnsl libnvpair libsmbios
658libsec:		libavl libidmap
659libsecdb:	libnsl
660libsff:		libnvpair
661libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
662libsip:		libmd5
663libsldap:	libldap5 libscf
664libsmbfs:	libkrb5 libsec libidmap pkcs11
665libsmbios:	libdevinfo
666libsrpt:	libstmf
667libstmf:	libscf
668libstmfproxy:	libstmf libpthread
669libsun_ima:	libdevinfo libsysevent
670libsysevent:	libsecdb
671libtecla:	libcurses
672libtermcap:	libcurses
673libtnfctl:	../cmd/sgs/libelf
674libtsalarm:	libpcp
675libtsnet:	libtsol libsecdb
676libtsol:	libsecdb
677libuuid:	libdlpi
678libv12n:	libds libuuid
679libvmm:		libvmmapi
680libvolmgt:	libadm
681libvrrpadm:	libdladm libscf
682libvscan:	libscf libsecdb
683libzfs:		libdevid libgen libuutil libavl libefi libidmap \
684		libumem libtsol libzfs_core libcryptoutil pkcs11 libmd libzutil
685libzfsbootenv:	libzfs libnvpair
686libzfs_core:	libnvpair
687libzfs_jni:	libdiskmgt libzfs libzutil
688libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
689		libuutil libbsm libsecdb
690libzonestat:	libcmdutils libumem
691libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzutil
692libzutil:	libadm libavl libdevid libefi
693madv:		libgen
694mpapi:		libpthread libdevinfo libsysevent
695mpss:		libgen
696nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
697pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
698passwdutil:	libsldap
699pkcs11:		libcryptoutil libgen libuuid
700policykit:	dbusdeps
701print:		libldap5 libmd5 libsendfile
702pylibbe:	libbe libzfs
703pysolaris:	libsec libidmap
704pyzfs:		libzfs
705raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
706rpcsec_gss:	libgss
707sasl_plugins:	pkcs11 libgss libsasl
708scsi:		libfru libumem libdevid libdevinfo
709smbclnt:	libfakekernel pkcs11
710smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
711		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
712		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
713storage:	libdevice libdevinfo libdevid
714sun_fc:		libdevinfo libsysevent
715sun_sas:	libdevinfo libsysevent libkstat libdevid
716udapl:		libdevinfo libdladm
717
718#
719# The reason this rule checks for the existence of the
720# Makefile is that some of the directories do not exist
721# in certain situations (e.g., exportable source builds,
722# OpenSolaris).
723#
724$(SUBDIRS): FRC
725	@if [ -f $@/Makefile  ]; then \
726		cd $@; pwd; $(MAKE) $(TARGET); \
727	else \
728		true; \
729	fi
730
731$(SUBDIRS:%=%-nodepend):
732	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
733		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
734	else \
735		true; \
736	fi
737
738FRC:
739