xref: /illumos-gate/usr/src/lib/Makefile (revision a61ed2ce7a86a4d6428f2a83eb4739fae945447e)
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
548lint:
549
550install_h check:	$(HDRSUBDIRS:%=%-nodepend)
551
552_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
553
554_dc:			$(DCSUBDIRS:%=%-nodepend)
555
556# Library interdependencies are called out explicitly here.
557../cmd/sgs/libconv: crt
558../cmd/sgs/libdl: crt
559libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
560
561libm:		libc
562libmd:		libc
563libmp:		libc
564libnsl:		libc libmd libmp
565libnvpair:	libc libnsl
566libsocket:	libc libnsl
567
568basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
569basedeps :=	TARGET=install
570
571# The following dependencies are currently required by libdbus-1 and should
572# be used for anything linking against it.
573dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
574
575# The following dependencies don't need to be listed below as they are built
576# before everything else:
577# libc libm libmd libmp libnsl libnvpair libsocket
578../cmd/sendmail/libmilter:	libsocket libnsl
579abi:		libctf libmapmalloc libproc
580auditd_plugins: libbsm libsecdb libgss libmtmalloc
581brand:		libzonecfg libmapmalloc
582cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
583fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
584		libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
585		libpcidb libdiskmgt
586$(SPARC_BLD)fm:	libpri
587gss_mechs/mech_dh: libgss
588gss_mechs/mech_dummy: libgss
589gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
590gss_mechs/mech_spnego: gss_mechs/mech_krb5
591hal:		dbusdeps
592krb5:		gss_mechs/mech_krb5 libtecla libldap5
593libads:		libnsl
594libadt_jni:	libbsm
595libadutils:	libldap5 libresolv2
596libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl
597libbsm:		libinetutil libscf libsecdb libtsol
598libcfgadm:	libdevinfo
599libcontract:	libnvpair
600libcmd:		libsum libast
601libcmdutils:	libavl libnvpair
602libcpc:		libpctx
603libcrypt:	libgen
604libctf:		libdwarf
605libdemangle:	libcustr
606libdevice:	libnvpair
607libdevid:	libdevinfo
608libdevinfo:	libsec libgen
609libdhcpagent:	libdhcputil libuuid libdlpi libcontract
610libdhcputil:	libgen libinetutil libdlpi
611libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
612$(INTEL_BLD)libdiskmgt: libfdisk
613libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
614		libpool
615libdll:		libast
616libdlpi:	libinetutil libdladm
617libds:		libsysevent
618libdtrace:	libproc libgen libctf libmapmalloc
619libdtrace_jni:	libuutil libdtrace
620libdwarf:	../cmd/sgs/libelf
621libefi:		libuuid libsmbios
622libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
623libeti:		libcurses
624libexacct/demo:	libexacct libproject
625libfakekernel:	libumem libcryptoutil
626libfcoe:	libdladm
627libficl:	libuuid libumem
628libfru:		libfruutils
629libfsmgt:	libkstat
630libgrubmgmt:	libdevinfo libzfs libfstyp libefi
631$(INTEL_BLD)libgrubmgmt: libfdisk
632libidmap:	libavl libuutil
633libinetsvc:	libscf
634libinetutil:	libsocket
635libinstzones:	libzonecfg libcontract
636libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
637libipmi:	libm libnvpair libsocket libnsl
638libipmp:	libinetutil
639libipsecutil:	libtecla libtsol libkmf
640libiscsit:	libstmf libuuid
641libhotplug:	libnvpair
642libkmf:		libcryptoutil pkcs11 libcustr
643libkvm:		../cmd/sgs/libelf
644libldap5:	libsasl
645libmapid:	libresolv2 libscf
646libmlrpc:	libsmbfs libuuid
647libndmp:	libscf
648libnisdb:	libldap5
649libnwam:	libscf libbsm libdladm libipadm
650libpcp:		libumem libdevinfo
651libpctx:	libproc
652libpkg:		libscf libadm
653libpool:	libscf libexacct
654libpp:		libast
655libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
656$(INTEL_BLD)libproc: libsaveargs
657libproject:	libpool libproc libsecdb
658libprtdiag:	libkstat libdevinfo
659libprtdiag_psr:	libprtdiag
660libraidcfg:	libdevinfo
661librcm:		libnvpair
662librestart:	libuutil libscf libpool libproject libsecdb libsysevent
663libsasl:	libgss pkcs11
664libsaveargs:	libdisasm
665libscf:		libuutil libgen libnsl libnvpair libsmbios
666libsec:		libavl libidmap
667libsecdb:	libnsl
668libsff:		libnvpair
669libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
670libshell:	libast libcmd libdll libsecdb
671libsip:		libmd5
672libsldap:	libldap5 libscf
673libsmbfs:	libkrb5 libsec libidmap pkcs11
674libsmbios:	libdevinfo
675libsrpt:	libstmf
676libstmf:	libscf
677libstmfproxy:	libstmf libpthread
678libsum:		libast
679libsun_ima:	libdevinfo libsysevent
680libsysevent:	libsecdb
681libtecla:	libcurses
682libtermcap:	libcurses
683libtnfctl:	../cmd/sgs/libelf
684libtsalarm:	libpcp
685libtsnet:	libtsol libsecdb
686libtsol:	libsecdb
687libuuid:	libdlpi
688libv12n:	libds libuuid
689libvolmgt:	libadm
690libvrrpadm:	libdladm libscf
691libvscan:	libscf libsecdb
692libzfs:		libdevid libgen libuutil libavl libefi libidmap \
693		libumem libtsol libzfs_core libcryptoutil pkcs11 libmd libzutil
694libzfs_core:	libnvpair
695libzfs_jni:	libdiskmgt libzfs libzutil
696libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
697		libuutil libbsm libsecdb
698libzonestat:	libcmdutils libumem
699libzpool:	libavl libumem libcmdutils libsysevent libfakekernel libzutil
700libzutil:	libadm libavl libdevid libefi
701madv:		libgen
702mpapi:		libpthread libdevinfo libsysevent
703mpss:		libgen
704nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
705pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
706passwdutil:	libsldap
707pkcs11:		libcryptoutil libgen libuuid
708policykit:	dbusdeps
709print:		libldap5 libmd5 libsendfile
710pylibbe:	libbe libzfs
711pysolaris:	libsec libidmap
712pyzfs:		libzfs
713raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
714rpcsec_gss:	libgss
715sasl_plugins:	pkcs11 libgss libsasl
716scsi:		libfru libumem libdevid libdevinfo
717smbclnt:	libfakekernel pkcs11
718smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
719		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
720		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
721storage:	libdevice libdevinfo libdevid
722sun_fc:		libdevinfo libsysevent
723sun_sas:	libdevinfo libsysevent libkstat libdevid
724udapl:		libdevinfo libdladm
725
726#
727# The reason this rule checks for the existence of the
728# Makefile is that some of the directories do not exist
729# in certain situations (e.g., exportable source builds,
730# OpenSolaris).
731#
732$(SUBDIRS): FRC
733	@if [ -f $@/Makefile  ]; then \
734		cd $@; pwd; $(MAKE) $(TARGET); \
735	else \
736		true; \
737	fi
738
739$(SUBDIRS:%=%-nodepend):
740	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
741		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
742	else \
743		true; \
744	fi
745
746FRC:
747