xref: /illumos-gate/usr/src/lib/Makefile (revision 7f7322febbcfe774b7270abc3b191c094bfcc517)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
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	abi/apptrace		.WAIT	\
58	../cmd/abi/spectrans	.WAIT	\
59	../cmd/sgs/libconv		\
60	../cmd/sgs/libdl	.WAIT
61
62$(CLOSED_BUILD)SUBDIRS += \
63	$(CLOSED)/lib/libc_i18n
64
65SUBDIRS += \
66	libc			.WAIT	\
67	libmapmalloc		.WAIT	\
68	../cmd/sgs/libelf	.WAIT	\
69	libmd5				\
70	librsm				\
71	libmp			.WAIT	\
72	libcmd			\
73	libnsl			\
74	libsecdb		.WAIT	\
75	librpcsvc			\
76	libsocket		.WAIT	\
77	libsctp			\
78	libresolv			\
79	libresolv2		.WAIT	\
80	libw			.WAIT	\
81	libintl			.WAIT	\
82	../cmd/sgs/librtld_db	\
83	libaio			\
84	librt			\
85	libadm			\
86	libctf			\
87	libdtrace		\
88	libcurses		\
89	libgen			\
90	libgss			\
91	libpam			\
92	libuuid			\
93	libthread		\
94	libpthread	.WAIT	\
95	libslp		\
96	libbsdmalloc	\
97	libdoor		\
98	libdevinfo	\
99	libdladm	\
100	libdlpi		\
101	libeti		\
102	libcrypt	\
103	libefi		\
104	libwanboot	\
105	libwanbootutil	\
106	libcryptoutil	\
107	libinetcfg	\
108	libinetutil	\
109	libipmp		\
110	libkstat	\
111	libkvm		\
112        liblaadm        \
113	liblm		\
114	libmacadm	\
115	libmalloc	\
116	libmtmalloc	\
117	libnls		\
118	libsmbios	\
119	libtecla	\
120	libumem		\
121	libnvpair	.WAIT	\
122	libexacct	\
123	libplot		\
124	libldap4	\
125	libsasl		\
126	libldap5	\
127	libsldap	.WAIT	\
128	libbsm		\
129	libsys		\
130	libsysevent	\
131	libnisdb	\
132	libpool		\
133	libproc		\
134	libproject	\
135	libsendfile	\
136	nametoaddr	\
137	ncad_addr	\
138	gss_mechs/mech_krb5	.WAIT	\
139	krb5	.WAIT
140$(CLOSED_BUILD)SUBDIRS += \
141	$(CLOSED)/lib/smartcard
142SUBDIRS += \
143	passwdutil	\
144	pam_modules	\
145	crypt_modules	\
146	libadt_jni	\
147	auditd_plugins	\
148	libvolmgt	\
149	libdevice	\
150	libdevid	\
151	libdhcpsvc	\
152	libc_db		\
153	libsec		\
154	libtnfprobe	\
155	libtnf		\
156	libtnfctl	\
157	libdhcpagent	\
158	libdhcpdu	\
159	libdhcputil	\
160	libipsecutil
161$(CLOSED_BUILD)SUBDIRS += \
162	$(CLOSED)/lib/libike
163SUBDIRS += \
164	nsswitch	\
165	print		\
166	libuutil	\
167	libscf		\
168	libinetsvc	\
169	librestart	\
170	libsched
171$(CLOSED_BUILD)SUBDIRS += \
172	$(CLOSED)/lib/libelfsign
173SUBDIRS += \
174	pkcs11		.WAIT	\
175	libpctx		.WAIT	\
176	libcpc		\
177	watchmalloc	\
178	madv		\
179	mpss		\
180	libwrap		\
181	libxcurses	\
182	libxcurses2	\
183	libxnet		\
184	libzonecfg	\
185	libzoneinfo	\
186	gss_mechs/mech_spnego	\
187	gss_mechs/mech_dummy	\
188	gss_mechs/mech_dh	\
189	rpcsec_gss	\
190	librcm		.WAIT	\
191	libcfgadm	.WAIT	\
192	libpicl		.WAIT	\
193	libpicltree	.WAIT \
194	cfgadm_plugins	\
195	libmail		\
196	lvm		\
197	libsmedia	\
198	libipp		\
199	openssl		\
200	libdiskmgt	\
201	liblgrp		\
202	libfsmgt	\
203	fm		\
204	libavl		\
205	libcmdutils	\
206	libcontract	\
207	../cmd/sendmail/libmilter	\
208	sasl_plugins	\
209	udapl		\
210	libzpool	\
211	libzfs		\
212	libzfs_jni	\
213	$($(MACH)_SUBDIRS)
214
215sparc_SUBDIRS= .WAIT	\
216	efcode		\
217	libc_psr	.WAIT	\
218	libmd5_psr	.WAIT
219$(CLOSED_BUILD)sparc_SUBDIRS += \
220	$(CLOSED)/lib/libprtdiag	.WAIT	\
221	$(CLOSED)/lib/libprtdiag_psr	\
222	$(CLOSED)/lib/librsc
223sparc_SUBDIRS += \
224	libfruutils	.WAIT	\
225	libfru		\
226	libwrsmconf	\
227	storage		\
228	wrsm		\
229	libpcp
230
231fm: libexacct
232
233#
234# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
235# clean and clobber targets (for more information, see those targets, below).
236#
237NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
238
239DCSUBDIRS =		\
240	lvm
241
242MSGSUBDIRS=		\
243	abi		\
244	auditd_plugins	\
245	cfgadm_plugins	\
246	gss_mechs/mech_dh	\
247	gss_mechs/mech_krb5	\
248	krb5		\
249	libbsm		\
250	libc		\
251	libcfgadm	\
252	libcontract	\
253	libcurses	\
254	libdhcpsvc 	\
255	libdhcputil	\
256	libgss		\
257	libinetcfg	\
258	libipmp		\
259	libnsl		\
260	libpam		\
261	libpicl		\
262	libpool		\
263	libscf		\
264	libsasl		\
265	libldap5	\
266	libsecdb	\
267	libsldap	\
268	libslp		\
269	libsmedia	\
270	libuutil	\
271	libwanboot	\
272	libwanbootutil	\
273	libzonecfg	\
274	lvm		\
275	madv		\
276	mpss		\
277	pam_modules	\
278	rpcsec_gss
279$(CLOSED_BUILD)MSGSUBDIRS += \
280	$(CLOSED)/lib/smartcard
281MSGSUBDIRS += \
282	$($(MACH)_MSGSUBDIRS)
283
284sparc_MSGSUBDIRS=
285
286$(CLOSED_BUILD)sparc_MSGSUBDIRS +=	\
287	$(CLOSED)/lib/libprtdiag	\
288	$(CLOSED)/lib/libprtdiag_psr
289
290HDRSUBDIRS= libaio	\
291	auditd_plugins	\
292	libbsm		\
293	libc		\
294	libcmdutils	\
295	libcontract	\
296	libcpc		\
297	libctf		\
298	libcurses	\
299	libcryptoutil	\
300	libdevice	\
301	libdevid	\
302	libdevinfo	\
303	libdiskmgt	\
304	libdladm	\
305	libdlpi		\
306	libdhcpagent	\
307	libdhcpsvc	\
308	libdhcputil	\
309	libdtrace	\
310	libeti		\
311	libgen		\
312	libwanboot	\
313	libwanbootutil	\
314	libipsecutil	\
315	libinetcfg	\
316	libinetsvc	\
317	libinetutil	\
318	libipmp		\
319	libipp		\
320	libkstat	\
321	libkvm		\
322        liblaadm        \
323	libmacadm	\
324	libmail		\
325	libmtmalloc	\
326	libnvpair	\
327	libpam		\
328	libpctx		\
329	libpicl		\
330	libpicltree	\
331	libplot		\
332	libpool		\
333	libproc		\
334	librcm		\
335	libscf		\
336	libsmbios	\
337	librestart	\
338	librpcsvc	\
339	librsm		\
340	libsasl		\
341	libsec		\
342	libslp		\
343	libsmedia	\
344	libsysevent	\
345	libtecla	\
346	libtnf		\
347	libtnfctl	\
348	libtnfprobe	\
349	libvolmgt	\
350	libumem		\
351	libuutil	\
352	libwrap		\
353	libxcurses2	\
354	libzfs		\
355	libzfs_jni	\
356	libzoneinfo	\
357	lvm		\
358	openssl		\
359	pkcs11		\
360	passwdutil	\
361	../cmd/sendmail/libmilter	\
362	fm		\
363	udapl		\
364	$($(MACH)_HDRSUBDIRS)
365
366$(CLOSED_BUILD)HDRSUBDIRS += \
367	$(CLOSED)/lib/libc_i18n	\
368	$(CLOSED)/lib/libike	\
369	$(CLOSED)/lib/smartcard
370
371sparc_HDRSUBDIRS=	\
372	libwrsmconf
373
374all :=		TARGET= all
375check :=	TARGET= check
376clean :=	TARGET= clean
377clobber :=	TARGET= clobber
378install :=	TARGET= install
379install_h :=	TARGET= install_h
380lint :=		TARGET= lint
381_dc :=		TARGET= _dc
382_msg :=		TARGET= _msg
383
384.KEEP_STATE:
385
386#
387# For the all and install targets, we clearly must respect library
388# dependencies so that the libraries link correctly.  However, for
389# the remaining targets (check, clean, clobber, install_h, lint, _dc
390# and _msg), libraries do not have any dependencies on one another
391# and thus respecting dependencies just slows down the build.
392# As such, for these rules, we use pattern replacement to explicitly
393# avoid triggering the dependency information.  Note that for clean,
394# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
395# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
396#
397
398all:			$(SUBDIRS)
399
400install:		$(SUBDIRS) .WAIT install_extra
401
402# extra libraries kept in other source areas
403install_extra:
404	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
405	@pwd
406
407clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
408
409install_h check:	$(HDRSUBDIRS:%=%-nodepend)
410
411_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
412
413_dc:			$(DCSUBDIRS:%=%-nodepend)
414
415# dependencies for pam_modules (see below)
416$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
417
418#
419# Library interdependencies are called out explicitly here
420#
421auditd_plugins: libbsm libnsl libsecdb
422gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
423libadt_jni:	libbsm
424$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
425libcmdutils:	libavl
426libcontract:	libnvpair
427libdevid:	libdevinfo
428libdevinfo:	libnvpair libsec
429libdhcpagent:	libdhcputil libnsl libsocket
430libdhcpsvc:	libinetutil
431libdhcputil:	libinetutil
432libdladm:	libdlpi libdevinfo
433libdtrace:	libproc libgen libctf
434libefi:		libuuid
435$(CLOSED_BUILD)$(CLOSED)/lib/libelfsign: \
436			$(CLOSED)/lib/libike libcryptoutil pkcs11
437libinetcfg:	libnsl libsocket libdevinfo
438libnsl:		libmd5 libscf
439libmacadm:	libdevinfo
440libuuid:	libsocket
441libinetutil:	libsocket
442libsecdb:	libcmd libnsl
443librt:		libaio libmd5
444libsasl:	libgss libsocket pkcs11 libmd5
445sasl_plugins:	pkcs11 libgss libsocket libsasl
446libsctp:	libsocket
447libsocket:	libnsl
448libldap5:	libsasl libsocket libnsl libmd5
449libsldap:	libldap5
450libpool:	libnvpair libexacct
451libproject:	libpool libproc libsecdb
452libwrap:	libnsl libsocket
453libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
454		libdhcputil openssl
455libwanbootutil:	libnsl
456pam_modules:	libproject passwdutil $(SMARTCARD)
457libscf:		libuutil
458libinetsvc:	libscf
459librestart:	libuutil libscf
460../cmd/sgs/libdl:	../cmd/sgs/libconv
461../cmd/sgs/libelf:	../cmd/sgs/libconv
462pkcs11:		libcryptoutil
463print:		libldap5
464udapl/udapl_tavor:	udapl/libdat
465libzfs:		libdevinfo libdevid libgen libnvpair libuutil
466libzfs_jni:	libdiskmgt libnvpair libzfs
467libzpool:	libavl libumem libnvpair
468
469#
470# The reason this rule checks for the existence of the
471# Makefile is that some of the directories do not exist
472# in certain situations (e.g., exportable source builds,
473# OpenSolaris).
474#
475$(SUBDIRS) abi: FRC
476	@if [ -f $@/Makefile  ]; then \
477		cd $@; pwd; $(MAKE) $(TARGET); \
478	else \
479		true; \
480	fi
481
482$(SUBDIRS:%=%-nodepend) abi-nodepend:
483	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
484		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
485	else \
486		true; \
487	fi
488
489FRC:
490