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