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