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