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 2019, 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	crt			\
51	../cmd/sgs/libconv	\
52	../cmd/sgs/libdl	\
53	libc			\
54	.WAIT
55
56# Build libraries with lots of dependents
57SUBDIRS +=		\
58	libm		\
59	libmd		\
60	libmp		\
61	libnsl		\
62	libnvpair	\
63	libsocket	\
64	.WAIT
65
66# Build everything else. Aside from explicit dependencies, all libraries
67# are built in parallel.
68SUBDIRS +=				\
69	../cmd/sendmail/libmilter	\
70	../cmd/sgs/libelf	\
71	../cmd/sgs/librtld_db	\
72	abi		\
73	auditd_plugins	\
74	brand		\
75	c_synonyms	\
76	cfgadm_plugins	\
77	crypt_modules	\
78	extendedFILE	\
79	fm		\
80	getloginx	\
81	gss_mechs/mech_dh	\
82	gss_mechs/mech_dummy	\
83	gss_mechs/mech_krb5	\
84	gss_mechs/mech_spnego	\
85	hal		\
86	hbaapi		\
87	iconv_modules	\
88	krb5		\
89	libadm		\
90	libads		\
91	libadt_jni	\
92	libadutils	\
93	libaio		\
94	libast		\
95	libavl		\
96	libbe		\
97	libbrand	\
98	libbsdmalloc	\
99	libbsm		\
100	libc_db		\
101	libcfgadm	\
102	libcmd		\
103	libcmdutils	\
104	libcommputil	\
105	libcontract	\
106	libcpc		\
107	libcrypt	\
108	libcryptoutil	\
109	libctf		\
110	libcurses	\
111	libcustr	\
112	libdemangle	\
113	libdevice	\
114	libdevid	\
115	libdevinfo	\
116	libdhcpagent	\
117	libdhcputil	\
118	libdisasm	\
119	libdiskmgt	\
120	libdladm	\
121	libdll		\
122	libdlpi		\
123	libdns_sd	\
124	libdoor		\
125	libdtrace	\
126	libdtrace_jni	\
127	libdwarf	\
128	libefi		\
129	libelfsign	\
130	libeti		\
131	libexacct	\
132	libexacct/demo	\
133	libfakekernel	\
134	libfcoe		\
135	libficl		\
136	libfru		\
137	libfruutils	\
138	libfsmgt	\
139	libfstyp	\
140	libgen		\
141	libgrubmgmt	\
142	libgss		\
143	libhotplug	\
144	libidmap	\
145	libilb		\
146	libima		\
147	libinetsvc	\
148	libinetutil	\
149	libinstzones	\
150	libintl		\
151	libipadm	\
152	libipd		\
153	libipmi		\
154	libipmp		\
155	libipp		\
156	libipsecutil	\
157	libiscsit	\
158	libjedec	\
159	libkmf		\
160	libkrb5		\
161	libkstat	\
162	libkvm		\
163	libldap5	\
164	liblgrp		\
165	liblm		\
166	libm1		\
167	libmail		\
168	libmalloc	\
169	libmapid	\
170	libmapmalloc	\
171	libmd5		\
172	libmlrpc	\
173	libmtmalloc	\
174	libmvec		\
175	libndmp		\
176	libnisdb	\
177	libnls		\
178	libnwam		\
179	libofmt		\
180	libpam		\
181	libpcidb	\
182	libpctx		\
183	libpicl		\
184	libpicltree	\
185	libpkg		\
186	libpool		\
187	libpp		\
188	libproc		\
189	libproject	\
190	libpthread	\
191	libraidcfg	\
192	librcm		\
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	libshell	\
211	libsip		\
212	libsldap	\
213	libslp		\
214	libsmbfs	\
215	libsmbios	\
216	libsmedia	\
217	libsqlite	\
218	libsrpt		\
219	libstmf		\
220	libstmfproxy	\
221	libsum		\
222	libsun_ima	\
223	libsys		\
224	libsysevent	\
225	libtecla	\
226	libtermcap	\
227	libthread	\
228	libtnf		\
229	libtnfctl	\
230	libtnfprobe	\
231	libtsnet	\
232	libtsol		\
233	libumem		\
234	libuuid		\
235	libuutil	\
236	libvolmgt	\
237	libvrrpadm	\
238	libvscan	\
239	libw		\
240	libwrap		\
241	libxcurses	\
242	libxcurses2	\
243	libxnet		\
244	libzfs		\
245	libzfs_core	\
246	libzfs_jni	\
247	libzonecfg	\
248	libzoneinfo	\
249	libzonestat	\
250	libzpool	\
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	libfdisk	\
280	libsaveargs
281
282sparc_SUBDIRS=		\
283	efcode		\
284	libds		\
285	libdscp		\
286	libprtdiag	\
287	libprtdiag_psr	\
288	libpri		\
289	librsc		\
290	storage		\
291	libpcp		\
292	libtsalarm	\
293	libv12n
294
295#
296# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
297# clean and clobber targets (for more information, see those targets, below).
298#
299NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
300
301DCSUBDIRS=
302
303MSGSUBDIRS=		\
304	abi		\
305	auditd_plugins	\
306	brand		\
307	cfgadm_plugins	\
308	gss_mechs/mech_dh	\
309	gss_mechs/mech_krb5	\
310	krb5		\
311	libast		\
312	libbsm		\
313	libc		\
314	libcfgadm	\
315	libcmd		\
316	libcontract	\
317	libcurses	\
318	libdhcputil	\
319	libdiskmgt	\
320	libdladm	\
321	libdll		\
322	libgrubmgmt	\
323	libgss		\
324	libidmap	\
325	libilb		\
326	libinstzones	\
327	libipadm	\
328	libipmp		\
329	libipsecutil	\
330	libldap5	\
331	libnsl		\
332	libnwam		\
333	libofmt		\
334	libpam		\
335	libpicl		\
336	libpkg		\
337	libpool		\
338	libpp		\
339	libreparse	\
340	libsasl		\
341	libscf		\
342	libsecdb	\
343	libshare	\
344	libshell	\
345	libsldap	\
346	libslp		\
347	libsmbfs	\
348	libsmedia	\
349	libsum		\
350	libtsol		\
351	libuutil	\
352	libvrrpadm	\
353	libvscan	\
354	libzfs		\
355	libzonecfg	\
356	madv		\
357	mpss		\
358	pam_modules	\
359	pyzfs		\
360	rpcsec_gss	\
361	$($(MACH)_MSGSUBDIRS)
362
363sparc_MSGSUBDIRS=	\
364	libprtdiag	\
365	libprtdiag_psr
366
367i386_MSGSUBDIRS= libfdisk
368
369HDRSUBDIRS=				\
370	../cmd/sendmail/libmilter	\
371	auditd_plugins	\
372	fm		\
373	hal		\
374	hbaapi		\
375	libads		\
376	libast		\
377	libbrand	\
378	libbsm		\
379	libc		\
380	libcmd		\
381	libcmdutils	\
382	libcommputil	\
383	libcontract	\
384	libcpc		\
385	libcryptoutil	\
386	libctf		\
387	libcurses	\
388	libcustr	\
389	libdemangle	\
390	libdevice	\
391	libdevid	\
392	libdevinfo	\
393	libdhcpagent	\
394	libdhcputil	\
395	libdisasm	\
396	libdiskmgt	\
397	libdladm	\
398	libdll		\
399	libdlpi		\
400	libdns_sd	\
401	libdtrace	\
402	libdtrace_jni	\
403	libelfsign	\
404	libeti		\
405	libfakekernel	\
406	libfcoe		\
407	libfru		\
408	libfstyp	\
409	libgen		\
410	libgrubmgmt	\
411	libidmap	\
412	libilb		\
413	libima		\
414	libinetsvc	\
415	libinetutil	\
416	libinstzones	\
417	libipadm	\
418	libipd		\
419	libipmi		\
420	libipmp		\
421	libipp		\
422	libipsecutil	\
423	libiscsit	\
424	libkrb5		\
425	libkstat	\
426	libkvm		\
427	libmail		\
428	libmapid	\
429	libmd		\
430	libmlrpc	\
431	libmtmalloc	\
432	libndmp		\
433	libnsl		\
434	libnvpair	\
435	libnwam		\
436	libofmt		\
437	libpam		\
438	libpcidb	\
439	libpctx		\
440	libpicl		\
441	libpicltree	\
442	libpool		\
443	libpp		\
444	libproc		\
445	libraidcfg	\
446	librcm		\
447	libreparse	\
448	librestart	\
449	librpcsvc	\
450	librsm		\
451	librstp		\
452	libsasl		\
453	libscf		\
454	libsec		\
455	libsff		\
456	libshare	\
457	libshell	\
458	libsip		\
459	libslp		\
460	libsmbfs	\
461	libsmbios	\
462	libsmedia	\
463	libsocket	\
464	libsqlite	\
465	libsrpt		\
466	libstmf		\
467	libstmfproxy	\
468	libsum		\
469	libsun_ima	\
470	libsysevent	\
471	libtecla	\
472	libtermcap	\
473	libtnf		\
474	libtnfctl	\
475	libtnfprobe	\
476	libtsnet	\
477	libtsol		\
478	libumem		\
479	libuutil	\
480	libvolmgt	\
481	libvrrpadm	\
482	libvscan	\
483	libwrap		\
484	libxcurses2	\
485	libzfs		\
486	libzfs_core	\
487	libzfs_jni	\
488	libzoneinfo	\
489	libzonestat	\
490	mpapi		\
491	passwdutil	\
492	pkcs11		\
493	policykit	\
494	scsi		\
495	smbsrv		\
496	smhba		\
497	udapl		\
498	$($(MACH)_HDRSUBDIRS)
499
500i386_HDRSUBDIRS=	\
501	libfdisk	\
502	libsaveargs
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
545lint:
546
547install_h check:	$(HDRSUBDIRS:%=%-nodepend)
548
549_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
550
551_dc:			$(DCSUBDIRS:%=%-nodepend)
552
553# Library interdependencies are called out explicitly here.
554../cmd/sgs/libconv: crt
555../cmd/sgs/libdl: crt
556libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
557
558libm:		libc
559libmd:		libc
560libmp:		libc
561libnsl:		libc libmd libmp
562libnvpair:	libc libnsl
563libsocket:	libc libnsl
564
565basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
566basedeps :=	TARGET=install
567
568# The following dependencies are currently required by libdbus-1 and should
569# be used for anything linking against it.
570dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
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
575abi:		libctf libmapmalloc libproc
576auditd_plugins: libbsm libsecdb libgss libmtmalloc
577brand:		libzonecfg libmapmalloc
578cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
579fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
580		libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
581		libpcidb
582$(SPARC_BLD)fm:	libpri
583gss_mechs/mech_dh: libgss
584gss_mechs/mech_dummy: libgss
585gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
586gss_mechs/mech_spnego: gss_mechs/mech_krb5
587hal:		dbusdeps
588krb5:		gss_mechs/mech_krb5 libtecla libldap5
589libadt_jni:	libbsm
590libadutils:	libldap5 libresolv2
591libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl
592libbsm:		libinetutil libscf libsecdb libtsol
593libcfgadm:	libdevinfo
594libcmd:		libsum libast
595libcmdutils:	libavl
596libcpc:		libpctx
597libcrypt:	libgen
598libctf:		libdwarf
599libdemangle:	libcustr
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
608libdll:		libast
609libdlpi:	libinetutil libdladm
610libds:		libsysevent
611libdtrace:	libproc libgen libctf libmapmalloc
612libdtrace_jni:	libuutil libdtrace
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
626libinstzones:	libzonecfg libcontract
627libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
628libipmp:	libinetutil
629libipsecutil:	libtecla libtsol libkmf
630libiscsit:	libstmf libuuid
631libkmf:		libcryptoutil pkcs11 libcustr
632libkvm:		../cmd/sgs/libelf
633libldap5:	libsasl
634libmapid:	libresolv2 libscf
635libmlrpc:	libsmbfs libuuid
636libndmp:	libscf
637libnisdb:	libldap5
638libnwam:	libscf libbsm libdladm libipadm
639libpcp:		libumem libdevinfo
640libpctx:	libproc
641libpkg:		libscf libadm
642libpool:	libscf libexacct
643libpp:		libast
644libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
645$(INTEL_BLD)libproc: libsaveargs
646libproject:	libpool libproc libsecdb
647libprtdiag:	libkstat
648libprtdiag_psr:	libprtdiag
649libraidcfg:	libdevinfo
650librestart:	libuutil libscf libpool libproject libsecdb libsysevent
651libsasl:	libgss pkcs11
652libsaveargs:	libdisasm
653libscf:		libuutil libgen libsmbios
654libsec:		libavl libidmap
655libsff:		libnvpair
656libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
657libshell:	libast libcmd libdll libsecdb
658libsip:		libmd5
659libsldap:	libldap5 libscf
660libsmbfs:	libkrb5 libsec libidmap pkcs11
661libsmbios:	libdevinfo
662libsrpt:	libstmf
663libstmf:	libscf
664libstmfproxy:	libstmf libpthread
665libsum:		libast
666libsun_ima:	libdevinfo libsysevent
667libsysevent:	libsecdb
668libtecla:	libcurses
669libtermcap:	libcurses
670libtnfctl:	../cmd/sgs/libelf
671libtsalarm:	libpcp
672libtsnet:	libtsol libsecdb
673libtsol:	libsecdb
674libuuid:	libdlpi
675libv12n:	libds libuuid
676libvolmgt:	libadm
677libvrrpadm:	libdladm libscf
678libvscan:	libscf libsecdb
679libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
680		libumem libtsol libzfs_core libcryptoutil pkcs11 libmd libcmdutils
681libzfs_jni:	libdiskmgt libzfs
682libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
683		libuutil libbsm libsecdb
684libzonestat:	libcmdutils libumem
685libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzfs
686madv:		libgen
687mpapi:		libpthread libdevinfo libsysevent
688mpss:		libgen
689nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
690pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
691passwdutil:	libsldap
692pkcs11:		libcryptoutil libgen libuuid
693policykit:	dbusdeps
694print:		libldap5 libmd5 libsendfile
695pylibbe:	libbe libzfs
696pysolaris:	libsec libidmap
697pyzfs:		libzfs
698raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
699rpcsec_gss:	libgss
700sasl_plugins:	pkcs11 libgss libsasl
701scsi:		libfru libumem libdevid libdevinfo
702smbclnt:	libfakekernel pkcs11
703smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
704		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
705		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
706storage:	libdevice libdevinfo libdevid
707sun_fc:		libdevinfo libsysevent
708sun_sas:	libdevinfo libsysevent libkstat libdevid
709udapl:		libdevinfo libdladm
710
711#
712# The reason this rule checks for the existence of the
713# Makefile is that some of the directories do not exist
714# in certain situations (e.g., exportable source builds,
715# OpenSolaris).
716#
717$(SUBDIRS): FRC
718	@if [ -f $@/Makefile  ]; then \
719		cd $@; pwd; $(MAKE) $(TARGET); \
720	else \
721		true; \
722	fi
723
724$(SUBDIRS:%=%-nodepend):
725	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
726		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
727	else \
728		true; \
729	fi
730
731FRC:
732