xref: /titanic_52/usr/src/lib/Makefile (revision 98157a7002f4f2cf7978f3084ca5577f0a1d72b2)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28include ../Makefile.master
29
30#	Note that libcurses installs commands along with its library.
31#	This is a minor bug which probably should be fixed.
32#	Note also that a few extra libraries are kept in cmd source.
33#
34# Certain libraries are linked with, hence depend on, other libraries.
35#
36# Although we have historically used .WAIT to express dependencies, it
37# reduces the amount of parallelism and thus lengthens the time it
38# takes to build the libraries.  Thus, we now require that any new
39# libraries explicitly call out their dependencies.  Eventually, all
40# the library dependencies will be called out explicitly.  See
41# "Library interdependencies" near the end of this file.
42#
43# Aside from explicit dependencies (and legacy .WAITs), all libraries
44# are built in parallel.
45#
46.PARALLEL:
47
48#
49# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
50# but required due to the "dependencies" of using .WAIT to barrier the
51# parallel dmake builds.  once 4631488 has been fixed, they can be
52# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
53# shown in HDRSUBDIRS
54#
55SUBDIRS= \
56	common			.WAIT	\
57	../cmd/sgs/libconv		\
58	../cmd/sgs/libdl	.WAIT
59
60$(CLOSED_BUILD)SUBDIRS += \
61	$(CLOSED)/lib/libc_i18n
62
63SUBDIRS += \
64	libc			.WAIT	\
65	../cmd/sgs/libelf	.WAIT	\
66	libmd				\
67	libmd5				\
68	librsm				\
69	libmp			.WAIT	\
70	libnsl			\
71	libsecdb		.WAIT	\
72	librpcsvc			\
73	libsocket		.WAIT	\
74	libsctp			\
75	libsip			\
76	libcommputil		\
77	libresolv			\
78	libresolv2		.WAIT	\
79	libw			.WAIT	\
80	libintl			.WAIT	\
81	../cmd/sgs/librtld_db	\
82	libaio			\
83	libast			\
84	libdll			\
85	libcmd			\
86	libshell		\
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	libiscsitgt	\
117	libkmf		\
118	libkstat	\
119	libkvm		\
120	liblm		\
121	libmalloc	\
122	libmapmalloc	\
123	libmtmalloc	\
124	libnls		\
125	libsmbios	\
126	libtecla	\
127	libumem		\
128	libnvpair	.WAIT	\
129	libexacct	\
130	libplot		\
131	libldap4	\
132	libsasl		\
133	libldap5	\
134	libsldap	.WAIT	\
135	libbsm		\
136	libsys		\
137	libsysevent	\
138	libnisdb	\
139	libpool		\
140	libpp		\
141	libproc		\
142	libproject	\
143	libsendfile	\
144	nametoaddr	\
145	ncad_addr	\
146	gss_mechs/mech_krb5	.WAIT	\
147	libkrb5	.WAIT	\
148	krb5	.WAIT	\
149	libsmbfs
150$(CLOSED_BUILD)SUBDIRS += \
151	$(CLOSED)/lib/smartcard
152SUBDIRS += \
153	passwdutil	\
154	pam_modules	\
155	crypt_modules	\
156	libadt_jni	\
157	abi		\
158	auditd_plugins	\
159	libvolmgt	\
160	libdevice	\
161	libdevid	\
162	libdhcpsvc	\
163	libc_db		\
164	libsec		\
165	libtnfprobe	\
166	libtnf		\
167	libtnfctl	\
168	libdhcpagent	\
169	libdhcpdu	\
170	libdhcputil	\
171	libipsecutil
172$(CLOSED_BUILD)SUBDIRS += \
173	$(CLOSED)/lib/libike \
174	$(CLOSED)/lib/libndmp
175SUBDIRS += \
176	nsswitch	\
177	print		\
178	libuutil	\
179	libscf		\
180	libinetsvc	\
181	librestart	\
182	libsched	\
183	libelfsign	\
184	pkcs11		.WAIT	\
185	libpctx		.WAIT	\
186	libcpc		\
187	watchmalloc	\
188	extendedFILE	\
189	madv		\
190	mpss		\
191	libdisasm	\
192	libwrap		\
193	libxcurses	\
194	libxcurses2	\
195	libxnet		\
196	libbrand	.WAIT   \
197	libzonecfg	\
198	libzoneinfo	\
199	libtsnet	\
200	libtsol		\
201	gss_mechs/mech_spnego	\
202	gss_mechs/mech_dummy	\
203	gss_mechs/mech_dh	\
204	rpcsec_gss	\
205	libraidcfg	.WAIT	\
206	librcm		.WAIT	\
207	libcfgadm	.WAIT	\
208	libpicl		.WAIT	\
209	libpicltree	.WAIT \
210	raidcfg_plugins	\
211	cfgadm_plugins	\
212	libmail		\
213	lvm		\
214	libsmedia	\
215	libipp		\
216	openssl		\
217	libdiskmgt	\
218	liblgrp		\
219	libfsmgt	\
220	fm		\
221	libavl		\
222	libcmdutils	\
223	libcontract	\
224	../cmd/sendmail/libmilter	\
225	sasl_plugins	\
226	udapl		\
227	libzpool	\
228	libzfs		\
229	libzfs_jni	\
230	libmapid	\
231	brand		\
232	policykit	\
233	hal		\
234	libshare	\
235	libsqlite	\
236	libidmap	\
237	libipmi		\
238	libexacct/demo	\
239	libvscan	\
240	smbsrv		\
241	$($(MACH)_SUBDIRS)
242
243sparc_SUBDIRS= .WAIT	\
244	efcode		\
245	libc_psr	.WAIT	\
246	libdscp		\
247	libprtdiag	.WAIT	\
248	libprtdiag_psr	\
249	libpri		\
250	librsc		\
251	libfruutils	.WAIT	\
252	libfru		\
253	storage		\
254	libpcp		\
255	libtsalarm
256
257FM_sparc_DEPLIBS= libpri
258
259fm:			\
260	libexacct	\
261	libipmi		\
262	$(FM_$(MACH)_DEPLIBS)
263
264#
265# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
266# clean and clobber targets (for more information, see those targets, below).
267#
268NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
269
270DCSUBDIRS =		\
271	lvm
272
273MSGSUBDIRS=		\
274	abi		\
275	auditd_plugins	\
276	brand		\
277	cfgadm_plugins	\
278	gss_mechs/mech_dh	\
279	gss_mechs/mech_krb5	\
280	krb5		\
281	libast		\
282	libbsm		\
283	libc		\
284	libcfgadm	\
285	libcmd		\
286	libcontract	\
287	libcurses	\
288	libdhcpsvc 	\
289	libdhcputil	\
290	libipsecutil	\
291	libdiskmgt	\
292	libdladm	\
293	libdll		\
294	libgss		\
295	libidmap	\
296	libinetcfg	\
297	libipmp		\
298	libnsl		\
299	libpam		\
300	libpicl		\
301	libpool		\
302	libpp		\
303	libscf		\
304	libsasl		\
305	libldap5	\
306	libsecdb	\
307	libshare	\
308	libshell	\
309	libsldap	\
310	libslp		\
311	libsmbfs	\
312	libsmedia	\
313	libtsol		\
314	libuutil	\
315	libvscan	\
316	libwanboot	\
317	libwanbootutil	\
318	libzfs		\
319	libzonecfg	\
320	lvm		\
321	madv		\
322	mpss		\
323	pam_modules	\
324	rpcsec_gss
325$(CLOSED_BUILD)MSGSUBDIRS += \
326	$(CLOSED)/lib/smartcard
327MSGSUBDIRS += \
328	$($(MACH)_MSGSUBDIRS)
329
330sparc_MSGSUBDIRS=	\
331	libprtdiag	\
332	libprtdiag_psr
333
334HDRSUBDIRS=		\
335	auditd_plugins	\
336	libast		\
337	libbrand	\
338	libbsm		\
339	libc		\
340	libcmd		\
341	libcmdutils	\
342	libcontract	\
343	libcpc		\
344	libctf		\
345	libcurses	\
346	libcryptoutil	\
347	libdevice	\
348	libdevid	\
349	libdevinfo	\
350	libdiskmgt	\
351	libdladm	\
352	libdll		\
353	libdlpi		\
354	libdhcpagent	\
355	libdhcpsvc	\
356	libdhcputil	\
357	libdisasm	\
358	libdns_sd	\
359	libdtrace	\
360	libdtrace_jni	\
361	libelfsign	\
362	libeti		\
363	libfstyp	\
364	libgen		\
365	libwanboot	\
366	libwanbootutil	\
367	libipsecutil	\
368	libinetcfg	\
369	libinetsvc	\
370	libinetutil	\
371	libipmi		\
372	libipmp		\
373	libipp		\
374	libiscsitgt	\
375	libkstat	\
376	libkvm		\
377	libmail		\
378	libmd		\
379	libmtmalloc	\
380	libnvpair	\
381	libnsl		\
382	libpam		\
383	libpctx		\
384	libpicl		\
385	libpicltree	\
386	libplot		\
387	libpool		\
388	libpp		\
389	libproc		\
390	libraidcfg	\
391	librcm		\
392	libscf		\
393	libsip		\
394	libcommputil	\
395	libsmbios	\
396	librestart	\
397	librpcsvc	\
398	librsm		\
399	libsasl		\
400	libsec		\
401	libshell	\
402	libslp		\
403	libsmedia	\
404	libsqlite	\
405	libsysevent	\
406	libtecla	\
407	libtnf		\
408	libtnfctl	\
409	libtnfprobe	\
410	libtsnet	\
411	libtsol		\
412	libvolmgt	\
413	libumem		\
414	libuutil	\
415	libwrap		\
416	libxcurses2	\
417	libzfs		\
418	libzfs_jni	\
419	libzoneinfo	\
420	hal		\
421	policykit	\
422	lvm		\
423	openssl		\
424	pkcs11		\
425	passwdutil	\
426	../cmd/sendmail/libmilter	\
427	fm		\
428	udapl		\
429	libmapid	\
430	libkrb5		\
431	libshare	\
432	libidmap	\
433	libvscan	\
434	smbsrv		\
435	$($(MACH)_HDRSUBDIRS)
436
437$(CLOSED_BUILD)HDRSUBDIRS += \
438	$(CLOSED)/lib/libc_i18n	\
439	$(CLOSED)/lib/libike	\
440	$(CLOSED)/lib/libndmp	\
441	$(CLOSED)/lib/smartcard
442
443sparc_HDRSUBDIRS=	\
444	libdscp		\
445	libpri
446
447all :=		TARGET= all
448check :=	TARGET= check
449clean :=	TARGET= clean
450clobber :=	TARGET= clobber
451install :=	TARGET= install
452install_h :=	TARGET= install_h
453lint :=		TARGET= lint
454_dc :=		TARGET= _dc
455_msg :=		TARGET= _msg
456
457.KEEP_STATE:
458
459#
460# For the all and install targets, we clearly must respect library
461# dependencies so that the libraries link correctly.  However, for
462# the remaining targets (check, clean, clobber, install_h, lint, _dc
463# and _msg), libraries do not have any dependencies on one another
464# and thus respecting dependencies just slows down the build.
465# As such, for these rules, we use pattern replacement to explicitly
466# avoid triggering the dependency information.  Note that for clean,
467# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
468# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
469#
470
471all:			$(SUBDIRS)
472
473install:		$(SUBDIRS) .WAIT install_extra
474
475# extra libraries kept in other source areas
476install_extra:
477	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
478	@pwd
479
480clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
481
482install_h check:	$(HDRSUBDIRS:%=%-nodepend)
483
484_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
485
486_dc:			$(DCSUBDIRS:%=%-nodepend)
487
488# dependencies for pam_modules (see below)
489$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
490
491#
492# Library interdependencies are called out explicitly here
493#
494auditd_plugins: libbsm libnsl libsecdb
495gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
496libadt_jni:	libbsm
497$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
498libast: 	libsocket
499libbsm:		libtsol
500libcmd: 	libast libsocket libnsl
501libcmdutils:	libavl
502libcontract:	libnvpair
503libdevid:	libdevinfo
504libdevinfo:	libnvpair libsec
505libdhcpagent:	libsocket libdhcputil libuuid libdlpi
506libdhcpsvc:	libinetutil
507libdhcputil:	libnsl libgen libinetutil libdlpi
508libdladm:	libdevinfo libinetutil libsocket
509libdll: 	libast
510libdlpi:	libinetutil libdladm
511libdtrace:	libproc libgen libctf
512libdtrace_jni:	libuutil libdtrace
513libefi:		libuuid
514libfstyp:	libnvpair
515libelfsign:	libcryptoutil libkmf
516libidmap:	libnsl
517libinetcfg:	libnsl libsocket libdlpi
518libkmf:		libcryptoutil pkcs11 openssl
519libnsl:		libmd5 libscf
520libmapid:	libresolv
521libuuid:	libdlpi
522libinetutil:	libsocket
523libsecdb:	libnsl
524libsasl:	libgss libsocket pkcs11 libmd
525sasl_plugins:	pkcs11 libgss libsocket libsasl
526libsctp:	libsocket
527libshell:	libast libcmd libdll libsocket libsecdb
528libsip:		libmd5
529libsmbfs:	libsocket libnsl libkrb5
530libsocket:	libnsl
531libldap5:	libsasl libsocket libnsl libmd
532libsldap:	libldap5 libtsol
533libpool:	libnvpair libexacct
534libpp:		libast
535libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
536		libbrand libpool libscf
537libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
538libproject:	libpool libproc libsecdb
539libtsnet:	libnsl libtsol libsecdb
540libwrap:	libnsl libsocket
541libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
542		libdhcputil openssl
543libwanbootutil:	libnsl
544pam_modules:	libproject passwdutil $(SMARTCARD) smbsrv
545libscf:		libuutil libmd libgen
546libinetsvc:	libscf
547librestart:	libuutil libscf
548../cmd/sgs/libdl:	../cmd/sgs/libconv
549../cmd/sgs/libelf:	../cmd/sgs/libconv
550pkcs11:		libcryptoutil
551print:		libldap5
552udapl/udapl_tavor:	udapl/libdat
553libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
554libzfs_jni:	libdiskmgt libnvpair libzfs
555libzpool:	libavl libumem libnvpair
556libsec:		libavl
557brand:		libc libsocket
558libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
559libexacct/demo:	libexacct libproject libsocket libnsl
560libtsalarm:	libpcp
561smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
562		libshare libidmap pkcs11 libsqlite
563libvscan:	libscf
564
565#
566# The reason this rule checks for the existence of the
567# Makefile is that some of the directories do not exist
568# in certain situations (e.g., exportable source builds,
569# OpenSolaris).
570#
571$(SUBDIRS): FRC
572	@if [ -f $@/Makefile  ]; then \
573		cd $@; pwd; $(MAKE) $(TARGET); \
574	else \
575		true; \
576	fi
577
578$(SUBDIRS:%=%-nodepend):
579	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
580		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
581	else \
582		true; \
583	fi
584
585FRC:
586