xref: /titanic_51/usr/src/lib/Makefile (revision f936286c99fb83153e4bfd870eb2830a990a82c1)
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 2017 Nexenta Systems, Inc.
30#
31
32include ../Makefile.master
33
34#	Note that libcurses installs commands along with its library.
35#	This is a minor bug which probably should be fixed.
36#	Note also that a few extra libraries are kept in cmd source.
37#
38# Certain libraries are linked with, hence depend on, other libraries.
39# Library dependencies are called out explicitly, see "Library
40# interdependencies" below.
41.PARALLEL:
42
43# Build libc and its dependencies
44SUBDIRS=			\
45	crt			\
46	../cmd/sgs/libconv	\
47	../cmd/sgs/libdl	\
48	libc			\
49	.WAIT
50
51# Build libraries with lots of dependents
52SUBDIRS +=		\
53	libm		\
54	libmd		\
55	libmp		\
56	libnsl		\
57	libnvpair	\
58	libsocket	\
59	.WAIT
60
61# Build everything else. Aside from explicit dependencies, all libraries
62# are built in parallel.
63SUBDIRS +=				\
64	../cmd/sendmail/libmilter	\
65	../cmd/sgs/libelf	\
66	../cmd/sgs/librtld_db	\
67	abi		\
68	auditd_plugins	\
69	brand		\
70	c_synonyms	\
71	cfgadm_plugins	\
72	crypt_modules	\
73	extendedFILE	\
74	fm		\
75	getloginx	\
76	gss_mechs/mech_dh	\
77	gss_mechs/mech_dummy	\
78	gss_mechs/mech_krb5	\
79	gss_mechs/mech_spnego	\
80	hal		\
81	hbaapi		\
82	iconv_modules	\
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	libcustr	\
107	libdevice	\
108	libdevid	\
109	libdevinfo	\
110	libdhcpagent	\
111	libdhcputil	\
112	libdisasm	\
113	libdiskmgt	\
114	libdladm	\
115	libdll		\
116	libdlpi		\
117	libdns_sd	\
118	libdoor		\
119	libdscfg	\
120	libdtrace	\
121	libdtrace_jni	\
122	libefi		\
123	libelfsign	\
124	libeti		\
125	libexacct	\
126	libexacct/demo	\
127	libfakekernel	\
128	libfcoe		\
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	libjedec	\
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	libmtmalloc	\
166	libmvec		\
167	libndmp		\
168	libnisdb	\
169	libnls		\
170	libnsctl	\
171	libnwam		\
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	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	libunistat	\
228	libuuid		\
229	libuutil	\
230	libvolmgt	\
231	libvrrpadm	\
232	libvscan	\
233	libw		\
234	libwanboot	\
235	libwanbootutil	\
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	libinetutil	\
322	libinstzones	\
323	libipadm	\
324	libipmp		\
325	libipsecutil	\
326	libldap5	\
327	libnsl		\
328	libnwam		\
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	libwanboot	\
350	libwanbootutil	\
351	libzfs		\
352	libzonecfg	\
353	madv		\
354	mpss		\
355	pam_modules	\
356	pyzfs		\
357	rpcsec_gss	\
358	$($(MACH)_MSGSUBDIRS)
359
360sparc_MSGSUBDIRS=	\
361	libprtdiag	\
362	libprtdiag_psr
363
364i386_MSGSUBDIRS= libfdisk
365
366HDRSUBDIRS=				\
367	../cmd/sendmail/libmilter	\
368	auditd_plugins	\
369	fm		\
370	hal		\
371	hbaapi		\
372	libads		\
373	libast		\
374	libbrand	\
375	libbsm		\
376	libc		\
377	libcmd		\
378	libcmdutils	\
379	libcommputil	\
380	libcontract	\
381	libcpc		\
382	libcryptoutil	\
383	libctf		\
384	libcurses	\
385	libcustr	\
386	libdevice	\
387	libdevid	\
388	libdevinfo	\
389	libdhcpagent	\
390	libdhcputil	\
391	libdisasm	\
392	libdiskmgt	\
393	libdladm	\
394	libdll		\
395	libdlpi		\
396	libdns_sd	\
397	libdscfg	\
398	libdtrace	\
399	libdtrace_jni	\
400	libelfsign	\
401	libeti		\
402	libfakekernel	\
403	libfcoe		\
404	libfru		\
405	libfstyp	\
406	libgen		\
407	libgrubmgmt	\
408	libidmap	\
409	libilb		\
410	libima		\
411	libinetsvc	\
412	libinetutil	\
413	libinstzones	\
414	libipadm	\
415	libipd		\
416	libipmi		\
417	libipmp		\
418	libipp		\
419	libipsecutil	\
420	libiscsit	\
421	libkrb5		\
422	libkstat	\
423	libkvm		\
424	libmail		\
425	libmapid	\
426	libmd		\
427	libmtmalloc	\
428	libndmp		\
429	libnsctl	\
430	libnsl		\
431	libnvpair	\
432	libnwam		\
433	libpam		\
434	libpcidb	\
435	libpctx		\
436	libpicl		\
437	libpicltree	\
438	libpool		\
439	libpp		\
440	libproc		\
441	libraidcfg	\
442	librcm		\
443	librdc		\
444	libreparse	\
445	librestart	\
446	librpcsvc	\
447	librsm		\
448	librstp		\
449	libsasl		\
450	libscf		\
451	libsec		\
452	libsff		\
453	libshare	\
454	libshell	\
455	libsip		\
456	libslp		\
457	libsmbfs	\
458	libsmbios	\
459	libsmedia	\
460	libsocket	\
461	libsqlite	\
462	libsrpt		\
463	libstmf		\
464	libstmfproxy	\
465	libsum		\
466	libsun_ima	\
467	libsysevent	\
468	libtecla	\
469	libtermcap	\
470	libtnf		\
471	libtnfctl	\
472	libtnfprobe	\
473	libtsnet	\
474	libtsol		\
475	libumem		\
476	libunistat	\
477	libuutil	\
478	libvolmgt	\
479	libvrrpadm	\
480	libvscan	\
481	libwanboot	\
482	libwanbootutil	\
483	libwrap		\
484	libxcurses2	\
485	libzfs		\
486	libzfs_core	\
487	libzfs_jni	\
488	libzoneinfo	\
489	libzonestat	\
490	mpapi		\
491	passwdutil	\
492	pkcs11		\
493	policykit	\
494	scsi		\
495	smbsrv		\
496	smhba		\
497	udapl		\
498	$($(MACH)_HDRSUBDIRS)
499
500i386_HDRSUBDIRS=	\
501	libfdisk	\
502	libsaveargs
503
504sparc_HDRSUBDIRS=	\
505	libds		\
506	libdscp		\
507	libpri		\
508	libv12n		\
509	storage
510
511all :=		TARGET= all
512check :=	TARGET= check
513clean :=	TARGET= clean
514clobber :=	TARGET= clobber
515install :=	TARGET= install
516install_h :=	TARGET= install_h
517lint :=		TARGET= lint
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, lint, _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,
531# clobber and lint, 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 lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
545
546install_h check:	$(HDRSUBDIRS:%=%-nodepend)
547
548_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
549
550_dc:			$(DCSUBDIRS:%=%-nodepend)
551
552# Library interdependencies are called out explicitly here.
553../cmd/sgs/libconv: crt
554../cmd/sgs/libdl: crt
555libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
556
557libm:		libc
558libmd:		libc
559libmp:		libc
560libnsl:		libc libmd libmp
561libnvpair:	libc libnsl
562libsocket:	libc libnsl
563
564basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
565basedeps :=	TARGET=install
566
567# The following dependencies are currently required by libdbus-1 and should
568# be used for anything linking against it.
569dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
570
571# The following dependencies don't need to be listed below as they are built
572# before everything else:
573# libc libm libmd libmp libnsl libnvpair libsocket
574abi:		libctf libmapmalloc libproc
575auditd_plugins: libbsm libsecdb libgss libmtmalloc
576brand:		libzonecfg libmapmalloc
577cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
578fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
579		libcontract libsysevent ../cmd/sgs/libelf libdladm
580$(SPARC_BLD)fm:	libpri
581gss_mechs/mech_dh: libgss
582gss_mechs/mech_dummy: libgss
583gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
584gss_mechs/mech_spnego: gss_mechs/mech_krb5
585hal:		dbusdeps
586krb5:		gss_mechs/mech_krb5 libtecla libldap5
587libadt_jni:	libbsm
588libadutils: 	libldap5 libresolv2
589libbe: 		libzfs libinstzones libuuid libgen libdevinfo libefi
590libbsm:		libinetutil libscf libsecdb libtsol
591libcfgadm:	libdevinfo
592libcmd: 	libsum libast
593libcmdutils:	libavl
594libcpc:		libpctx
595libcrypt:	libgen
596libdevid:	libdevinfo
597libdevinfo:	libsec libgen
598libdhcpagent:	libdhcputil libuuid libdlpi libcontract
599libdhcputil:	libgen libinetutil libdlpi
600libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
601$(INTEL_BLD)libdiskmgt: libfdisk
602libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
603		libpool
604libdll: 	libast
605libdlpi:	libinetutil libdladm
606libds:		libsysevent
607libdscfg:	libnsctl libunistat libadm
608libdtrace:	libproc libgen libctf libmapmalloc
609libdtrace_jni:	libuutil libdtrace
610libefi:		libuuid
611libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
612libeti:		libcurses
613libexacct/demo:	libexacct libproject
614libfakekernel:	libumem libcryptoutil
615libfcoe:	libdladm
616libfru:		libfruutils
617libfsmgt:	libkstat
618libgrubmgmt:	libdevinfo libzfs libfstyp libefi
619$(INTEL_BLD)libgrubmgmt: libfdisk
620libidmap:	libavl libuutil
621libinetsvc:	libscf
622libinstzones:	libzonecfg libcontract
623libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb
624libipmp:	libinetutil
625libipsecutil:	libtecla libtsol
626libiscsit:	libstmf libuuid
627libkmf:		libcryptoutil pkcs11
628libkvm:		../cmd/sgs/libelf
629libldap5:	libsasl
630libmapid:	libresolv2 libscf
631libndmp:	libscf
632libnisdb:	libldap5
633libnwam:	libscf libbsm libdladm
634libpcp:		libumem libdevinfo
635libpctx:	libproc
636libpkg:		libwanboot libscf libadm
637libpool:	libscf libexacct
638libpp:		libast
639libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
640$(INTEL_BLD)libproc: libsaveargs
641libproject:	libpool libproc libsecdb
642libprtdiag:	libkstat
643libprtdiag_psr:	libprtdiag
644libraidcfg:	libdevinfo
645librdc:		libnsctl libunistat libdscfg
646librestart:	libuutil libscf libpool libproject libsecdb libsysevent
647libsasl:	libgss pkcs11
648libsaveargs:	libdisasm
649libscf:		libuutil libgen libsmbios
650libsec:		libavl libidmap
651libsff:		libnvpair
652libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
653libshell:	libast libcmd libdll libsecdb
654libsip:		libmd5
655libsldap:	libldap5 libscf
656libsmbfs:	libkrb5 libsec libidmap pkcs11
657libsmbios:	libdevinfo
658libsrpt:	libstmf
659libstmf:	libscf
660libstmfproxy: 	libstmf libpthread
661libsum: 	libast
662libsun_ima:	libdevinfo libsysevent
663libsysevent:	libsecdb
664libtecla:	libcurses
665libtermcap:	libcurses
666libtnfctl:	../cmd/sgs/libelf
667libtsalarm:	libpcp
668libtsnet:	libtsol libsecdb
669libtsol:	libsecdb
670libuuid:	libdlpi
671libv12n:	libds libuuid
672libvolmgt:	libadm
673libvrrpadm:	libdladm libscf
674libvscan:	libscf libsecdb
675libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
676libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
677		libumem libtsol libzfs_core
678libzfs_jni:	libdiskmgt libzfs
679libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
680		libuutil libbsm libsecdb
681libzonestat:	libcmdutils libumem
682libzpool:	libavl libumem libcmdutils libsysevent
683madv:		libgen
684mpapi:		libpthread libdevinfo libsysevent
685mpss:		libgen
686nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
687pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
688passwdutil:	libsldap
689pkcs11:		libcryptoutil libgen libuuid
690policykit:	dbusdeps
691print:		libldap5 libmd5 libsendfile
692pylibbe: 	libbe libzfs
693pysolaris:	libsec libidmap
694pyzfs:		libzfs
695raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
696rpcsec_gss:	libgss
697sasl_plugins:	pkcs11 libgss libsasl
698scsi:		libfru libumem libdevid libdevinfo
699smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
700		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
701		libuuid libfakekernel libads libgss libldap5 krb5
702storage:	libdevice libdevinfo libdevid
703sun_fc:		libdevinfo libsysevent
704sun_sas:	libdevinfo libsysevent libkstat libdevid
705udapl:		libdevinfo libdladm
706
707#
708# The reason this rule checks for the existence of the
709# Makefile is that some of the directories do not exist
710# in certain situations (e.g., exportable source builds,
711# OpenSolaris).
712#
713$(SUBDIRS): FRC
714	@if [ -f $@/Makefile  ]; then \
715		cd $@; pwd; $(MAKE) $(TARGET); \
716	else \
717		true; \
718	fi
719
720$(SUBDIRS:%=%-nodepend):
721	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
722		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
723	else \
724		true; \
725	fi
726
727FRC:
728