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