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