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