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