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