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