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