xref: /titanic_51/usr/src/lib/Makefile (revision 5eb667aca135f8c963f5eb9e534c0cd1fdc81fcd)
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23
24include ../Makefile.master
25
26#	Note that libcurses installs commands along with its library.
27#	This is a minor bug which probably should be fixed.
28#	Note also that a few extra libraries are kept in cmd source.
29#
30# Certain libraries are linked with, hence depend on, other libraries.
31#
32# Although we have historically used .WAIT to express dependencies, it
33# reduces the amount of parallelism and thus lengthens the time it
34# takes to build the libraries.  Thus, we now require that any new
35# libraries explicitly call out their dependencies.  Eventually, all
36# the library dependencies will be called out explicitly.  See
37# "Library interdependencies" near the end of this file.
38#
39# Aside from explicit dependencies (and legacy .WAITs), all libraries
40# are built in parallel.
41#
42.PARALLEL:
43
44#
45# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
46# but required due to the "dependencies" of using .WAIT to barrier the
47# parallel dmake builds.  once 4631488 has been fixed, they can be
48# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
49# shown in HDRSUBDIRS
50#
51SUBDIRS= \
52	common			.WAIT	\
53	../cmd/sgs/libconv		\
54	../cmd/sgs/libdl	.WAIT
55
56SUBDIRS += \
57	libc			.WAIT	\
58	../cmd/sgs/libelf	.WAIT	\
59	c_synonyms			\
60	libmd				\
61	libmd5				\
62	librsm				\
63	libmp			.WAIT	\
64	libnsl			\
65	libsecdb		.WAIT	\
66	librpcsvc			\
67	libsocket		.WAIT	\
68	libsctp			\
69	libsip			\
70	libcommputil		\
71	libresolv			\
72	libresolv2		.WAIT	\
73	libw			.WAIT	\
74	libintl			.WAIT	\
75	../cmd/sgs/librtld_db	\
76	libaio			\
77	libast			\
78	libdll			\
79	libcmd			\
80	libshell		\
81	libsum			\
82	librt			\
83	libadm			\
84	libctf			\
85	libdtrace		\
86	libdtrace_jni		\
87	libcurses		\
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	libipmp		\
111	libiscsit	\
112	libkmf		\
113	libkmsagent	\
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	libldap4	\
128	libsasl		\
129	libldap5	\
130	libsldap	.WAIT	\
131	libbsm		\
132	libsys		\
133	libsysevent	\
134	libnisdb	\
135	libpool		\
136	libpp		\
137	libproc		\
138	libproject	\
139	libsendfile	\
140	nametoaddr	\
141	ncad_addr	\
142	hbaapi		\
143	smhba		\
144	sun_fc		\
145	sun_sas		\
146	gss_mechs/mech_krb5	.WAIT	\
147	libkrb5	.WAIT	\
148	krb5	.WAIT	\
149	libsmbfs	\
150	libfcoe		\
151	libsrpt		\
152	libstmf		\
153	libstmfproxy	\
154	libnsctl	\
155	libunistat	\
156	libdscfg	\
157	librdc		\
158	libinstzones	\
159	libpkg
160
161SUBDIRS += \
162	passwdutil	\
163	pam_modules	\
164	crypt_modules	\
165	libadt_jni	\
166	abi		\
167	auditd_plugins	\
168	libvolmgt	\
169	libdevice	\
170	libdevid	\
171	libdhcpsvc	\
172	libc_db		\
173	libndmp		\
174	libsec		\
175	libtnfprobe	\
176	libtnf		\
177	libtnfctl	\
178	libdhcpagent	\
179	libdhcpdu	\
180	libdhcputil	\
181	libxnet		\
182	libipsecutil
183$(CLOSED_BUILD)SUBDIRS += \
184	$(CLOSED)/lib/libike
185SUBDIRS += \
186	nsswitch	\
187	print		\
188	libuutil	\
189	libscf		\
190	libinetsvc	\
191	librestart	\
192	libsched	\
193	libelfsign	\
194	pkcs11		.WAIT	\
195	libpctx		.WAIT	\
196	libcpc		\
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		\
238	libbe 		\
239	pylibbe 	\
240	libzfs_jni	\
241	pyzfs		\
242	pysolaris	\
243	libmapid	\
244	brand		\
245	policykit	\
246	hal		\
247	libshare	\
248	libsqlite	\
249	libidmap	\
250	libadutils	\
251	libipmi		\
252	libexacct/demo	\
253	libvrrpadm	\
254	libvscan	\
255	libgrubmgmt	\
256	smbsrv		\
257	libilb		\
258	scsi		\
259	libima		\
260	libsun_ima	\
261	mpapi		\
262	librstp		\
263	libreparse	\
264	libhotplug	\
265	libfruutils	.WAIT	\
266	libfru		\
267	$($(MACH)_SUBDIRS)
268
269i386_SUBDIRS=		\
270	libntfs		\
271	libparted	\
272	libfdisk
273
274sparc_SUBDIRS= .WAIT	\
275	efcode		\
276	libds		\
277	libdscp		\
278	libprtdiag	.WAIT	\
279	libprtdiag_psr	\
280	libpri		\
281	librsc		\
282	storage		\
283	libpcp		\
284	libtsalarm	\
285	libv12n
286
287FM_sparc_DEPLIBS= libpri
288
289fm:			\
290	libexacct	\
291	libipmi		\
292	libzfs		\
293	scsi		\
294	$(FM_$(MACH)_DEPLIBS)
295
296#
297# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
298# clean and clobber targets (for more information, see those targets, below).
299#
300NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
301
302DCSUBDIRS =		\
303	lvm
304
305MSGSUBDIRS=		\
306	abi		\
307	auditd_plugins	\
308	brand		\
309	cfgadm_plugins	\
310	gss_mechs/mech_dh	\
311	gss_mechs/mech_krb5	\
312	krb5		\
313	libast		\
314	libbsm		\
315	libc		\
316	libcfgadm	\
317	libcmd		\
318	libcontract	\
319	libcurses	\
320	libdhcpsvc 	\
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	libcryptoutil	\
391	libdevice	\
392	libdevid	\
393	libdevinfo	\
394	libdiskmgt	\
395	libdladm	\
396	libdll		\
397	libdlpi		\
398	libdhcpagent	\
399	libdhcpsvc	\
400	libdhcputil	\
401	libdisasm	\
402	libdns_sd	\
403	libdscfg	\
404	libdtrace	\
405	libdtrace_jni	\
406	libelfsign	\
407	libeti		\
408	libfru		\
409	libfstyp	\
410	libgen		\
411	libipadm	\
412	libipsecutil	\
413	libinetsvc	\
414	libinetutil	\
415	libinstzones	\
416	libipmi		\
417	libipmp		\
418	libipp		\
419	libiscsit	\
420	libkstat	\
421	libkvm		\
422	libmail		\
423	libmd		\
424	libmtmalloc	\
425	libndmp		\
426	libnvpair	\
427	libnsctl	\
428	libnsl		\
429	libnwam		\
430	libpam		\
431	libpctx		\
432	libpicl		\
433	libpicltree	\
434	libpool		\
435	libpp		\
436	libproc		\
437	libraidcfg	\
438	librcm		\
439	librdc		\
440	libscf		\
441	libsip		\
442	libsmbios	\
443	librestart	\
444	librpcsvc	\
445	librsm		\
446	librstp		\
447	libsasl		\
448	libsec		\
449	libshell	\
450	libslp		\
451	libsmedia	\
452	libsocket	\
453	libsqlite	\
454	libfcoe		\
455	libsrpt		\
456	libstmf		\
457	libstmfproxy	\
458	libsum		\
459	libsysevent	\
460	libtecla	\
461	libtnf		\
462	libtnfctl	\
463	libtnfprobe	\
464	libtsnet	\
465	libtsol		\
466	libvrrpadm	\
467	libvolmgt	\
468	libumem		\
469	libunistat	\
470	libuutil	\
471	libwanboot	\
472	libwanbootutil	\
473	libwrap		\
474	libxcurses2	\
475	libzfs		\
476	libzfs_jni	\
477	libzoneinfo	\
478	libzonestat	\
479	hal		\
480	policykit	\
481	lvm		\
482	pkcs11		\
483	passwdutil	\
484	../cmd/sendmail/libmilter	\
485	fm		\
486	udapl		\
487	libmapid	\
488	libkrb5		\
489	libsmbfs	\
490	libshare	\
491	libidmap	\
492	libvscan	\
493	libgrubmgmt	\
494	smbsrv		\
495	libilb		\
496	scsi		\
497	hbaapi		\
498	smhba		\
499	libima		\
500	libsun_ima	\
501	mpapi		\
502	libreparse	\
503	$($(MACH)_HDRSUBDIRS)
504
505$(CLOSED_BUILD)HDRSUBDIRS += \
506	$(CLOSED)/lib/libike
507
508i386_HDRSUBDIRS=	\
509	libparted	\
510	libfdisk
511
512sparc_HDRSUBDIRS=	\
513	libds		\
514	libdscp		\
515	libpri		\
516	libv12n		\
517	storage
518
519all :=		TARGET= all
520check :=	TARGET= check
521clean :=	TARGET= clean
522clobber :=	TARGET= clobber
523install :=	TARGET= install
524install_h :=	TARGET= install_h
525lint :=		TARGET= lint
526_dc :=		TARGET= _dc
527_msg :=		TARGET= _msg
528
529.KEEP_STATE:
530
531#
532# For the all and install targets, we clearly must respect library
533# dependencies so that the libraries link correctly.  However, for
534# the remaining targets (check, clean, clobber, install_h, lint, _dc
535# and _msg), libraries do not have any dependencies on one another
536# and thus respecting dependencies just slows down the build.
537# As such, for these rules, we use pattern replacement to explicitly
538# avoid triggering the dependency information.  Note that for clean,
539# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
540# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
541#
542
543all:			$(SUBDIRS)
544
545install:		$(SUBDIRS) .WAIT install_extra
546
547# extra libraries kept in other source areas
548install_extra:
549	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
550	@pwd
551
552clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
553
554install_h check:	$(HDRSUBDIRS:%=%-nodepend)
555
556_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
557
558_dc:			$(DCSUBDIRS:%=%-nodepend)
559
560#
561# Library interdependencies are called out explicitly here
562#
563auditd_plugins: libbsm libnsl libsecdb
564gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
565libadt_jni:	libbsm
566libast: 	libsocket
567libadutils: 	libldap5 libresolv libsocket libnsl
568nsswitch:	libadutils libidmap
569libbe: 		libzfs
570libbsm:		libtsol
571libcmd: 	libsum libast libsocket libnsl
572libcmdutils:	libavl
573libcontract:	libnvpair
574libdevid:	libdevinfo
575libdevinfo:	libnvpair libsec
576libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
577libdhcpsvc:	libinetutil
578libdhcputil:	libnsl libgen libinetutil libdlpi
579libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
580		libexacct libnsl libkstat libcurses
581libdll: 	libast
582libdlpi:	libinetutil libdladm
583libds:		libsysevent
584libdscfg:	libnsctl libunistat libsocket libnsl
585libdtrace:	libproc libgen libctf
586libdtrace_jni:	libuutil libdtrace
587libefi:		libuuid
588libfstyp:	libnvpair
589libelfsign:	libcryptoutil libkmf
590libidmap:	libadutils libldap5 libavl libsldap libuutil
591libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
592		libdladm libsecdb
593libiscsit:	libc libnvpair libstmf libuuid libnsl
594libkmf:		libcryptoutil pkcs11
595libnsl:		libmd5
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:	libcmdutils 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 libnsl
631libinetsvc:	libscf
632librestart:	libuutil libscf
633../cmd/sgs/libdl:	../cmd/sgs/libconv
634../cmd/sgs/libelf:	../cmd/sgs/libconv
635pkcs11:		libcryptoutil libkmsagent
636print:		libldap5
637udapl/udapl_tavor:	udapl/libdat
638libzfs:		libdevid libgen libnvpair libuutil \
639		libadm libavl libefi libidmap libmd
640libzfs_jni:	libdiskmgt libnvpair libzfs
641libzpool:	libavl libumem libnvpair libcmdutils
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 \
649		libreparse libcmdutils
650libv12n:	libds libuuid
651libvrrpadm:	libsocket libdladm libscf
652libvscan:	libscf
653libfru:		libfruutils
654scsi:		libnvpair libfru
655mpapi:		libpthread libdevinfo libsysevent libnvpair
656sun_fc:		libdevinfo libsysevent libnvpair
657libsun_ima:	libdevinfo libsysevent libnsl
658sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
659libgrubmgmt:	libdevinfo libzfs libfstyp
660pylibbe: 	libbe libzfs
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