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