xref: /titanic_50/usr/src/lib/Makefile (revision 16b7b96c6c25948273527a97ec0d3e2c803ad3f4)
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
25include ../Makefile.master
26
27#	Note that libcurses installs commands along with its library.
28#	This is a minor bug which probably should be fixed.
29#	Note also that a few extra libraries are kept in cmd source.
30#
31# Certain libraries are linked with, hence depend on, other libraries.
32#
33# Although we have historically used .WAIT to express dependencies, it
34# reduces the amount of parallelism and thus lengthens the time it
35# takes to build the libraries.  Thus, we now require that any new
36# libraries explicitly call out their dependencies.  Eventually, all
37# the library dependencies will be called out explicitly.  See
38# "Library interdependencies" near the end of this file.
39#
40# Aside from explicit dependencies (and legacy .WAITs), all libraries
41# are built in parallel.
42#
43.PARALLEL:
44
45#
46# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
47# but required due to the "dependencies" of using .WAIT to barrier the
48# parallel dmake builds.  once 4631488 has been fixed, they can be
49# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
50# shown in HDRSUBDIRS
51#
52SUBDIRS= \
53	common			.WAIT	\
54	../cmd/sgs/libconv		\
55	../cmd/sgs/libdl	.WAIT
56
57SUBDIRS += \
58	libc			.WAIT	\
59	../cmd/sgs/libelf	.WAIT	\
60	c_synonyms			\
61	libmd				\
62	libmd5				\
63	librsm				\
64	libmp			.WAIT	\
65	libnsl			\
66	libsecdb		.WAIT	\
67	librpcsvc			\
68	libsocket		.WAIT	\
69	libsctp			\
70	libsip			\
71	libcommputil		\
72	libresolv			\
73	libresolv2		.WAIT	\
74	libw			.WAIT	\
75	libintl			.WAIT	\
76	../cmd/sgs/librtld_db	\
77	libaio			\
78	libast			\
79	libdll			\
80	libcmd			\
81	libshell		\
82	libsum			\
83	librt			\
84	libadm			\
85	libctf			\
86	libdtrace		\
87	libdtrace_jni		\
88	libcurses		\
89	libtermcap		\
90	libgen			\
91	libgss			\
92	libpam			\
93	libuuid			\
94	libthread		\
95	libpthread	.WAIT	\
96	libslp		\
97	libbsdmalloc	\
98	libdoor		\
99	libdevinfo	\
100	libdladm	\
101	libdlpi		\
102	libeti		\
103	libcrypt	\
104	libdns_sd	\
105	libefi		\
106	libfstyp	\
107	libwanboot	\
108	libwanbootutil	\
109	libcryptoutil	\
110	libinetutil	\
111	libipadm	\
112	libipmp		\
113	libiscsit	\
114	libkmf		\
115	libkstat	\
116	libkvm		\
117	liblm		\
118	libmalloc	\
119	libmapmalloc	\
120	libmtmalloc	\
121	libnls		\
122	libnwam		\
123	libsmbios	\
124	libtecla	\
125	libumem		\
126	libnvpair	.WAIT	\
127	libexacct	\
128	libldap4	\
129	libsasl		\
130	libldap5	\
131	libsldap	.WAIT	\
132	libbsm		\
133	libsys		\
134	libsysevent	\
135	libnisdb	\
136	libpool		\
137	libpp		\
138	libproc		\
139	libproject	\
140	libsendfile	\
141	nametoaddr	\
142	ncad_addr	\
143	hbaapi		\
144	smhba		\
145	sun_fc		\
146	sun_sas		\
147	gss_mechs/mech_krb5	.WAIT	\
148	libkrb5	.WAIT	\
149	krb5	.WAIT	\
150	libsmbfs	\
151	libfcoe		\
152	libsrpt		\
153	libstmf		\
154	libstmfproxy	\
155	libnsctl	\
156	libunistat	\
157	libdscfg	\
158	librdc		\
159	libinstzones	\
160	libpkg
161
162SUBDIRS += \
163	passwdutil	\
164	pam_modules	\
165	crypt_modules	\
166	libadt_jni	\
167	abi		\
168	auditd_plugins	\
169	libvolmgt	\
170	libdevice	\
171	libdevid	\
172	libdhcpsvc	\
173	libc_db		\
174	libndmp		\
175	libsec		\
176	libtnfprobe	\
177	libtnf		\
178	libtnfctl	\
179	libdhcpagent	\
180	libdhcpdu	\
181	libdhcputil	\
182	libxnet		\
183	libipsecutil
184$(CLOSED_BUILD)SUBDIRS += \
185	$(CLOSED)/lib/libike
186SUBDIRS += \
187	nsswitch	\
188	print		\
189	libuutil	\
190	libscf		\
191	libinetsvc	\
192	librestart	\
193	libsched	\
194	libelfsign	\
195	pkcs11		.WAIT	\
196	libpctx		.WAIT	\
197	libcpc		\
198	watchmalloc	\
199	extendedFILE	\
200	madv		\
201	mpss		\
202	libdisasm	\
203	libwrap		\
204	libxcurses	\
205	libxcurses2	\
206	libbrand	.WAIT   \
207	libzonecfg	\
208	libzoneinfo	\
209	libzonestat	\
210	libtsnet	\
211	libtsol		\
212	gss_mechs/mech_spnego	\
213	gss_mechs/mech_dummy	\
214	gss_mechs/mech_dh	\
215	rpcsec_gss	\
216	libraidcfg	.WAIT	\
217	librcm		.WAIT	\
218	libcfgadm	.WAIT	\
219	libpicl		.WAIT	\
220	libpicltree	.WAIT \
221	raidcfg_plugins	\
222	cfgadm_plugins	\
223	libmail		\
224	lvm		\
225	libsmedia	\
226	libipp		\
227	libdiskmgt	\
228	liblgrp		\
229	libfsmgt	\
230	fm		\
231	libavl		\
232	libcmdutils	\
233	libcontract	\
234	../cmd/sendmail/libmilter	\
235	sasl_plugins	\
236	udapl		\
237	libzpool	\
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	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	libntfs		\
272	libparted	\
273	libfdisk
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	libdhcpsvc 	\
322	libdhcputil	\
323	libipsecutil	\
324	libdiskmgt	\
325	libdladm	\
326	libdll		\
327	libgrubmgmt	\
328	libgss		\
329	libidmap	\
330	libipmp		\
331	libilb		\
332	libinetutil	\
333	libinstzones	\
334	libipadm	\
335	libnsl		\
336	libnwam		\
337	libpam		\
338	libpicl		\
339	libpool		\
340	libpkg		\
341	libpp		\
342	libscf		\
343	libsasl		\
344	libldap5	\
345	libsecdb	\
346	libshare	\
347	libshell	\
348	libsldap	\
349	libslp		\
350	libsmbfs	\
351	libsmedia	\
352	libsum		\
353	libtsol		\
354	libuutil	\
355	libvrrpadm	\
356	libvscan	\
357	libwanboot	\
358	libwanbootutil	\
359	libzfs		\
360	libzonecfg	\
361	lvm		\
362	madv		\
363	mpss		\
364	pam_modules	\
365	pyzfs		\
366	pysolaris	\
367	rpcsec_gss	\
368	libreparse
369MSGSUBDIRS += \
370	$($(MACH)_MSGSUBDIRS)
371
372sparc_MSGSUBDIRS=	\
373	libprtdiag	\
374	libprtdiag_psr
375
376i386_MSGSUBDIRS= libfdisk
377
378HDRSUBDIRS=		\
379	auditd_plugins	\
380	libast		\
381	libbrand	\
382	libbsm		\
383	libc		\
384	libcmd		\
385	libcmdutils	\
386	libcommputil	\
387	libcontract	\
388	libcpc		\
389	libctf		\
390	libcurses	\
391	libtermcap	\
392	libcryptoutil	\
393	libdevice	\
394	libdevid	\
395	libdevinfo	\
396	libdiskmgt	\
397	libdladm	\
398	libdll		\
399	libdlpi		\
400	libdhcpagent	\
401	libdhcpsvc	\
402	libdhcputil	\
403	libdisasm	\
404	libdns_sd	\
405	libdscfg	\
406	libdtrace	\
407	libdtrace_jni	\
408	libelfsign	\
409	libeti		\
410	libfru		\
411	libfstyp	\
412	libgen		\
413	libipadm	\
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	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_jni	\
479	libzoneinfo	\
480	libzonestat	\
481	hal		\
482	policykit	\
483	lvm		\
484	pkcs11		\
485	passwdutil	\
486	../cmd/sendmail/libmilter	\
487	fm		\
488	udapl		\
489	libmapid	\
490	libkrb5		\
491	libsmbfs	\
492	libshare	\
493	libidmap	\
494	libvscan	\
495	libgrubmgmt	\
496	smbsrv		\
497	libilb		\
498	scsi		\
499	hbaapi		\
500	smhba		\
501	libima		\
502	libsun_ima	\
503	mpapi		\
504	libreparse	\
505	$($(MACH)_HDRSUBDIRS)
506
507$(CLOSED_BUILD)HDRSUBDIRS += \
508	$(CLOSED)/lib/libike
509
510i386_HDRSUBDIRS=	\
511	libparted	\
512	libfdisk
513
514sparc_HDRSUBDIRS=	\
515	libds		\
516	libdscp		\
517	libpri		\
518	libv12n		\
519	storage
520
521all :=		TARGET= all
522check :=	TARGET= check
523clean :=	TARGET= clean
524clobber :=	TARGET= clobber
525install :=	TARGET= install
526install_h :=	TARGET= install_h
527lint :=		TARGET= lint
528_dc :=		TARGET= _dc
529_msg :=		TARGET= _msg
530
531.KEEP_STATE:
532
533#
534# For the all and install targets, we clearly must respect library
535# dependencies so that the libraries link correctly.  However, for
536# the remaining targets (check, clean, clobber, install_h, lint, _dc
537# and _msg), libraries do not have any dependencies on one another
538# and thus respecting dependencies just slows down the build.
539# As such, for these rules, we use pattern replacement to explicitly
540# avoid triggering the dependency information.  Note that for clean,
541# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
542# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
543#
544
545all:			$(SUBDIRS)
546
547install:		$(SUBDIRS) .WAIT install_extra
548
549# extra libraries kept in other source areas
550install_extra:
551	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
552	@pwd
553
554clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
555
556install_h check:	$(HDRSUBDIRS:%=%-nodepend)
557
558_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
559
560_dc:			$(DCSUBDIRS:%=%-nodepend)
561
562#
563# Library interdependencies are called out explicitly here
564#
565auditd_plugins: libbsm libnsl libsecdb
566gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
567libadt_jni:	libbsm
568libast: 	libsocket
569libadutils: 	libldap5 libresolv libsocket libnsl
570nsswitch:	libadutils libidmap
571libbe: 		libzfs
572libbsm:		libtsol
573libcmd: 	libsum libast libsocket libnsl
574libcmdutils:	libavl
575libcontract:	libnvpair
576libdevid:	libdevinfo
577libdevinfo:	libnvpair libsec
578libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
579libdhcpsvc:	libinetutil
580libdhcputil:	libnsl libgen libinetutil libdlpi
581libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
582		libexacct libnsl libkstat libcurses
583libdll: 	libast
584libdlpi:	libinetutil libdladm
585libds:		libsysevent
586libdscfg:	libnsctl libunistat libsocket libnsl
587libdtrace:	libproc libgen libctf
588libdtrace_jni:	libuutil libdtrace
589libefi:		libuuid
590libfstyp:	libnvpair
591libelfsign:	libcryptoutil libkmf
592libidmap:	libadutils libldap5 libavl libsldap libuutil
593libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
594		libdladm libsecdb
595libiscsit:	libc libnvpair libstmf libuuid libnsl
596libkmf:		libcryptoutil pkcs11
597libnsl:		libmd5
598libmapid:	libresolv
599librdc:		libsocket libnsl libnsctl libunistat libdscfg
600libuuid:	libdlpi
601$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
602libinetutil:	libsocket
603libipsecutil:	libtecla libsocket
604libinstzones:	libzonecfg libcontract
605libpkg:		libwanboot libscf libadm
606libnwam:	libscf
607libsecdb:	libnsl
608libsasl:	libgss libsocket pkcs11 libmd
609sasl_plugins:	pkcs11 libgss libsocket libsasl
610libsctp:	libsocket
611libshell:	libast libcmd libdll libsocket libsecdb
612libsip:		libmd5
613libsmbfs:	libcmdutils libsocket libnsl libkrb5
614libsocket:	libnsl
615libstmfproxy: 	libstmf libsocket libnsl libpthread
616libsum: 	libast
617libsysevent:	libsecdb
618libldap5:	libsasl libsocket libnsl libmd
619libsldap:	libldap5 libtsol libnsl libc libscf libresolv
620libpool:	libnvpair libexacct
621libpp:		libast
622libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
623		libbrand libpool libscf
624libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
625libproject:	libpool libproc libsecdb
626libtermcap:	libcurses
627libtsnet:	libnsl libtsol libsecdb
628libwrap:	libnsl libsocket
629libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
630		libdhcputil
631libwanbootutil:	libnsl
632pam_modules:	libproject passwdutil smbsrv
633libscf:		libuutil libmd libgen libsmbios libnsl
634libinetsvc:	libscf
635librestart:	libuutil libscf
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
643libzfs_jni:	libdiskmgt libnvpair libzfs
644libzpool:	libavl libumem libnvpair libcmdutils
645libsec:		libavl libidmap
646brand:		libc libsocket
647libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
648libexacct/demo:	libexacct libproject libsocket libnsl
649libtsalarm:	libpcp
650smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
651		libshare libidmap pkcs11 libsqlite libcryptoutil \
652		libreparse libcmdutils
653libv12n:	libds libuuid
654libvrrpadm:	libsocket libdladm libscf
655libvscan:	libscf
656libfru:		libfruutils
657scsi:		libnvpair libfru
658mpapi:		libpthread libdevinfo libsysevent libnvpair
659sun_fc:		libdevinfo libsysevent libnvpair
660libsun_ima:	libdevinfo libsysevent libnsl
661sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
662libgrubmgmt:	libdevinfo libzfs libfstyp
663pylibbe: 	libbe libzfs
664pyzfs:		libnvpair libzfs
665pysolaris:	libsec libidmap
666libreparse:	libnvpair
667libhotplug:	libnvpair
668cfgadm_plugins:	libhotplug
669libilb:		libsocket
670$(INTEL_BUILD)libdiskmgt:libfdisk
671
672#
673# The reason this rule checks for the existence of the
674# Makefile is that some of the directories do not exist
675# in certain situations (e.g., exportable source builds,
676# OpenSolaris).
677#
678$(SUBDIRS): FRC
679	@if [ -f $@/Makefile  ]; then \
680		cd $@; pwd; $(MAKE) $(TARGET); \
681	else \
682		true; \
683	fi
684
685$(SUBDIRS:%=%-nodepend):
686	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
687		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
688	else \
689		true; \
690	fi
691
692FRC:
693