xref: /titanic_44/usr/src/lib/Makefile (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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#
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	libcmd			\
71	libnsl			\
72	libsecdb		.WAIT	\
73	librpcsvc			\
74	libsocket		.WAIT	\
75	libsctp			\
76	libsip			\
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	libfstyp	\
105	libwanboot	\
106	libwanbootutil	\
107	libcryptoutil	\
108	libinetcfg	\
109	libinetutil	\
110	libipmp		\
111	libkstat	\
112	libkvm		\
113        liblaadm        \
114	liblm		\
115	libmacadm	\
116	libmalloc	\
117	libmapmalloc	\
118	libmtmalloc	\
119	libnls		\
120	libsmbios	\
121	libtecla	\
122	libumem		\
123	libnvpair	.WAIT	\
124	libexacct	\
125	libplot		\
126	libldap4	\
127	libsasl		\
128	libldap5	\
129	libsldap	.WAIT	\
130	libbsm		\
131	libsys		\
132	libsysevent	\
133	libnisdb	\
134	libpool		\
135	libproc		\
136	libproject	\
137	libsendfile	\
138	nametoaddr	\
139	ncad_addr	\
140	gss_mechs/mech_krb5	.WAIT	\
141	libkrb5	.WAIT	\
142	krb5	.WAIT
143$(CLOSED_BUILD)SUBDIRS += \
144	$(CLOSED)/lib/smartcard
145SUBDIRS += \
146	passwdutil	\
147	pam_modules	\
148	crypt_modules	\
149	libadt_jni	\
150	abi		\
151	auditd_plugins	\
152	libvolmgt	\
153	libdevice	\
154	libdevid	\
155	libdhcpsvc	\
156	libc_db		\
157	libsec		\
158	libtnfprobe	\
159	libtnf		\
160	libtnfctl	\
161	libdhcpagent	\
162	libdhcpdu	\
163	libdhcputil	\
164	libipsecutil
165$(CLOSED_BUILD)SUBDIRS += \
166	$(CLOSED)/lib/libike
167SUBDIRS += \
168	nsswitch	\
169	print		\
170	libuutil	\
171	libscf		\
172	libinetsvc	\
173	librestart	\
174	libsched
175$(CLOSED_BUILD)SUBDIRS += \
176	$(CLOSED)/lib/libelfsign
177SUBDIRS += \
178	pkcs11		.WAIT	\
179	libpctx		.WAIT	\
180	libcpc		\
181	watchmalloc	\
182	extendedFILE	\
183	madv		\
184	mpss		\
185	libdisasm	\
186	libwrap		\
187	libxcurses	\
188	libxcurses2	\
189	libxnet		\
190	libbrand	.WAIT   \
191	libzonecfg	\
192	libzoneinfo	\
193	libtsnet	\
194	libtsol		\
195	gss_mechs/mech_spnego	\
196	gss_mechs/mech_dummy	\
197	gss_mechs/mech_dh	\
198	rpcsec_gss	\
199	librcm		.WAIT	\
200	libcfgadm	.WAIT	\
201	libpicl		.WAIT	\
202	libpicltree	.WAIT \
203	cfgadm_plugins	\
204	libmail		\
205	lvm		\
206	libsmedia	\
207	libipp		\
208	openssl		\
209	libdiskmgt	\
210	liblgrp		\
211	libfsmgt	\
212	fm		\
213	libavl		\
214	libcmdutils	\
215	libcontract	\
216	../cmd/sendmail/libmilter	\
217	sasl_plugins	\
218	udapl		\
219	libzpool	\
220	libzfs		\
221	libzfs_jni	\
222	libmapid	\
223	brand		\
224	policykit	\
225	hal		\
226	$($(MACH)_SUBDIRS)
227
228sparc_SUBDIRS= .WAIT	\
229	efcode		\
230	libc_psr	.WAIT	\
231	libdscp		\
232	libprtdiag	.WAIT	\
233	libprtdiag_psr	\
234	librsc		\
235	libfruutils	.WAIT	\
236	libfru		\
237	libwrsmconf	\
238	storage		\
239	wrsm		\
240	libpcp
241
242fm: libexacct
243
244#
245# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
246# clean and clobber targets (for more information, see those targets, below).
247#
248NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
249
250DCSUBDIRS =		\
251	lvm
252
253MSGSUBDIRS=		\
254	abi		\
255	auditd_plugins	\
256	brand		\
257	cfgadm_plugins	\
258	gss_mechs/mech_dh	\
259	gss_mechs/mech_krb5	\
260	krb5		\
261	libbsm		\
262	libc		\
263	libcfgadm	\
264	libcontract	\
265	libcurses	\
266	libdhcpsvc 	\
267	libdhcputil	\
268	libgss		\
269	libinetcfg	\
270	libipmp		\
271	libnsl		\
272	libpam		\
273	libpicl		\
274	libpool		\
275	libscf		\
276	libsasl		\
277	libldap5	\
278	libsecdb	\
279	libsldap	\
280	libslp		\
281	libsmedia	\
282	libtsol		\
283	libuutil	\
284	libwanboot	\
285	libwanbootutil	\
286	libzonecfg	\
287	lvm		\
288	madv		\
289	mpss		\
290	pam_modules	\
291	rpcsec_gss
292$(CLOSED_BUILD)MSGSUBDIRS += \
293	$(CLOSED)/lib/smartcard
294MSGSUBDIRS += \
295	$($(MACH)_MSGSUBDIRS)
296
297sparc_MSGSUBDIRS=	\
298	libprtdiag	\
299	libprtdiag_psr
300
301HDRSUBDIRS=		\
302	auditd_plugins	\
303	libbrand	\
304	libbsm		\
305	libc		\
306	libcmdutils	\
307	libcontract	\
308	libcpc		\
309	libctf		\
310	libcurses	\
311	libcryptoutil	\
312	libdevice	\
313	libdevid	\
314	libdevinfo	\
315	libdiskmgt	\
316	libdladm	\
317	libdlpi		\
318	libdhcpagent	\
319	libdhcpsvc	\
320	libdhcputil	\
321	libdisasm	\
322	libdtrace	\
323	libdtrace_jni	\
324	libeti		\
325	libfstyp	\
326	libgen		\
327	libwanboot	\
328	libwanbootutil	\
329	libipsecutil	\
330	libinetcfg	\
331	libinetsvc	\
332	libinetutil	\
333	libipmp		\
334	libipp		\
335	libkstat	\
336	libkvm		\
337        liblaadm        \
338	libmacadm	\
339	libmail		\
340	libmd		\
341	libmtmalloc	\
342	libnvpair	\
343	libnsl		\
344	libpam		\
345	libpctx		\
346	libpicl		\
347	libpicltree	\
348	libplot		\
349	libpool		\
350	libproc		\
351	librcm		\
352	libscf		\
353	libsip		\
354	libsmbios	\
355	librestart	\
356	librpcsvc	\
357	librsm		\
358	libsasl		\
359	libsec		\
360	libslp		\
361	libsmedia	\
362	libsysevent	\
363	libtecla	\
364	libtnf		\
365	libtnfctl	\
366	libtnfprobe	\
367	libtsnet	\
368	libtsol		\
369	libvolmgt	\
370	libumem		\
371	libuutil	\
372	libwrap		\
373	libxcurses2	\
374	libzfs		\
375	libzfs_jni	\
376	libzoneinfo	\
377	hal		\
378	policykit	\
379	lvm		\
380	openssl		\
381	pkcs11		\
382	passwdutil	\
383	../cmd/sendmail/libmilter	\
384	fm		\
385	udapl		\
386	libmapid	\
387	libkrb5		\
388	$($(MACH)_HDRSUBDIRS)
389
390$(CLOSED_BUILD)HDRSUBDIRS += \
391	$(CLOSED)/lib/libc_i18n	\
392	$(CLOSED)/lib/libike	\
393	$(CLOSED)/lib/smartcard
394
395sparc_HDRSUBDIRS=	\
396	libdscp		\
397	libwrsmconf
398
399all :=		TARGET= all
400check :=	TARGET= check
401clean :=	TARGET= clean
402clobber :=	TARGET= clobber
403install :=	TARGET= install
404install_h :=	TARGET= install_h
405lint :=		TARGET= lint
406_dc :=		TARGET= _dc
407_msg :=		TARGET= _msg
408
409.KEEP_STATE:
410
411#
412# For the all and install targets, we clearly must respect library
413# dependencies so that the libraries link correctly.  However, for
414# the remaining targets (check, clean, clobber, install_h, lint, _dc
415# and _msg), libraries do not have any dependencies on one another
416# and thus respecting dependencies just slows down the build.
417# As such, for these rules, we use pattern replacement to explicitly
418# avoid triggering the dependency information.  Note that for clean,
419# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
420# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
421#
422
423all:			$(SUBDIRS)
424
425install:		$(SUBDIRS) .WAIT install_extra
426
427# extra libraries kept in other source areas
428install_extra:
429	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
430	@pwd
431
432clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
433
434install_h check:	$(HDRSUBDIRS:%=%-nodepend)
435
436_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
437
438_dc:			$(DCSUBDIRS:%=%-nodepend)
439
440# dependencies for pam_modules (see below)
441$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
442
443#
444# Library interdependencies are called out explicitly here
445#
446auditd_plugins: libbsm libnsl libsecdb
447gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
448libadt_jni:	libbsm
449$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
450libbsm:		libtsol
451libcmdutils:	libavl
452libcontract:	libnvpair
453libdevid:	libdevinfo
454libdevinfo:	libnvpair libsec
455libdhcpagent:	libdhcputil libnsl libsocket
456libdhcpsvc:	libinetutil
457libdhcputil:	libinetutil
458libdladm:	libdlpi libdevinfo
459libdtrace:	libproc libgen libctf
460libdtrace_jni:	libuutil libdtrace
461libefi:		libuuid
462libfstyp:	libnvpair
463$(CLOSED_BUILD)$(CLOSED)/lib/libelfsign: \
464			$(CLOSED)/lib/libike libcryptoutil pkcs11
465libinetcfg:	libnsl libsocket libdevinfo
466libnsl:		libmd5 libscf
467libmapid:	libresolv libcmd
468libmacadm:	libdevinfo
469libuuid:	libsocket
470libinetutil:	libsocket
471libsecdb:	libcmd libnsl
472libsasl:	libgss libsocket pkcs11 libmd
473sasl_plugins:	pkcs11 libgss libsocket libsasl
474libsctp:	libsocket
475libsip:		libmd5
476libsocket:	libnsl
477libldap5:	libsasl libsocket libnsl libmd
478libsldap:	libldap5 libtsol
479libpool:	libnvpair libexacct
480libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
481		libbrand
482libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
483libproject:	libpool libproc libsecdb
484libtsnet:	libnsl libtsol libsecdb
485libwrap:	libnsl libsocket
486libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
487		libdhcputil openssl
488libwanbootutil:	libnsl
489pam_modules:	libproject passwdutil $(SMARTCARD)
490libscf:		libuutil libmd
491libinetsvc:	libscf
492librestart:	libuutil libscf
493../cmd/sgs/libdl:	../cmd/sgs/libconv
494../cmd/sgs/libelf:	../cmd/sgs/libconv
495pkcs11:		libcryptoutil
496print:		libldap5
497udapl/udapl_tavor:	udapl/libdat
498libzfs:		libdevinfo libdevid libgen libnvpair libuutil
499libzfs_jni:	libdiskmgt libnvpair libzfs
500libzpool:	libavl libumem libnvpair
501libsec:		libavl
502brand:		libc libsocket
503
504#
505# The reason this rule checks for the existence of the
506# Makefile is that some of the directories do not exist
507# in certain situations (e.g., exportable source builds,
508# OpenSolaris).
509#
510$(SUBDIRS): FRC
511	@if [ -f $@/Makefile  ]; then \
512		cd $@; pwd; $(MAKE) $(TARGET); \
513	else \
514		true; \
515	fi
516
517$(SUBDIRS:%=%-nodepend):
518	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
519		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
520	else \
521		true; \
522	fi
523
524FRC:
525