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