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