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