xref: /titanic_41/usr/src/lib/Makefile (revision 8d483882aa3390058094b043f3d62187b5d1de03)
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 2007 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	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	libcmd		\
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	libiscsitgt	\
112	libkmf		\
113	libkstat	\
114	libkvm		\
115	liblm		\
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	libraidcfg	.WAIT	\
200	librcm		.WAIT	\
201	libcfgadm	.WAIT	\
202	libpicl		.WAIT	\
203	libpicltree	.WAIT \
204	raidcfg_plugins	\
205	cfgadm_plugins	\
206	libmail		\
207	lvm		\
208	libsmedia	\
209	libipp		\
210	openssl		\
211	libdiskmgt	\
212	liblgrp		\
213	libfsmgt	\
214	fm		\
215	libavl		\
216	libcmdutils	\
217	libcontract	\
218	../cmd/sendmail/libmilter	\
219	sasl_plugins	\
220	udapl		\
221	libzpool	\
222	libzfs		\
223	libzfs_jni	\
224	libmapid	\
225	brand		\
226	policykit	\
227	hal		\
228	libshare	\
229	libsqlite	\
230	libidmap	\
231	libipmi		\
232	libexacct/demo	\
233	$($(MACH)_SUBDIRS)
234
235sparc_SUBDIRS= .WAIT	\
236	efcode		\
237	libc_psr	.WAIT	\
238	libdscp		\
239	libprtdiag	.WAIT	\
240	libprtdiag_psr	\
241	libpri		\
242	librsc		\
243	libfruutils	.WAIT	\
244	libfru		\
245	storage		\
246	libpcp
247
248FM_sparc_DEPLIBS= libpri
249
250fm: libexacct $(FM_$(MACH)_DEPLIBS)
251
252#
253# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
254# clean and clobber targets (for more information, see those targets, below).
255#
256NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
257
258DCSUBDIRS =		\
259	lvm
260
261MSGSUBDIRS=		\
262	abi		\
263	auditd_plugins	\
264	brand		\
265	cfgadm_plugins	\
266	gss_mechs/mech_dh	\
267	gss_mechs/mech_krb5	\
268	krb5		\
269	libbsm		\
270	libc		\
271	libcfgadm	\
272	libcontract	\
273	libcurses	\
274	libdhcpsvc 	\
275	libdhcputil	\
276	libipsecutil	\
277	libdiskmgt	\
278	libdladm	\
279	libgss		\
280	libidmap	\
281	libinetcfg	\
282	libipmp		\
283	libnsl		\
284	libpam		\
285	libpicl		\
286	libpool		\
287	libscf		\
288	libsasl		\
289	libldap5	\
290	libsecdb	\
291	libshare	\
292	libsldap	\
293	libslp		\
294	libsmedia	\
295	libtsol		\
296	libuutil	\
297	libwanboot	\
298	libwanbootutil	\
299	libzfs		\
300	libzonecfg	\
301	lvm		\
302	madv		\
303	mpss		\
304	pam_modules	\
305	rpcsec_gss
306$(CLOSED_BUILD)MSGSUBDIRS += \
307	$(CLOSED)/lib/smartcard
308MSGSUBDIRS += \
309	$($(MACH)_MSGSUBDIRS)
310
311sparc_MSGSUBDIRS=	\
312	libprtdiag	\
313	libprtdiag_psr
314
315HDRSUBDIRS=		\
316	auditd_plugins	\
317	libbrand	\
318	libbsm		\
319	libc		\
320	libcmdutils	\
321	libcontract	\
322	libcpc		\
323	libctf		\
324	libcurses	\
325	libcryptoutil	\
326	libdevice	\
327	libdevid	\
328	libdevinfo	\
329	libdiskmgt	\
330	libdladm	\
331	libdlpi		\
332	libdhcpagent	\
333	libdhcpsvc	\
334	libdhcputil	\
335	libdisasm	\
336	libdtrace	\
337	libdtrace_jni	\
338	libeti		\
339	libfstyp	\
340	libgen		\
341	libwanboot	\
342	libwanbootutil	\
343	libipsecutil	\
344	libinetcfg	\
345	libinetsvc	\
346	libinetutil	\
347	libipmi		\
348	libipmp		\
349	libipp		\
350	libiscsitgt	\
351	libkstat	\
352	libkvm		\
353	libmail		\
354	libmd		\
355	libmtmalloc	\
356	libnvpair	\
357	libnsl		\
358	libpam		\
359	libpctx		\
360	libpicl		\
361	libpicltree	\
362	libplot		\
363	libpool		\
364	libproc		\
365	libraidcfg	\
366	librcm		\
367	libscf		\
368	libsip		\
369	libsmbios	\
370	librestart	\
371	librpcsvc	\
372	librsm		\
373	libsasl		\
374	libsec		\
375	libslp		\
376	libsmedia	\
377	libsqlite	\
378	libsysevent	\
379	libtecla	\
380	libtnf		\
381	libtnfctl	\
382	libtnfprobe	\
383	libtsnet	\
384	libtsol		\
385	libvolmgt	\
386	libumem		\
387	libuutil	\
388	libwrap		\
389	libxcurses2	\
390	libzfs		\
391	libzfs_jni	\
392	libzoneinfo	\
393	hal		\
394	policykit	\
395	lvm		\
396	openssl		\
397	pkcs11		\
398	passwdutil	\
399	../cmd/sendmail/libmilter	\
400	fm		\
401	udapl		\
402	libmapid	\
403	libkrb5		\
404	libshare	\
405	libidmap	\
406	$($(MACH)_HDRSUBDIRS)
407
408$(CLOSED_BUILD)HDRSUBDIRS += \
409	$(CLOSED)/lib/libc_i18n	\
410	$(CLOSED)/lib/libike	\
411	$(CLOSED)/lib/smartcard
412
413sparc_HDRSUBDIRS=	\
414	libdscp		\
415	libpri
416
417all :=		TARGET= all
418check :=	TARGET= check
419clean :=	TARGET= clean
420clobber :=	TARGET= clobber
421install :=	TARGET= install
422install_h :=	TARGET= install_h
423lint :=		TARGET= lint
424_dc :=		TARGET= _dc
425_msg :=		TARGET= _msg
426
427.KEEP_STATE:
428
429#
430# For the all and install targets, we clearly must respect library
431# dependencies so that the libraries link correctly.  However, for
432# the remaining targets (check, clean, clobber, install_h, lint, _dc
433# and _msg), libraries do not have any dependencies on one another
434# and thus respecting dependencies just slows down the build.
435# As such, for these rules, we use pattern replacement to explicitly
436# avoid triggering the dependency information.  Note that for clean,
437# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
438# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
439#
440
441all:			$(SUBDIRS)
442
443install:		$(SUBDIRS) .WAIT install_extra
444
445# extra libraries kept in other source areas
446install_extra:
447	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
448	@pwd
449
450clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
451
452install_h check:	$(HDRSUBDIRS:%=%-nodepend)
453
454_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
455
456_dc:			$(DCSUBDIRS:%=%-nodepend)
457
458# dependencies for pam_modules (see below)
459$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
460
461#
462# Library interdependencies are called out explicitly here
463#
464auditd_plugins: libbsm libnsl libsecdb
465gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
466libadt_jni:	libbsm
467$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
468libbsm:		libtsol
469libcmdutils:	libavl
470libcontract:	libnvpair
471libdevid:	libdevinfo
472libdevinfo:	libnvpair libsec
473libdhcpagent:	libsocket libdhcputil libuuid libdlpi
474libdhcpsvc:	libinetutil
475libdhcputil:	libnsl libgen libinetutil libdlpi
476libdladm:	libdlpi libdevinfo libinetutil libsocket
477libdlpi:	libinetutil
478libdtrace:	libproc libgen libctf
479libdtrace_jni:	libuutil libdtrace
480libefi:		libuuid
481libfstyp:	libnvpair
482$(CLOSED_BUILD)$(CLOSED)/lib/libelfsign: \
483			$(CLOSED)/lib/libike libcryptoutil pkcs11
484libidmap:	libnsl
485libinetcfg:	libnsl libsocket libdevinfo
486libkmf:		libcryptoutil pkcs11 openssl
487libnsl:		libmd5 libscf
488libmapid:	libresolv
489libuuid:	libdlpi libdladm
490libinetutil:	libsocket
491libsecdb:	libnsl
492libsasl:	libgss libsocket pkcs11 libmd
493sasl_plugins:	pkcs11 libgss libsocket libsasl
494libsctp:	libsocket
495libsip:		libmd5
496libsocket:	libnsl
497libldap5:	libsasl libsocket libnsl libmd
498libsldap:	libldap5 libtsol
499libpool:	libnvpair libexacct
500libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
501		libbrand libpool libscf
502libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
503libproject:	libpool libproc libsecdb
504libtsnet:	libnsl libtsol libsecdb
505libwrap:	libnsl libsocket
506libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
507		libdhcputil openssl
508libwanbootutil:	libnsl
509pam_modules:	libproject passwdutil $(SMARTCARD)
510libscf:		libuutil libmd libgen
511libinetsvc:	libscf
512librestart:	libuutil libscf
513../cmd/sgs/libdl:	../cmd/sgs/libconv
514../cmd/sgs/libelf:	../cmd/sgs/libconv
515pkcs11:		libcryptoutil
516print:		libldap5
517udapl/udapl_tavor:	udapl/libdat
518libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
519libzfs_jni:	libdiskmgt libnvpair libzfs
520libzpool:	libavl libumem libnvpair
521libsec:		libavl
522brand:		libc libsocket
523libshare:	libscf libzfs libuuid libfsmgt libsecdb
524libexacct/demo:	libexacct libproject libsocket libnsl
525
526#
527# The reason this rule checks for the existence of the
528# Makefile is that some of the directories do not exist
529# in certain situations (e.g., exportable source builds,
530# OpenSolaris).
531#
532$(SUBDIRS): FRC
533	@if [ -f $@/Makefile  ]; then \
534		cd $@; pwd; $(MAKE) $(TARGET); \
535	else \
536		true; \
537	fi
538
539$(SUBDIRS:%=%-nodepend):
540	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
541		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
542	else \
543		true; \
544	fi
545
546FRC:
547