xref: /titanic_41/usr/src/lib/Makefile (revision 058561cbaa119a6f2659bc27ef343e1b47266bb2)
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        liblaadm        \
116	liblm		\
117	libmacadm	\
118	libmalloc	\
119	libmapmalloc	\
120	libmtmalloc	\
121	libnls		\
122	libsmbios	\
123	libtecla	\
124	libumem		\
125	libnvpair	.WAIT	\
126	libexacct	\
127	libplot		\
128	libldap4	\
129	libsasl		\
130	libldap5	\
131	libsldap	.WAIT	\
132	libbsm		\
133	libsys		\
134	libsysevent	\
135	libnisdb	\
136	libpool		\
137	libproc		\
138	libproject	\
139	libsendfile	\
140	nametoaddr	\
141	ncad_addr	\
142	gss_mechs/mech_krb5	.WAIT	\
143	libkrb5	.WAIT	\
144	krb5	.WAIT
145$(CLOSED_BUILD)SUBDIRS += \
146	$(CLOSED)/lib/smartcard
147SUBDIRS += \
148	passwdutil	\
149	pam_modules	\
150	crypt_modules	\
151	libadt_jni	\
152	abi		\
153	auditd_plugins	\
154	libvolmgt	\
155	libdevice	\
156	libdevid	\
157	libdhcpsvc	\
158	libc_db		\
159	libsec		\
160	libtnfprobe	\
161	libtnf		\
162	libtnfctl	\
163	libdhcpagent	\
164	libdhcpdu	\
165	libdhcputil	\
166	libipsecutil
167$(CLOSED_BUILD)SUBDIRS += \
168	$(CLOSED)/lib/libike
169SUBDIRS += \
170	nsswitch	\
171	print		\
172	libuutil	\
173	libscf		\
174	libinetsvc	\
175	librestart	\
176	libsched
177$(CLOSED_BUILD)SUBDIRS += \
178	$(CLOSED)/lib/libelfsign
179SUBDIRS += \
180	pkcs11		.WAIT	\
181	libpctx		.WAIT	\
182	libcpc		\
183	watchmalloc	\
184	extendedFILE	\
185	madv		\
186	mpss		\
187	libdisasm	\
188	libwladm	\
189	libwrap		\
190	libxcurses	\
191	libxcurses2	\
192	libxnet		\
193	libbrand	.WAIT   \
194	libzonecfg	\
195	libzoneinfo	\
196	libtsnet	\
197	libtsol		\
198	gss_mechs/mech_spnego	\
199	gss_mechs/mech_dummy	\
200	gss_mechs/mech_dh	\
201	rpcsec_gss	\
202	libraidcfg	.WAIT	\
203	librcm		.WAIT	\
204	libcfgadm	.WAIT	\
205	libpicl		.WAIT	\
206	libpicltree	.WAIT \
207	raidcfg_plugins	\
208	cfgadm_plugins	\
209	libmail		\
210	lvm		\
211	libsmedia	\
212	libipp		\
213	openssl		\
214	libdiskmgt	\
215	liblgrp		\
216	libfsmgt	\
217	fm		\
218	libavl		\
219	libcmdutils	\
220	libcontract	\
221	../cmd/sendmail/libmilter	\
222	sasl_plugins	\
223	udapl		\
224	libzpool	\
225	libzfs		\
226	libzfs_jni	\
227	libmapid	\
228	brand		\
229	policykit	\
230	hal		\
231	libshare	\
232	$($(MACH)_SUBDIRS)
233
234sparc_SUBDIRS= .WAIT	\
235	efcode		\
236	libc_psr	.WAIT	\
237	libdscp		\
238	libprtdiag	.WAIT	\
239	libprtdiag_psr	\
240	libpri		\
241	librsc		\
242	libfruutils	.WAIT	\
243	libfru		\
244	libwrsmconf	\
245	storage		\
246	wrsm		\
247	libpcp
248
249FM_sparc_DEPLIBS= libpri
250
251fm: libexacct $(FM_$(MACH)_DEPLIBS)
252
253#
254# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
255# clean and clobber targets (for more information, see those targets, below).
256#
257NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
258
259DCSUBDIRS =		\
260	lvm
261
262MSGSUBDIRS=		\
263	abi		\
264	auditd_plugins	\
265	brand		\
266	cfgadm_plugins	\
267	gss_mechs/mech_dh	\
268	gss_mechs/mech_krb5	\
269	krb5		\
270	libbsm		\
271	libc		\
272	libcfgadm	\
273	libcontract	\
274	libcurses	\
275	libdhcpsvc 	\
276	libdhcputil	\
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	libwladm	\
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	libipmp		\
347	libipp		\
348	libiscsitgt	\
349	libkstat	\
350	libkvm		\
351        liblaadm        \
352	libmacadm	\
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	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	libwladm	\
387	libwrap		\
388	libxcurses2	\
389	libzfs		\
390	libzfs_jni	\
391	libzoneinfo	\
392	hal		\
393	policykit	\
394	lvm		\
395	openssl		\
396	pkcs11		\
397	passwdutil	\
398	../cmd/sendmail/libmilter	\
399	fm		\
400	udapl		\
401	libmapid	\
402	libkrb5		\
403	libshare	\
404	$($(MACH)_HDRSUBDIRS)
405
406$(CLOSED_BUILD)HDRSUBDIRS += \
407	$(CLOSED)/lib/libc_i18n	\
408	$(CLOSED)/lib/libike	\
409	$(CLOSED)/lib/smartcard
410
411sparc_HDRSUBDIRS=	\
412	libdscp		\
413	libpri		\
414	libwrsmconf
415
416all :=		TARGET= all
417check :=	TARGET= check
418clean :=	TARGET= clean
419clobber :=	TARGET= clobber
420install :=	TARGET= install
421install_h :=	TARGET= install_h
422lint :=		TARGET= lint
423_dc :=		TARGET= _dc
424_msg :=		TARGET= _msg
425
426.KEEP_STATE:
427
428#
429# For the all and install targets, we clearly must respect library
430# dependencies so that the libraries link correctly.  However, for
431# the remaining targets (check, clean, clobber, install_h, lint, _dc
432# and _msg), libraries do not have any dependencies on one another
433# and thus respecting dependencies just slows down the build.
434# As such, for these rules, we use pattern replacement to explicitly
435# avoid triggering the dependency information.  Note that for clean,
436# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
437# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
438#
439
440all:			$(SUBDIRS)
441
442install:		$(SUBDIRS) .WAIT install_extra
443
444# extra libraries kept in other source areas
445install_extra:
446	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
447	@pwd
448
449clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
450
451install_h check:	$(HDRSUBDIRS:%=%-nodepend)
452
453_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
454
455_dc:			$(DCSUBDIRS:%=%-nodepend)
456
457# dependencies for pam_modules (see below)
458$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
459
460#
461# Library interdependencies are called out explicitly here
462#
463auditd_plugins: libbsm libnsl libsecdb
464gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
465libadt_jni:	libbsm
466$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
467libbsm:		libtsol
468libcmdutils:	libavl
469libcontract:	libnvpair
470libdevid:	libdevinfo
471libdevinfo:	libnvpair libsec
472libdhcpagent:	libsocket libdhcputil libuuid libdlpi
473libdhcpsvc:	libinetutil
474libdhcputil:	libnsl libgen libinetutil libdlpi
475libdladm:	libdlpi libdevinfo libwladm 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
486libmacadm:	libdevinfo
487libuuid:	libsocket
488libinetutil:	libsocket
489libsecdb:	libnsl
490libsasl:	libgss libsocket pkcs11 libmd
491sasl_plugins:	pkcs11 libgss libsocket libsasl
492libsctp:	libsocket
493libsip:		libmd5
494libsocket:	libnsl
495libldap5:	libsasl libsocket libnsl libmd
496libsldap:	libldap5 libtsol
497libpool:	libnvpair libexacct
498libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
499		libbrand libpool libscf
500libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
501libproject:	libpool libproc libsecdb
502libtsnet:	libnsl libtsol libsecdb
503libwrap:	libnsl libsocket
504libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
505		libdhcputil openssl
506libwanbootutil:	libnsl
507libwladm:	libdevinfo libsocket
508pam_modules:	libproject passwdutil $(SMARTCARD)
509libscf:		libuutil libmd
510libinetsvc:	libscf
511librestart:	libuutil libscf
512../cmd/sgs/libdl:	../cmd/sgs/libconv
513../cmd/sgs/libelf:	../cmd/sgs/libconv
514pkcs11:		libcryptoutil
515print:		libldap5
516udapl/udapl_tavor:	udapl/libdat
517libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
518libzfs_jni:	libdiskmgt libnvpair libzfs
519libzpool:	libavl libumem libnvpair
520libsec:		libavl
521brand:		libc libsocket
522libshare:	libscf libzfs libuuid libfsmgt libsecdb
523
524#
525# The reason this rule checks for the existence of the
526# Makefile is that some of the directories do not exist
527# in certain situations (e.g., exportable source builds,
528# OpenSolaris).
529#
530$(SUBDIRS): FRC
531	@if [ -f $@/Makefile  ]; then \
532		cd $@; pwd; $(MAKE) $(TARGET); \
533	else \
534		true; \
535	fi
536
537$(SUBDIRS:%=%-nodepend):
538	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
539		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
540	else \
541		true; \
542	fi
543
544FRC:
545