xref: /titanic_41/usr/src/lib/Makefile (revision 63b4189d887d23563c10f979d5303b207c7c078e)
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	smbsrv		\
257	libilb		\
258	scsi		\
259	libima		\
260	libsun_ima	\
261	mpapi		\
262	librstp		\
263	libreparse	\
264	libhotplug	\
265	libfruutils	.WAIT	\
266	libfru		\
267	$($(MACH)_SUBDIRS)
268
269i386_SUBDIRS=		\
270	libfdisk	\
271	libsaveargs
272
273sparc_SUBDIRS= .WAIT	\
274	efcode		\
275	libds		\
276	libdscp		\
277	libprtdiag	.WAIT	\
278	libprtdiag_psr	\
279	libpri		\
280	librsc		\
281	storage		\
282	libpcp		\
283	libtsalarm	\
284	libv12n
285
286FM_sparc_DEPLIBS= libpri
287
288fm:			\
289	libexacct	\
290	libipmi		\
291	libzfs		\
292	scsi		\
293	$(FM_$(MACH)_DEPLIBS)
294
295#
296# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
297# clean and clobber targets (for more information, see those targets, below).
298#
299NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
300
301DCSUBDIRS =		\
302	lvm
303
304MSGSUBDIRS=		\
305	abi		\
306	auditd_plugins	\
307	brand		\
308	cfgadm_plugins	\
309	gss_mechs/mech_dh	\
310	gss_mechs/mech_krb5	\
311	krb5		\
312	libast		\
313	libbsm		\
314	libc		\
315	libcfgadm	\
316	libcmd		\
317	libcontract	\
318	libcurses	\
319	libdhcputil	\
320	libipsecutil	\
321	libdiskmgt	\
322	libdladm	\
323	libdll		\
324	libgrubmgmt	\
325	libgss		\
326	libidmap	\
327	libipmp		\
328	libilb		\
329	libinetutil	\
330	libinstzones	\
331	libipadm	\
332	libnsl		\
333	libnwam		\
334	libpam		\
335	libpicl		\
336	libpool		\
337	libpkg		\
338	libpp		\
339	libscf		\
340	libsasl		\
341	libldap5	\
342	libsecdb	\
343	libshare	\
344	libshell	\
345	libsldap	\
346	libslp		\
347	libsmbfs	\
348	libsmedia	\
349	libsum		\
350	libtsol		\
351	libuutil	\
352	libvrrpadm	\
353	libvscan	\
354	libwanboot	\
355	libwanbootutil	\
356	libzfs		\
357	libzonecfg	\
358	lvm		\
359	madv		\
360	mpss		\
361	pam_modules	\
362	pyzfs		\
363	pysolaris	\
364	rpcsec_gss	\
365	libreparse
366MSGSUBDIRS += \
367	$($(MACH)_MSGSUBDIRS)
368
369sparc_MSGSUBDIRS=	\
370	libprtdiag	\
371	libprtdiag_psr
372
373i386_MSGSUBDIRS= libfdisk
374
375HDRSUBDIRS=		\
376	auditd_plugins	\
377	libast		\
378	libbrand	\
379	libbsm		\
380	libc		\
381	libcmd		\
382	libcmdutils	\
383	libcommputil	\
384	libcontract	\
385	libcpc		\
386	libctf		\
387	libcurses	\
388	libtermcap	\
389	libcryptoutil	\
390	libdevice	\
391	libdevid	\
392	libdevinfo	\
393	libdiskmgt	\
394	libdladm	\
395	libdll		\
396	libdlpi		\
397	libdhcpagent	\
398	libdhcputil	\
399	libdisasm	\
400	libdns_sd	\
401	libdscfg	\
402	libdtrace	\
403	libdtrace_jni	\
404	libelfsign	\
405	libeti		\
406	libfru		\
407	libfstyp	\
408	libgen		\
409	libipadm	\
410	libipd		\
411	libipsecutil	\
412	libinetsvc	\
413	libinetutil	\
414	libinstzones	\
415	libipmi		\
416	libipmp		\
417	libipp		\
418	libiscsit	\
419	libkstat	\
420	libkvm		\
421	libmail		\
422	libmd		\
423	libmtmalloc	\
424	libndmp		\
425	libnvpair	\
426	libnsctl	\
427	libnsl		\
428	libnwam		\
429	libpam		\
430	libpcidb	\
431	libpctx		\
432	libpicl		\
433	libpicltree	\
434	libpool		\
435	libpp		\
436	libproc		\
437	libraidcfg	\
438	librcm		\
439	librdc		\
440	libscf		\
441	libsip		\
442	libsmbios	\
443	librestart	\
444	librpcsvc	\
445	librsm		\
446	librstp		\
447	libsasl		\
448	libsec		\
449	libshell	\
450	libslp		\
451	libsmedia	\
452	libsocket	\
453	libsqlite	\
454	libfcoe		\
455	libsrpt		\
456	libstmf		\
457	libstmfproxy	\
458	libsum		\
459	libsysevent	\
460	libtecla	\
461	libtnf		\
462	libtnfctl	\
463	libtnfprobe	\
464	libtsnet	\
465	libtsol		\
466	libvrrpadm	\
467	libvolmgt	\
468	libumem		\
469	libunistat	\
470	libuutil	\
471	libwanboot	\
472	libwanbootutil	\
473	libwrap		\
474	libxcurses2	\
475	libzfs		\
476	libzfs_core	\
477	libzfs_jni	\
478	libzoneinfo	\
479	libzonestat	\
480	hal		\
481	policykit	\
482	lvm		\
483	pkcs11		\
484	passwdutil	\
485	../cmd/sendmail/libmilter	\
486	fm		\
487	udapl		\
488	libmapid	\
489	libkrb5		\
490	libsmbfs	\
491	libshare	\
492	libidmap	\
493	libvscan	\
494	libgrubmgmt	\
495	smbsrv		\
496	libilb		\
497	scsi		\
498	hbaapi		\
499	smhba		\
500	libima		\
501	libsun_ima	\
502	mpapi		\
503	libreparse	\
504	$($(MACH)_HDRSUBDIRS)
505
506i386_HDRSUBDIRS=	\
507	libfdisk	\
508	libsaveargs
509
510sparc_HDRSUBDIRS=	\
511	libds		\
512	libdscp		\
513	libpri		\
514	libv12n		\
515	storage
516
517all :=		TARGET= all
518check :=	TARGET= check
519clean :=	TARGET= clean
520clobber :=	TARGET= clobber
521install :=	TARGET= install
522install_h :=	TARGET= install_h
523lint :=		TARGET= lint
524_dc :=		TARGET= _dc
525_msg :=		TARGET= _msg
526
527.KEEP_STATE:
528
529#
530# For the all and install targets, we clearly must respect library
531# dependencies so that the libraries link correctly.  However, for
532# the remaining targets (check, clean, clobber, install_h, lint, _dc
533# and _msg), libraries do not have any dependencies on one another
534# and thus respecting dependencies just slows down the build.
535# As such, for these rules, we use pattern replacement to explicitly
536# avoid triggering the dependency information.  Note that for clean,
537# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
538# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
539#
540
541all:			$(SUBDIRS)
542
543install:		$(SUBDIRS) .WAIT install_extra
544
545# extra libraries kept in other source areas
546install_extra:
547	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
548	@pwd
549
550clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
551
552install_h check:	$(HDRSUBDIRS:%=%-nodepend)
553
554_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
555
556_dc:			$(DCSUBDIRS:%=%-nodepend)
557
558#
559# Library interdependencies are called out explicitly here
560#
561auditd_plugins: libbsm libnsl libsecdb
562gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
563libadt_jni:	libbsm
564libast: 	libsocket libm
565libadutils: 	libldap5 libresolv libsocket libnsl
566nsswitch:	libadutils libidmap
567libbe: 		libzfs
568libbsm:		libtsol
569libcmd: 	libsum libast libsocket libnsl
570libcmdutils:	libavl
571libcontract:	libnvpair
572libdevid:	libdevinfo
573libdevinfo:	libnvpair libsec
574libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
575libdhcputil:	libnsl libgen libinetutil libdlpi
576libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
577		libexacct libnsl libkstat libcurses
578libdll: 	libast
579libdlpi:	libinetutil libdladm
580libds:		libsysevent
581libdscfg:	libnsctl libunistat libsocket libnsl
582libdtrace:	libproc libgen libctf
583libdtrace_jni:	libuutil libdtrace
584libefi:		libuuid
585libfstyp:	libnvpair
586libelfsign:	libcryptoutil libkmf
587libidmap:	libadutils libldap5 libavl libsldap libuutil
588libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
589		libdladm libsecdb
590libiscsit:	libc libnvpair libstmf libuuid libnsl
591libkmf:		libcryptoutil pkcs11
592libm:		libc
593libm1:		libc libm
594libmvec:	libc libm
595libnsl:		libmd5
596libmapid:	libresolv
597librdc:		libsocket libnsl libnsctl libunistat libdscfg
598libuuid:	libdlpi
599libinetutil:	libsocket
600libipsecutil:	libtecla libsocket
601libinstzones:	libzonecfg libcontract
602libpkg:		libwanboot libscf libadm
603libnwam:	libscf
604libsecdb:	libnsl
605libsasl:	libgss libsocket pkcs11 libmd
606sasl_plugins:	pkcs11 libgss libsocket libsasl
607libsctp:	libsocket
608libshell:	libast libcmd libdll libsocket libsecdb libm
609libsip:		libmd5
610libsmbfs:	libcmdutils libsocket libnsl libkrb5
611libsocket:	libnsl
612libstmfproxy: 	libstmf libsocket libnsl libpthread
613libsum: 	libast
614libsysevent:	libsecdb
615libldap5:	libsasl libsocket libnsl libmd
616libsldap:	libldap5 libtsol libnsl libc libscf libresolv
617libpool:	libnvpair libexacct
618libpp:		libast
619libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
620		libbrand libpool libscf
621libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
622libproject:	libpool libproc libsecdb
623libtermcap:	libcurses
624libtsnet:	libnsl libtsol libsecdb
625libwrap:	libnsl libsocket
626libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
627		libdhcputil
628libwanbootutil:	libnsl
629pam_modules:	libproject passwdutil smbsrv
630libscf:		libuutil libmd libgen libsmbios libnsl
631libinetsvc:	libscf
632librestart:	libuutil libscf
633libsaveargs:	libdisasm
634../cmd/sgs/libdl:	../cmd/sgs/libconv
635../cmd/sgs/libelf:	../cmd/sgs/libconv
636pkcs11:		libcryptoutil
637print:		libldap5
638udapl/udapl_tavor:	udapl/libdat
639libzfs:		libdevid libgen libnvpair libuutil \
640		libadm libavl libefi libidmap libmd libzfs_core libm
641libzfs_core:	libnvpair
642libzfs_jni:	libdiskmgt libnvpair libzfs
643libzpool:	libavl libumem libnvpair libcmdutils
644libsec:		libavl libidmap
645brand:		libc libsocket
646libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
647libexacct/demo:	libexacct libproject libsocket libnsl
648libtsalarm:	libpcp
649smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
650		libshare libidmap pkcs11 libsqlite libcryptoutil \
651		libreparse libcmdutils
652libv12n:	libds libuuid
653libvrrpadm:	libsocket libdladm libscf
654libvscan:	libscf
655libfru:		libfruutils
656scsi:		libnvpair libfru
657mpapi:		libpthread libdevinfo libsysevent libnvpair
658sun_fc:		libdevinfo libsysevent libnvpair
659libsun_ima:	libdevinfo libsysevent libnsl
660sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
661libgrubmgmt:	libdevinfo libzfs libfstyp
662pylibbe: 	libbe libzfs
663pyzfs:		libnvpair libzfs
664pysolaris:	libsec libidmap
665libreparse:	libnvpair
666libhotplug:	libnvpair
667cfgadm_plugins:	libhotplug
668libilb:		libsocket
669libipmi:	libm
670libprtdiag:	libm
671libsqlite:	libm
672libstmf:	libm
673libvscan: 	libm
674
675
676$(INTEL_BUILD)libdiskmgt:libfdisk
677
678#
679# The reason this rule checks for the existence of the
680# Makefile is that some of the directories do not exist
681# in certain situations (e.g., exportable source builds,
682# OpenSolaris).
683#
684$(SUBDIRS): FRC
685	@if [ -f $@/Makefile  ]; then \
686		cd $@; pwd; $(MAKE) $(TARGET); \
687	else \
688		true; \
689	fi
690
691$(SUBDIRS:%=%-nodepend):
692	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
693		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
694	else \
695		true; \
696	fi
697
698FRC:
699