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