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