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