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