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