xref: /titanic_52/usr/src/lib/Makefile (revision d78a6b7e13de1e122f6c7e0d539522698d83ec22)
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	pysolaris	\
245	libmapid	\
246	brand		\
247	policykit	\
248	hal		\
249	libshare	\
250	libsqlite	\
251	libidmap	\
252	libadutils	\
253	libipmi		\
254	libexacct/demo	\
255	libvrrpadm	\
256	libvscan	\
257	libgrubmgmt	\
258	smbsrv		\
259	libilb		\
260	scsi		\
261	mms		\
262	libima		\
263	libsun_ima	\
264	mpapi		\
265	librstp		\
266	libreparse	\
267	libhotplug	\
268	libfruutils	.WAIT	\
269	libfru		\
270	$($(MACH)_SUBDIRS)
271
272i386_SUBDIRS=		\
273	libntfs		\
274	libparted	\
275	libfdisk
276
277sparc_SUBDIRS= .WAIT	\
278	efcode		\
279	libc_psr	.WAIT	\
280	libds		\
281	libdscp		\
282	libprtdiag	.WAIT	\
283	libprtdiag_psr	\
284	libpri		\
285	librsc		\
286	storage		\
287	libpcp		\
288	libtsalarm
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	libiscsitgt	\
426	libkstat	\
427	libkvm		\
428	libmail		\
429	libmd		\
430	libmtmalloc	\
431	libndmp		\
432	libnvpair	\
433	libnsctl	\
434	libnsl		\
435	libnwam		\
436	libpam		\
437	libpctx		\
438	libpicl		\
439	libpicltree	\
440	libplot		\
441	libpool		\
442	libpp		\
443	libproc		\
444	libraidcfg	\
445	librcm		\
446	librdc		\
447	libscf		\
448	libsip		\
449	libcommputil	\
450	libsmbios	\
451	librestart	\
452	librpcsvc	\
453	librsm		\
454	librstp		\
455	libsasl		\
456	libsec		\
457	libshell	\
458	libslp		\
459	libsmedia	\
460	libsqlite	\
461	libfcoe		\
462	libstmf		\
463	libstmfproxy	\
464	libsum		\
465	libsysevent	\
466	libtecla	\
467	libtnf		\
468	libtnfctl	\
469	libtnfprobe	\
470	libtsnet	\
471	libtsol		\
472	libvrrpadm	\
473	libvolmgt	\
474	libumem		\
475	libunistat	\
476	libuutil	\
477	libwrap		\
478	libxcurses2	\
479	libzfs		\
480	libzfs_jni	\
481	libzoneinfo	\
482	hal		\
483	policykit	\
484	lvm		\
485	pkcs11		\
486	passwdutil	\
487	../cmd/sendmail/libmilter	\
488	fm		\
489	udapl		\
490	libmapid	\
491	libkrb5		\
492	libsmbfs	\
493	libshare	\
494	libidmap	\
495	libvscan	\
496	libgrubmgmt	\
497	smbsrv		\
498	libilb		\
499	scsi		\
500	hbaapi		\
501	smhba		\
502	libima		\
503	libsun_ima	\
504	mpapi		\
505	mms		\
506	libreparse	\
507	$($(MACH)_HDRSUBDIRS)
508
509$(CLOSED_BUILD)HDRSUBDIRS += \
510	$(CLOSED)/lib/libc_i18n	\
511	$(CLOSED)/lib/libike
512
513i386_HDRSUBDIRS=	\
514	libparted	\
515	libfdisk
516
517sparc_HDRSUBDIRS=	\
518	libds		\
519	libdscp		\
520	libpri		\
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
587libdscfg:	libnsctl libunistat libsocket libnsl
588libdtrace:	libproc libgen libctf
589libdtrace_jni:	libuutil libdtrace
590libefi:		libuuid
591libfstyp:	libnvpair
592libelfsign:	libcryptoutil libkmf
593libidmap:	libadutils libldap5 libavl libsldap
594libinetcfg:	libnsl libsocket libdlpi
595libiscsit:	libc libnvpair libstmf libuuid libnsl
596libkmf:		libcryptoutil pkcs11
597libnsl:		libmd5 libscf
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:	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
626libtsnet:	libnsl libtsol libsecdb
627libwrap:	libnsl libsocket
628libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
629		libdhcputil
630libwanbootutil:	libnsl
631pam_modules:	libproject passwdutil smbsrv
632libscf:		libuutil libmd libgen libsmbios
633libinetsvc:	libscf
634librestart:	libuutil libscf
635../cmd/sgs/libdl:	../cmd/sgs/libconv
636../cmd/sgs/libelf:	../cmd/sgs/libconv
637pkcs11:		libcryptoutil
638print:		libldap5
639udapl/udapl_tavor:	udapl/libdat
640libzfs:		libdevid libgen libnvpair libuutil libiscsitgt \
641		libadm libavl libefi libidmap libmd
642libzfs_jni:	libdiskmgt libnvpair libzfs
643libzpool:	libavl libumem libnvpair
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
651libvrrpadm:	libsocket libdladm libscf
652libvscan:	libscf
653scsi:		libnvpair
654mpapi:		libpthread libdevinfo libsysevent libnvpair
655sun_fc:		libdevinfo libsysevent libnvpair
656libsun_ima:	libdevinfo libsysevent libnsl
657sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
658libgrubmgmt:	libdevinfo libzfs libfstyp
659pyzfs:		libnvpair libzfs
660pysolaris:	libsec libidmap
661libreparse:	libnvpair
662libhotplug:	libnvpair
663cfgadm_plugins:	libhotplug
664libilb:		libsocket
665$(INTEL_BUILD)libdiskmgt:libfdisk
666
667#
668# The reason this rule checks for the existence of the
669# Makefile is that some of the directories do not exist
670# in certain situations (e.g., exportable source builds,
671# OpenSolaris).
672#
673$(SUBDIRS): FRC
674	@if [ -f $@/Makefile  ]; then \
675		cd $@; pwd; $(MAKE) $(TARGET); \
676	else \
677		true; \
678	fi
679
680$(SUBDIRS:%=%-nodepend):
681	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
682		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
683	else \
684		true; \
685	fi
686
687FRC:
688