xref: /illumos-gate/usr/src/lib/Makefile (revision 5bb525f494c825f138113d51f2ba7acf185093f3)
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	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	smbclnt		\
269	smbsrv		\
270	smhba		\
271	sun_fc		\
272	sun_sas		\
273	udapl		\
274	watchmalloc	\
275	$($(MACH)_SUBDIRS)
276
277i386_SUBDIRS=		\
278	libfdisk	\
279	libsaveargs
280
281sparc_SUBDIRS=		\
282	efcode		\
283	libds		\
284	libdscp		\
285	libprtdiag	\
286	libprtdiag_psr	\
287	libpri		\
288	librsc		\
289	storage		\
290	libpcp		\
291	libtsalarm	\
292	libv12n
293
294#
295# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
296# clean and clobber targets (for more information, see those targets, below).
297#
298NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
299
300DCSUBDIRS=
301
302MSGSUBDIRS=		\
303	abi		\
304	auditd_plugins	\
305	brand		\
306	cfgadm_plugins	\
307	gss_mechs/mech_dh	\
308	gss_mechs/mech_krb5	\
309	krb5		\
310	libast		\
311	libbsm		\
312	libc		\
313	libcfgadm	\
314	libcmd		\
315	libcontract	\
316	libcurses	\
317	libdhcputil	\
318	libdiskmgt	\
319	libdladm	\
320	libdll		\
321	libgrubmgmt	\
322	libgss		\
323	libidmap	\
324	libilb		\
325	libinstzones	\
326	libipadm	\
327	libipmp		\
328	libipsecutil	\
329	libldap5	\
330	libnsl		\
331	libnwam		\
332	libofmt		\
333	libpam		\
334	libpicl		\
335	libpkg		\
336	libpool		\
337	libpp		\
338	libreparse	\
339	libsasl		\
340	libscf		\
341	libsecdb	\
342	libshare	\
343	libshell	\
344	libsldap	\
345	libslp		\
346	libsmbfs	\
347	libsmedia	\
348	libsum		\
349	libtsol		\
350	libuutil	\
351	libvrrpadm	\
352	libvscan	\
353	libzfs		\
354	libzonecfg	\
355	madv		\
356	mpss		\
357	pam_modules	\
358	pyzfs		\
359	rpcsec_gss	\
360	$($(MACH)_MSGSUBDIRS)
361
362sparc_MSGSUBDIRS=	\
363	libprtdiag	\
364	libprtdiag_psr
365
366i386_MSGSUBDIRS= libfdisk
367
368HDRSUBDIRS=				\
369	../cmd/sendmail/libmilter	\
370	auditd_plugins	\
371	fm		\
372	hal		\
373	hbaapi		\
374	libads		\
375	libast		\
376	libbrand	\
377	libbsm		\
378	libc		\
379	libcmd		\
380	libcmdutils	\
381	libcommputil	\
382	libcontract	\
383	libcpc		\
384	libcryptoutil	\
385	libctf		\
386	libcurses	\
387	libcustr	\
388	libdemangle	\
389	libdevice	\
390	libdevid	\
391	libdevinfo	\
392	libdhcpagent	\
393	libdhcputil	\
394	libdisasm	\
395	libdiskmgt	\
396	libdwarf	\
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
599libdevid:	libdevinfo
600libdevinfo:	libsec libgen
601libdhcpagent:	libdhcputil libuuid libdlpi libcontract
602libdhcputil:	libgen libinetutil libdlpi
603libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
604$(INTEL_BLD)libdiskmgt: libfdisk
605libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
606		libpool
607libdll:		libast
608libdlpi:	libinetutil libdladm
609libds:		libsysevent
610libdtrace:	libproc libgen libctf libmapmalloc
611libdtrace_jni:	libuutil libdtrace
612libefi:		libuuid libsmbios
613libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
614libeti:		libcurses
615libexacct/demo:	libexacct libproject
616libfakekernel:	libumem libcryptoutil
617libfcoe:	libdladm
618libficl:	libuuid libumem
619libfru:		libfruutils
620libfsmgt:	libkstat
621libgrubmgmt:	libdevinfo libzfs libfstyp libefi
622$(INTEL_BLD)libgrubmgmt: libfdisk
623libidmap:	libavl libuutil
624libinetsvc:	libscf
625libinstzones:	libzonecfg libcontract
626libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
627libipmp:	libinetutil
628libipsecutil:	libtecla libtsol libkmf
629libiscsit:	libstmf libuuid
630libkmf:		libcryptoutil pkcs11 libcustr
631libkvm:		../cmd/sgs/libelf
632libldap5:	libsasl
633libmapid:	libresolv2 libscf
634libmlrpc:	libsmbfs libuuid
635libndmp:	libscf
636libnisdb:	libldap5
637libnwam:	libscf libbsm libdladm libipadm
638libpcp:		libumem libdevinfo
639libpctx:	libproc
640libpkg:		libscf libadm
641libpool:	libscf libexacct
642libpp:		libast
643libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
644$(INTEL_BLD)libproc: libsaveargs
645libproject:	libpool libproc libsecdb
646libprtdiag:	libkstat
647libprtdiag_psr:	libprtdiag
648libraidcfg:	libdevinfo
649librestart:	libuutil libscf libpool libproject libsecdb libsysevent
650libsasl:	libgss pkcs11
651libsaveargs:	libdisasm
652libscf:		libuutil libgen libsmbios
653libsec:		libavl libidmap
654libsff:		libnvpair
655libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
656libshell:	libast libcmd libdll libsecdb
657libsip:		libmd5
658libsldap:	libldap5 libscf
659libsmbfs:	libkrb5 libsec libidmap pkcs11
660libsmbios:	libdevinfo
661libsrpt:	libstmf
662libstmf:	libscf
663libstmfproxy:	libstmf libpthread
664libsum:		libast
665libsun_ima:	libdevinfo libsysevent
666libsysevent:	libsecdb
667libtecla:	libcurses
668libtermcap:	libcurses
669libtnfctl:	../cmd/sgs/libelf
670libtsalarm:	libpcp
671libtsnet:	libtsol libsecdb
672libtsol:	libsecdb
673libuuid:	libdlpi
674libv12n:	libds libuuid
675libvolmgt:	libadm
676libvrrpadm:	libdladm libscf
677libvscan:	libscf libsecdb
678libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
679		libumem libtsol libzfs_core
680libzfs_jni:	libdiskmgt libzfs
681libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
682		libuutil libbsm libsecdb
683libzonestat:	libcmdutils libumem
684libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzfs
685madv:		libgen
686mpapi:		libpthread libdevinfo libsysevent
687mpss:		libgen
688nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
689pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
690passwdutil:	libsldap
691pkcs11:		libcryptoutil libgen libuuid
692policykit:	dbusdeps
693print:		libldap5 libmd5 libsendfile
694pylibbe:	libbe libzfs
695pysolaris:	libsec libidmap
696pyzfs:		libzfs
697raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
698rpcsec_gss:	libgss
699sasl_plugins:	pkcs11 libgss libsasl
700scsi:		libfru libumem libdevid libdevinfo
701smbclnt:	libfakekernel pkcs11
702smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
703		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
704		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
705storage:	libdevice libdevinfo libdevid
706sun_fc:		libdevinfo libsysevent
707sun_sas:	libdevinfo libsysevent libkstat libdevid
708udapl:		libdevinfo libdladm
709
710#
711# The reason this rule checks for the existence of the
712# Makefile is that some of the directories do not exist
713# in certain situations (e.g., exportable source builds,
714# OpenSolaris).
715#
716$(SUBDIRS): FRC
717	@if [ -f $@/Makefile  ]; then \
718		cd $@; pwd; $(MAKE) $(TARGET); \
719	else \
720		true; \
721	fi
722
723$(SUBDIRS:%=%-nodepend):
724	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
725		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
726	else \
727		true; \
728	fi
729
730FRC:
731