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