xref: /titanic_44/usr/src/lib/Makefile (revision 6ba597c56d749c61b4f783157f63196d7b2445f0)
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 2010 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26include ../Makefile.master
27
28#	Note that libcurses installs commands along with its library.
29#	This is a minor bug which probably should be fixed.
30#	Note also that a few extra libraries are kept in cmd source.
31#
32# Certain libraries are linked with, hence depend on, other libraries.
33#
34# Although we have historically used .WAIT to express dependencies, it
35# reduces the amount of parallelism and thus lengthens the time it
36# takes to build the libraries.  Thus, we now require that any new
37# libraries explicitly call out their dependencies.  Eventually, all
38# the library dependencies will be called out explicitly.  See
39# "Library interdependencies" near the end of this file.
40#
41# Aside from explicit dependencies (and legacy .WAITs), all libraries
42# are built in parallel.
43#
44.PARALLEL:
45
46#
47# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
48# but required due to the "dependencies" of using .WAIT to barrier the
49# parallel dmake builds.  once 4631488 has been fixed, they can be
50# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
51# shown in HDRSUBDIRS
52#
53SUBDIRS= \
54	common			.WAIT	\
55	../cmd/sgs/libconv		\
56	../cmd/sgs/libdl	.WAIT
57
58$(CLOSED_BUILD)SUBDIRS += \
59	$(CLOSED)/lib/libc_i18n
60
61SUBDIRS += \
62	libc			.WAIT	\
63	../cmd/sgs/libelf	.WAIT	\
64	c_synonyms			\
65	libmd				\
66	libmd5				\
67	librsm				\
68	libmp			.WAIT	\
69	libnsl			\
70	libsecdb		.WAIT	\
71	librpcsvc			\
72	libsocket		.WAIT	\
73	libsctp			\
74	libsip			\
75	libcommputil		\
76	libresolv			\
77	libresolv2		.WAIT	\
78	libw			.WAIT	\
79	libintl			.WAIT	\
80	../cmd/sgs/librtld_db	\
81	libaio			\
82	libast			\
83	libdll			\
84	libcmd			\
85	libshell		\
86	libsum			\
87	librt			\
88	libadm			\
89	libctf			\
90	libdtrace		\
91	libdtrace_jni		\
92	libcurses		\
93	libgen			\
94	libgss			\
95	libpam			\
96	libuuid			\
97	libthread		\
98	libpthread	.WAIT	\
99	libslp		\
100	libbsdmalloc	\
101	libdoor		\
102	libdevinfo	\
103	libdladm	\
104	libdlpi		\
105	libeti		\
106	libcrypt	\
107	libdns_sd	\
108	libefi		\
109	libfstyp	\
110	libwanboot	\
111	libwanbootutil	\
112	libcryptoutil	\
113	libinetcfg	\
114	libinetutil	\
115	libipmp		\
116	libiscsit	\
117	libiscsitgt	\
118	libkmf		\
119	libkstat	\
120	libkvm		\
121	liblm		\
122	libmalloc	\
123	libmapmalloc	\
124	libmtmalloc	\
125	libnls		\
126	libnwam		\
127	libsmbios	\
128	libtecla	\
129	libumem		\
130	libnvpair	.WAIT	\
131	libexacct	\
132	libplot		\
133	libldap4	\
134	libsasl		\
135	libldap5	\
136	libsldap	.WAIT	\
137	libbsm		\
138	libsys		\
139	libsysevent	\
140	libnisdb	\
141	libpool		\
142	libpp		\
143	libproc		\
144	libproject	\
145	libsendfile	\
146	nametoaddr	\
147	ncad_addr	\
148	hbaapi		\
149	smhba		\
150	sun_fc		\
151	sun_sas		\
152	gss_mechs/mech_krb5	.WAIT	\
153	libkrb5	.WAIT	\
154	krb5	.WAIT	\
155	libsmbfs	\
156	libfcoe		\
157	libstmf		\
158	libstmfproxy	\
159	libnsctl	\
160	libunistat	\
161	libdscfg	\
162	librdc		\
163	libinstzones	\
164	libpkg
165
166SUBDIRS += \
167	passwdutil	\
168	pam_modules	\
169	crypt_modules	\
170	libadt_jni	\
171	abi		\
172	auditd_plugins	\
173	libvolmgt	\
174	libdevice	\
175	libdevid	\
176	libdhcpsvc	\
177	libc_db		\
178	libndmp		\
179	libsec		\
180	libtnfprobe	\
181	libtnf		\
182	libtnfctl	\
183	libdhcpagent	\
184	libdhcpdu	\
185	libdhcputil	\
186	libxnet		\
187	libipsecutil
188$(CLOSED_BUILD)SUBDIRS += \
189	$(CLOSED)/lib/libike
190SUBDIRS += \
191	nsswitch	\
192	print		\
193	libuutil	\
194	libscf		\
195	libinetsvc	\
196	librestart	\
197	libsched	\
198	libelfsign	\
199	pkcs11		.WAIT	\
200	libpctx		.WAIT	\
201	libcpc		\
202	watchmalloc	\
203	extendedFILE	\
204	madv		\
205	mpss		\
206	libdisasm	\
207	libwrap		\
208	libxcurses	\
209	libxcurses2	\
210	libbrand	.WAIT   \
211	libzonecfg	\
212	libzoneinfo	\
213	libtsnet	\
214	libtsol		\
215	gss_mechs/mech_spnego	\
216	gss_mechs/mech_dummy	\
217	gss_mechs/mech_dh	\
218	rpcsec_gss	\
219	libraidcfg	.WAIT	\
220	librcm		.WAIT	\
221	libcfgadm	.WAIT	\
222	libpicl		.WAIT	\
223	libpicltree	.WAIT \
224	raidcfg_plugins	\
225	cfgadm_plugins	\
226	libmail		\
227	lvm		\
228	libsmedia	\
229	libipp		\
230	libdiskmgt	\
231	liblgrp		\
232	libfsmgt	\
233	fm		\
234	libavl		\
235	libcmdutils	\
236	libcontract	\
237	../cmd/sendmail/libmilter	\
238	sasl_plugins	\
239	udapl		\
240	libzpool	\
241	libzfs		\
242	libzfs_jni	\
243	pyzfs		\
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	mms		\
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	libntfs		\
273	libparted	\
274	libfdisk
275
276sparc_SUBDIRS= .WAIT	\
277	efcode		\
278	libc_psr	.WAIT	\
279	libds		\
280	libdscp		\
281	libprtdiag	.WAIT	\
282	libprtdiag_psr	\
283	libpri		\
284	librsc		\
285	storage		\
286	libpcp		\
287	libtsalarm
288
289FM_sparc_DEPLIBS= libpri
290
291fm:			\
292	libexacct	\
293	libipmi		\
294	libzfs		\
295	scsi		\
296	$(FM_$(MACH)_DEPLIBS)
297
298#
299# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
300# clean and clobber targets (for more information, see those targets, below).
301#
302NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
303
304DCSUBDIRS =		\
305	lvm
306
307MSGSUBDIRS=		\
308	abi		\
309	auditd_plugins	\
310	brand		\
311	cfgadm_plugins	\
312	gss_mechs/mech_dh	\
313	gss_mechs/mech_krb5	\
314	krb5		\
315	libast		\
316	libbsm		\
317	libc		\
318	libcfgadm	\
319	libcmd		\
320	libcontract	\
321	libcurses	\
322	libdhcpsvc 	\
323	libdhcputil	\
324	libipsecutil	\
325	libdiskmgt	\
326	libdladm	\
327	libdll		\
328	libgrubmgmt	\
329	libgss		\
330	libidmap	\
331	libinetcfg	\
332	libipmp		\
333	libilb		\
334	libinetutil	\
335	libinstzones	\
336	libnsl		\
337	libnwam		\
338	libpam		\
339	libpicl		\
340	libpool		\
341	libpkg		\
342	libpp		\
343	libscf		\
344	libsasl		\
345	libldap5	\
346	libsecdb	\
347	libshare	\
348	libshell	\
349	libsldap	\
350	libslp		\
351	libsmbfs	\
352	libsmedia	\
353	libsum		\
354	libtsol		\
355	libuutil	\
356	libvrrpadm	\
357	libvscan	\
358	libwanboot	\
359	libwanbootutil	\
360	libzfs		\
361	libzonecfg	\
362	lvm		\
363	madv		\
364	mms		\
365	mpss		\
366	pam_modules	\
367	pyzfs		\
368	rpcsec_gss	\
369	libreparse
370MSGSUBDIRS += \
371	$($(MACH)_MSGSUBDIRS)
372
373sparc_MSGSUBDIRS=	\
374	libprtdiag	\
375	libprtdiag_psr
376
377i386_MSGSUBDIRS= libfdisk
378
379HDRSUBDIRS=		\
380	auditd_plugins	\
381	libast		\
382	libbrand	\
383	libbsm		\
384	libc		\
385	libcmd		\
386	libcmdutils	\
387	libcontract	\
388	libcpc		\
389	libctf		\
390	libcurses	\
391	libcryptoutil	\
392	libdevice	\
393	libdevid	\
394	libdevinfo	\
395	libdiskmgt	\
396	libdladm	\
397	libdll		\
398	libdlpi		\
399	libdhcpagent	\
400	libdhcpsvc	\
401	libdhcputil	\
402	libdisasm	\
403	libdns_sd	\
404	libdscfg	\
405	libdtrace	\
406	libdtrace_jni	\
407	libelfsign	\
408	libeti		\
409	libfru		\
410	libfstyp	\
411	libgen		\
412	libwanboot	\
413	libwanbootutil	\
414	libipsecutil	\
415	libinetcfg	\
416	libinetsvc	\
417	libinetutil	\
418	libinstzones	\
419	libipmi		\
420	libipmp		\
421	libipp		\
422	libiscsit	\
423	libiscsitgt	\
424	libkstat	\
425	libkvm		\
426	libmail		\
427	libmd		\
428	libmtmalloc	\
429	libndmp		\
430	libnvpair	\
431	libnsctl	\
432	libnsl		\
433	libnwam		\
434	libpam		\
435	libpctx		\
436	libpicl		\
437	libpicltree	\
438	libplot		\
439	libpool		\
440	libpp		\
441	libproc		\
442	libraidcfg	\
443	librcm		\
444	librdc		\
445	libscf		\
446	libsip		\
447	libcommputil	\
448	libsmbios	\
449	librestart	\
450	librpcsvc	\
451	librsm		\
452	librstp		\
453	libsasl		\
454	libsec		\
455	libshell	\
456	libslp		\
457	libsmedia	\
458	libsqlite	\
459	libfcoe		\
460	libstmf		\
461	libstmfproxy	\
462	libsum		\
463	libsysevent	\
464	libtecla	\
465	libtnf		\
466	libtnfctl	\
467	libtnfprobe	\
468	libtsnet	\
469	libtsol		\
470	libvrrpadm	\
471	libvolmgt	\
472	libumem		\
473	libunistat	\
474	libuutil	\
475	libwrap		\
476	libxcurses2	\
477	libzfs		\
478	libzfs_jni	\
479	libzoneinfo	\
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	mms		\
504	libreparse	\
505	$($(MACH)_HDRSUBDIRS)
506
507$(CLOSED_BUILD)HDRSUBDIRS += \
508	$(CLOSED)/lib/libc_i18n	\
509	$(CLOSED)/lib/libike
510
511i386_HDRSUBDIRS=	\
512	libparted	\
513	libfdisk
514
515sparc_HDRSUBDIRS=	\
516	libds		\
517	libdscp		\
518	libpri		\
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
568$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
569libast: 	libsocket
570libadutils: 	libldap5 libresolv libsocket libnsl
571nsswitch:	libadutils libidmap
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
585libdscfg:	libnsctl libunistat libsocket libnsl
586libdtrace:	libproc libgen libctf
587libdtrace_jni:	libuutil libdtrace
588libefi:		libuuid
589libfstyp:	libnvpair
590libelfsign:	libcryptoutil libkmf
591libidmap:	libadutils libldap5 libavl libsldap
592libinetcfg:	libnsl libsocket libdlpi
593libiscsit:	libc libnvpair libstmf libuuid libnsl
594libkmf:		libcryptoutil pkcs11
595libnsl:		libmd5 libscf
596libmapid:	libresolv
597librdc:		libsocket libnsl libnsctl libunistat libdscfg
598libuuid:	libdlpi
599$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
600libinetutil:	libsocket
601libipsecutil:	libtecla libsocket
602libinstzones:	libzonecfg libcontract
603libpkg:		libwanboot libscf libadm
604libnwam:	libscf
605libsecdb:	libnsl
606libsasl:	libgss libsocket pkcs11 libmd
607sasl_plugins:	pkcs11 libgss libsocket libsasl
608libsctp:	libsocket
609libshell:	libast libcmd libdll libsocket libsecdb
610libsip:		libmd5
611libsmbfs:	libsocket libnsl libkrb5
612libsocket:	libnsl
613libstmfproxy: 	libstmf libsocket libnsl libpthread
614libsum: 	libast
615libsysevent:	libsecdb
616libldap5:	libsasl libsocket libnsl libmd
617libsldap:	libldap5 libtsol libnsl libc libscf libresolv
618libpool:	libnvpair libexacct
619libpp:		libast
620libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
621		libbrand libpool libscf
622libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
623libproject:	libpool libproc libsecdb
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
631libinetsvc:	libscf
632librestart:	libuutil libscf
633../cmd/sgs/libdl:	../cmd/sgs/libconv
634../cmd/sgs/libelf:	../cmd/sgs/libconv
635pkcs11:		libcryptoutil
636print:		libldap5
637udapl/udapl_tavor:	udapl/libdat
638libzfs:		libdevid libgen libnvpair libuutil libiscsitgt \
639		libadm libavl libefi libidmap libmd
640libzfs_jni:	libdiskmgt libnvpair libzfs
641libzpool:	libavl libumem libnvpair
642libsec:		libavl libidmap
643brand:		libc libsocket
644libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
645libexacct/demo:	libexacct libproject libsocket libnsl
646libtsalarm:	libpcp
647smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
648		libshare libidmap pkcs11 libsqlite libcryptoutil
649libvrrpadm:	libsocket libdladm libscf
650libvscan:	libscf
651scsi:		libnvpair
652mpapi:		libpthread libdevinfo libsysevent libnvpair
653sun_fc:		libdevinfo libsysevent libnvpair
654libsun_ima:	libdevinfo libsysevent libnsl
655sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
656libgrubmgmt:	libdevinfo libzfs libfstyp
657pyzfs:		libnvpair libsec libidmap libzfs
658libreparse:	libnvpair
659libhotplug:	libnvpair
660cfgadm_plugins:	libhotplug
661libilb:		libsocket
662$(INTEL_BUILD)libdiskmgt:libfdisk
663
664#
665# The reason this rule checks for the existence of the
666# Makefile is that some of the directories do not exist
667# in certain situations (e.g., exportable source builds,
668# OpenSolaris).
669#
670$(SUBDIRS): FRC
671	@if [ -f $@/Makefile  ]; then \
672		cd $@; pwd; $(MAKE) $(TARGET); \
673	else \
674		true; \
675	fi
676
677$(SUBDIRS:%=%-nodepend):
678	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
679		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
680	else \
681		true; \
682	fi
683
684FRC:
685