xref: /titanic_41/usr/src/lib/Makefile (revision 0572408d0f87aa2483c427545c5f52cd08cce1a3)
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	libkmf		\
118	libkstat	\
119	libkvm		\
120	liblm		\
121	libmalloc	\
122	libmapmalloc	\
123	libmtmalloc	\
124	libnls		\
125	libnwam		\
126	libsmbios	\
127	libtecla	\
128	libumem		\
129	libnvpair	.WAIT	\
130	libexacct	\
131	libplot		\
132	libldap4	\
133	libsasl		\
134	libldap5	\
135	libsldap	.WAIT	\
136	libbsm		\
137	libsys		\
138	libsysevent	\
139	libnisdb	\
140	libpool		\
141	libpp		\
142	libproc		\
143	libproject	\
144	libsendfile	\
145	nametoaddr	\
146	ncad_addr	\
147	hbaapi		\
148	smhba		\
149	sun_fc		\
150	sun_sas		\
151	gss_mechs/mech_krb5	.WAIT	\
152	libkrb5	.WAIT	\
153	krb5	.WAIT	\
154	libsmbfs	\
155	libfcoe		\
156	libstmf		\
157	libstmfproxy	\
158	libnsctl	\
159	libunistat	\
160	libdscfg	\
161	librdc		\
162	libinstzones	\
163	libpkg
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	libdhcpsvc	\
176	libc_db		\
177	libndmp		\
178	libsec		\
179	libtnfprobe	\
180	libtnf		\
181	libtnfctl	\
182	libdhcpagent	\
183	libdhcpdu	\
184	libdhcputil	\
185	libxnet		\
186	libipsecutil
187$(CLOSED_BUILD)SUBDIRS += \
188	$(CLOSED)/lib/libike
189SUBDIRS += \
190	nsswitch	\
191	print		\
192	libuutil	\
193	libscf		\
194	libinetsvc	\
195	librestart	\
196	libsched	\
197	libelfsign	\
198	pkcs11		.WAIT	\
199	libpctx		.WAIT	\
200	libcpc		\
201	watchmalloc	\
202	extendedFILE	\
203	madv		\
204	mpss		\
205	libdisasm	\
206	libwrap		\
207	libxcurses	\
208	libxcurses2	\
209	libbrand	.WAIT   \
210	libzonecfg	\
211	libzoneinfo	\
212	libtsnet	\
213	libtsol		\
214	gss_mechs/mech_spnego	\
215	gss_mechs/mech_dummy	\
216	gss_mechs/mech_dh	\
217	rpcsec_gss	\
218	libraidcfg	.WAIT	\
219	librcm		.WAIT	\
220	libcfgadm	.WAIT	\
221	libpicl		.WAIT	\
222	libpicltree	.WAIT \
223	raidcfg_plugins	\
224	cfgadm_plugins	\
225	libmail		\
226	lvm		\
227	libsmedia	\
228	libipp		\
229	libdiskmgt	\
230	liblgrp		\
231	libfsmgt	\
232	fm		\
233	libavl		\
234	libcmdutils	\
235	libcontract	\
236	../cmd/sendmail/libmilter	\
237	sasl_plugins	\
238	udapl		\
239	libzpool	\
240	libzfs		\
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	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	libv12n
289
290FM_sparc_DEPLIBS= libpri
291
292fm:			\
293	libexacct	\
294	libipmi		\
295	libzfs		\
296	scsi		\
297	$(FM_$(MACH)_DEPLIBS)
298
299#
300# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
301# clean and clobber targets (for more information, see those targets, below).
302#
303NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
304
305DCSUBDIRS =		\
306	lvm
307
308MSGSUBDIRS=		\
309	abi		\
310	auditd_plugins	\
311	brand		\
312	cfgadm_plugins	\
313	gss_mechs/mech_dh	\
314	gss_mechs/mech_krb5	\
315	krb5		\
316	libast		\
317	libbsm		\
318	libc		\
319	libcfgadm	\
320	libcmd		\
321	libcontract	\
322	libcurses	\
323	libdhcpsvc 	\
324	libdhcputil	\
325	libipsecutil	\
326	libdiskmgt	\
327	libdladm	\
328	libdll		\
329	libgrubmgmt	\
330	libgss		\
331	libidmap	\
332	libinetcfg	\
333	libipmp		\
334	libilb		\
335	libinetutil	\
336	libinstzones	\
337	libnsl		\
338	libnwam		\
339	libpam		\
340	libpicl		\
341	libpool		\
342	libpkg		\
343	libpp		\
344	libscf		\
345	libsasl		\
346	libldap5	\
347	libsecdb	\
348	libshare	\
349	libshell	\
350	libsldap	\
351	libslp		\
352	libsmbfs	\
353	libsmedia	\
354	libsum		\
355	libtsol		\
356	libuutil	\
357	libvrrpadm	\
358	libvscan	\
359	libwanboot	\
360	libwanbootutil	\
361	libzfs		\
362	libzonecfg	\
363	lvm		\
364	madv		\
365	mms		\
366	mpss		\
367	pam_modules	\
368	pyzfs		\
369	pysolaris	\
370	rpcsec_gss	\
371	libreparse
372MSGSUBDIRS += \
373	$($(MACH)_MSGSUBDIRS)
374
375sparc_MSGSUBDIRS=	\
376	libprtdiag	\
377	libprtdiag_psr
378
379i386_MSGSUBDIRS= libfdisk
380
381HDRSUBDIRS=		\
382	auditd_plugins	\
383	libast		\
384	libbrand	\
385	libbsm		\
386	libc		\
387	libcmd		\
388	libcmdutils	\
389	libcontract	\
390	libcpc		\
391	libctf		\
392	libcurses	\
393	libcryptoutil	\
394	libdevice	\
395	libdevid	\
396	libdevinfo	\
397	libdiskmgt	\
398	libdladm	\
399	libdll		\
400	libdlpi		\
401	libdhcpagent	\
402	libdhcpsvc	\
403	libdhcputil	\
404	libdisasm	\
405	libdns_sd	\
406	libdscfg	\
407	libdtrace	\
408	libdtrace_jni	\
409	libelfsign	\
410	libeti		\
411	libfru		\
412	libfstyp	\
413	libgen		\
414	libwanboot	\
415	libwanbootutil	\
416	libipsecutil	\
417	libinetcfg	\
418	libinetsvc	\
419	libinetutil	\
420	libinstzones	\
421	libipmi		\
422	libipmp		\
423	libipp		\
424	libiscsit	\
425	libkstat	\
426	libkvm		\
427	libmail		\
428	libmd		\
429	libmtmalloc	\
430	libndmp		\
431	libnvpair	\
432	libnsctl	\
433	libnsl		\
434	libnwam		\
435	libpam		\
436	libpctx		\
437	libpicl		\
438	libpicltree	\
439	libplot		\
440	libpool		\
441	libpp		\
442	libproc		\
443	libraidcfg	\
444	librcm		\
445	librdc		\
446	libscf		\
447	libsip		\
448	libcommputil	\
449	libsmbios	\
450	librestart	\
451	librpcsvc	\
452	librsm		\
453	librstp		\
454	libsasl		\
455	libsec		\
456	libshell	\
457	libslp		\
458	libsmedia	\
459	libsqlite	\
460	libfcoe		\
461	libstmf		\
462	libstmfproxy	\
463	libsum		\
464	libsysevent	\
465	libtecla	\
466	libtnf		\
467	libtnfctl	\
468	libtnfprobe	\
469	libtsnet	\
470	libtsol		\
471	libvrrpadm	\
472	libvolmgt	\
473	libumem		\
474	libunistat	\
475	libuutil	\
476	libwrap		\
477	libxcurses2	\
478	libzfs		\
479	libzfs_jni	\
480	libzoneinfo	\
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	mms		\
505	libreparse	\
506	$($(MACH)_HDRSUBDIRS)
507
508$(CLOSED_BUILD)HDRSUBDIRS += \
509	$(CLOSED)/lib/libc_i18n	\
510	$(CLOSED)/lib/libike
511
512i386_HDRSUBDIRS=	\
513	libparted	\
514	libfdisk
515
516sparc_HDRSUBDIRS=	\
517	libds		\
518	libdscp		\
519	libpri		\
520	libv12n		\
521	storage
522
523all :=		TARGET= all
524check :=	TARGET= check
525clean :=	TARGET= clean
526clobber :=	TARGET= clobber
527install :=	TARGET= install
528install_h :=	TARGET= install_h
529lint :=		TARGET= lint
530_dc :=		TARGET= _dc
531_msg :=		TARGET= _msg
532
533.KEEP_STATE:
534
535#
536# For the all and install targets, we clearly must respect library
537# dependencies so that the libraries link correctly.  However, for
538# the remaining targets (check, clean, clobber, install_h, lint, _dc
539# and _msg), libraries do not have any dependencies on one another
540# and thus respecting dependencies just slows down the build.
541# As such, for these rules, we use pattern replacement to explicitly
542# avoid triggering the dependency information.  Note that for clean,
543# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
544# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
545#
546
547all:			$(SUBDIRS)
548
549install:		$(SUBDIRS) .WAIT install_extra
550
551# extra libraries kept in other source areas
552install_extra:
553	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
554	@pwd
555
556clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
557
558install_h check:	$(HDRSUBDIRS:%=%-nodepend)
559
560_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
561
562_dc:			$(DCSUBDIRS:%=%-nodepend)
563
564#
565# Library interdependencies are called out explicitly here
566#
567auditd_plugins: libbsm libnsl libsecdb
568gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
569libadt_jni:	libbsm
570$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
571libast: 	libsocket
572libadutils: 	libldap5 libresolv libsocket libnsl
573nsswitch:	libadutils libidmap
574libbsm:		libtsol
575libcmd: 	libsum libast libsocket libnsl
576libcmdutils:	libavl
577libcontract:	libnvpair
578libdevid:	libdevinfo
579libdevinfo:	libnvpair libsec
580libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
581libdhcpsvc:	libinetutil
582libdhcputil:	libnsl libgen libinetutil libdlpi
583libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
584		libexacct libnsl libkstat libcurses
585libdll: 	libast
586libdlpi:	libinetutil libdladm
587libds:		libsysevent
588libdscfg:	libnsctl libunistat libsocket libnsl
589libdtrace:	libproc libgen libctf
590libdtrace_jni:	libuutil libdtrace
591libefi:		libuuid
592libfstyp:	libnvpair
593libelfsign:	libcryptoutil libkmf
594libidmap:	libadutils libldap5 libavl libsldap
595libinetcfg:	libnsl libsocket libdlpi
596libiscsit:	libc libnvpair libstmf libuuid libnsl
597libkmf:		libcryptoutil pkcs11
598libnsl:		libmd5 libscf
599libmapid:	libresolv
600librdc:		libsocket libnsl libnsctl libunistat libdscfg
601libuuid:	libdlpi
602$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
603libinetutil:	libsocket
604libipsecutil:	libtecla libsocket
605libinstzones:	libzonecfg libcontract
606libpkg:		libwanboot libscf libadm
607libnwam:	libscf
608libsecdb:	libnsl
609libsasl:	libgss libsocket pkcs11 libmd
610sasl_plugins:	pkcs11 libgss libsocket libsasl
611libsctp:	libsocket
612libshell:	libast libcmd libdll libsocket libsecdb
613libsip:		libmd5
614libsmbfs:	libsocket libnsl libkrb5
615libsocket:	libnsl
616libstmfproxy: 	libstmf libsocket libnsl libpthread
617libsum: 	libast
618libsysevent:	libsecdb
619libldap5:	libsasl libsocket libnsl libmd
620libsldap:	libldap5 libtsol libnsl libc libscf libresolv
621libpool:	libnvpair libexacct
622libpp:		libast
623libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
624		libbrand libpool libscf
625libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
626libproject:	libpool libproc libsecdb
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
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
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
652libv12n:	libds libuuid
653libvrrpadm:	libsocket libdladm libscf
654libvscan:	libscf
655scsi:		libnvpair
656mpapi:		libpthread libdevinfo libsysevent libnvpair
657sun_fc:		libdevinfo libsysevent libnvpair
658libsun_ima:	libdevinfo libsysevent libnsl
659sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
660libgrubmgmt:	libdevinfo libzfs libfstyp
661pyzfs:		libnvpair libzfs
662pysolaris:	libsec libidmap
663libreparse:	libnvpair
664libhotplug:	libnvpair
665cfgadm_plugins:	libhotplug
666libilb:		libsocket
667$(INTEL_BUILD)libdiskmgt:libfdisk
668
669#
670# The reason this rule checks for the existence of the
671# Makefile is that some of the directories do not exist
672# in certain situations (e.g., exportable source builds,
673# OpenSolaris).
674#
675$(SUBDIRS): FRC
676	@if [ -f $@/Makefile  ]; then \
677		cd $@; pwd; $(MAKE) $(TARGET); \
678	else \
679		true; \
680	fi
681
682$(SUBDIRS:%=%-nodepend):
683	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
684		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
685	else \
686		true; \
687	fi
688
689FRC:
690