xref: /illumos-gate/usr/src/lib/Makefile (revision 685482d6dae8b0c167f468d6313a738ae17c592c)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26
27include ../Makefile.master
28
29#	Note that libcurses installs commands along with its library.
30#	This is a minor bug which probably should be fixed.
31#	Note also that a few extra libraries are kept in cmd source.
32#
33# Certain libraries are linked with, hence depend on, other libraries.
34#
35# Although we have historically used .WAIT to express dependencies, it
36# reduces the amount of parallelism and thus lengthens the time it
37# takes to build the libraries.  Thus, we now require that any new
38# libraries explicitly call out their dependencies.  Eventually, all
39# the library dependencies will be called out explicitly.  See
40# "Library interdependencies" near the end of this file.
41#
42# Aside from explicit dependencies (and legacy .WAITs), all libraries
43# are built in parallel.
44#
45.PARALLEL:
46
47#
48# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
49# but required due to the "dependencies" of using .WAIT to barrier the
50# parallel dmake builds.  once 4631488 has been fixed, they can be
51# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
52# shown in HDRSUBDIRS
53#
54SUBDIRS= \
55	common			.WAIT	\
56	abi/apptrace		.WAIT	\
57	../cmd/abi/spectrans	.WAIT	\
58	../cmd/sgs/libconv		\
59	../cmd/sgs/libdl	.WAIT
60
61$(CLOSED_BUILD)SUBDIRS += \
62	$(CLOSED)/lib/libc_i18n
63
64SUBDIRS += \
65	libc			.WAIT	\
66	libmapmalloc		.WAIT	\
67	../cmd/sgs/libelf	.WAIT	\
68	libmd				\
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	libdtrace_jni		\
89	libcurses		\
90	libgen			\
91	libgss			\
92	libpam			\
93	libuuid			\
94	libthread		\
95	libpthread	.WAIT	\
96	libslp		\
97	libbsdmalloc	\
98	libdoor		\
99	libdevinfo	\
100	libdladm	\
101	libdlpi		\
102	libeti		\
103	libcrypt	\
104	libefi		\
105	libwanboot	\
106	libwanbootutil	\
107	libcryptoutil	\
108	libinetcfg	\
109	libinetutil	\
110	libipmp		\
111	libkstat	\
112	libkvm		\
113        liblaadm        \
114	liblm		\
115	libmacadm	\
116	libmalloc	\
117	libmtmalloc	\
118	libnls		\
119	libsmbios	\
120	libtecla	\
121	libumem		\
122	libnvpair	.WAIT	\
123	libexacct	\
124	libplot		\
125	libldap4	\
126	libsasl		\
127	libldap5	\
128	libsldap	.WAIT	\
129	libbsm		\
130	libsys		\
131	libsysevent	\
132	libnisdb	\
133	libpool		\
134	libproc		\
135	libproject	\
136	libsendfile	\
137	nametoaddr	\
138	ncad_addr	\
139	gss_mechs/mech_krb5	.WAIT	\
140	krb5	.WAIT
141$(CLOSED_BUILD)SUBDIRS += \
142	$(CLOSED)/lib/smartcard
143SUBDIRS += \
144	passwdutil	\
145	pam_modules	\
146	crypt_modules	\
147	libadt_jni	\
148	auditd_plugins	\
149	libvolmgt	\
150	libdevice	\
151	libdevid	\
152	libdhcpsvc	\
153	libc_db		\
154	libsec		\
155	libtnfprobe	\
156	libtnf		\
157	libtnfctl	\
158	libdhcpagent	\
159	libdhcpdu	\
160	libdhcputil	\
161	libipsecutil
162$(CLOSED_BUILD)SUBDIRS += \
163	$(CLOSED)/lib/libike
164SUBDIRS += \
165	nsswitch	\
166	print		\
167	libuutil	\
168	libscf		\
169	libinetsvc	\
170	librestart	\
171	libsched
172$(CLOSED_BUILD)SUBDIRS += \
173	$(CLOSED)/lib/libelfsign
174SUBDIRS += \
175	pkcs11		.WAIT	\
176	libpctx		.WAIT	\
177	libcpc		\
178	watchmalloc	\
179	madv		\
180	mpss		\
181	libdisasm	\
182	libwrap		\
183	libxcurses	\
184	libxcurses2	\
185	libxnet		\
186	libzonecfg	\
187	libzoneinfo	\
188	libtsnet	\
189	libtsol		\
190	gss_mechs/mech_spnego	\
191	gss_mechs/mech_dummy	\
192	gss_mechs/mech_dh	\
193	rpcsec_gss	\
194	librcm		.WAIT	\
195	libcfgadm	.WAIT	\
196	libpicl		.WAIT	\
197	libpicltree	.WAIT \
198	cfgadm_plugins	\
199	libmail		\
200	lvm		\
201	libsmedia	\
202	libipp		\
203	openssl		\
204	libdiskmgt	\
205	liblgrp		\
206	libfsmgt	\
207	fm		\
208	libavl		\
209	libcmdutils	\
210	libcontract	\
211	../cmd/sendmail/libmilter	\
212	sasl_plugins	\
213	udapl		\
214	libzpool	\
215	libzfs		\
216	libzfs_jni	\
217	$($(MACH)_SUBDIRS)
218
219sparc_SUBDIRS= .WAIT	\
220	efcode		\
221	libc_psr	.WAIT
222$(CLOSED_BUILD)sparc_SUBDIRS += \
223	$(CLOSED)/lib/libprtdiag	.WAIT	\
224	$(CLOSED)/lib/libprtdiag_psr	\
225	$(CLOSED)/lib/librsc
226sparc_SUBDIRS += \
227	libfruutils	.WAIT	\
228	libfru		\
229	libwrsmconf	\
230	storage		\
231	wrsm		\
232	libpcp
233
234fm: libexacct
235
236#
237# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
238# clean and clobber targets (for more information, see those targets, below).
239#
240NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
241
242DCSUBDIRS =		\
243	lvm
244
245MSGSUBDIRS=		\
246	abi		\
247	auditd_plugins	\
248	cfgadm_plugins	\
249	gss_mechs/mech_dh	\
250	gss_mechs/mech_krb5	\
251	krb5		\
252	libbsm		\
253	libc		\
254	libcfgadm	\
255	libcontract	\
256	libcurses	\
257	libdhcpsvc 	\
258	libdhcputil	\
259	libgss		\
260	libinetcfg	\
261	libipmp		\
262	libnsl		\
263	libpam		\
264	libpicl		\
265	libpool		\
266	libscf		\
267	libsasl		\
268	libldap5	\
269	libsecdb	\
270	libsldap	\
271	libslp		\
272	libsmedia	\
273	libtsol		\
274	libuutil	\
275	libwanboot	\
276	libwanbootutil	\
277	libzonecfg	\
278	lvm		\
279	madv		\
280	mpss		\
281	pam_modules	\
282	rpcsec_gss
283$(CLOSED_BUILD)MSGSUBDIRS += \
284	$(CLOSED)/lib/smartcard
285MSGSUBDIRS += \
286	$($(MACH)_MSGSUBDIRS)
287
288sparc_MSGSUBDIRS=
289
290$(CLOSED_BUILD)sparc_MSGSUBDIRS +=	\
291	$(CLOSED)/lib/libprtdiag	\
292	$(CLOSED)/lib/libprtdiag_psr
293
294HDRSUBDIRS= libaio	\
295	auditd_plugins	\
296	libbsm		\
297	libc		\
298	libcmdutils	\
299	libcontract	\
300	libcpc		\
301	libctf		\
302	libcurses	\
303	libcryptoutil	\
304	libdevice	\
305	libdevid	\
306	libdevinfo	\
307	libdiskmgt	\
308	libdladm	\
309	libdlpi		\
310	libdhcpagent	\
311	libdhcpsvc	\
312	libdhcputil	\
313	libdisasm	\
314	libdtrace	\
315	libdtrace_jni	\
316	libeti		\
317	libgen		\
318	libwanboot	\
319	libwanbootutil	\
320	libipsecutil	\
321	libinetcfg	\
322	libinetsvc	\
323	libinetutil	\
324	libipmp		\
325	libipp		\
326	libkstat	\
327	libkvm		\
328        liblaadm        \
329	libmacadm	\
330	libmail		\
331	libmd		\
332	libmtmalloc	\
333	libnvpair	\
334	libnsl		\
335	libpam		\
336	libpctx		\
337	libpicl		\
338	libpicltree	\
339	libplot		\
340	libpool		\
341	libproc		\
342	librcm		\
343	libscf		\
344	libsmbios	\
345	librestart	\
346	librpcsvc	\
347	librsm		\
348	libsasl		\
349	libsec		\
350	libslp		\
351	libsmedia	\
352	libsysevent	\
353	libtecla	\
354	libtnf		\
355	libtnfctl	\
356	libtnfprobe	\
357	libtsnet	\
358	libtsol		\
359	libvolmgt	\
360	libumem		\
361	libuutil	\
362	libwrap		\
363	libxcurses2	\
364	libzfs		\
365	libzfs_jni	\
366	libzoneinfo	\
367	lvm		\
368	openssl		\
369	pkcs11		\
370	passwdutil	\
371	../cmd/sendmail/libmilter	\
372	fm		\
373	udapl		\
374	$($(MACH)_HDRSUBDIRS)
375
376$(CLOSED_BUILD)HDRSUBDIRS += \
377	$(CLOSED)/lib/libc_i18n	\
378	$(CLOSED)/lib/libike	\
379	$(CLOSED)/lib/smartcard
380
381sparc_HDRSUBDIRS=	\
382	libwrsmconf
383
384all :=		TARGET= all
385check :=	TARGET= check
386clean :=	TARGET= clean
387clobber :=	TARGET= clobber
388install :=	TARGET= install
389install_h :=	TARGET= install_h
390lint :=		TARGET= lint
391_dc :=		TARGET= _dc
392_msg :=		TARGET= _msg
393
394.KEEP_STATE:
395
396#
397# For the all and install targets, we clearly must respect library
398# dependencies so that the libraries link correctly.  However, for
399# the remaining targets (check, clean, clobber, install_h, lint, _dc
400# and _msg), libraries do not have any dependencies on one another
401# and thus respecting dependencies just slows down the build.
402# As such, for these rules, we use pattern replacement to explicitly
403# avoid triggering the dependency information.  Note that for clean,
404# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
405# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
406#
407
408all:			$(SUBDIRS)
409
410install:		$(SUBDIRS) .WAIT install_extra
411
412# extra libraries kept in other source areas
413install_extra:
414	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
415	@pwd
416
417clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
418
419install_h check:	$(HDRSUBDIRS:%=%-nodepend)
420
421_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
422
423_dc:			$(DCSUBDIRS:%=%-nodepend)
424
425# dependencies for pam_modules (see below)
426$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
427
428#
429# Library interdependencies are called out explicitly here
430#
431auditd_plugins: libbsm libnsl libsecdb
432gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
433libadt_jni:	libbsm
434$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
435libbsm:		libtsol
436libcmdutils:	libavl
437libcontract:	libnvpair
438libdevid:	libdevinfo
439libdevinfo:	libnvpair libsec
440libdhcpagent:	libdhcputil libnsl libsocket
441libdhcpsvc:	libinetutil
442libdhcputil:	libinetutil
443libdladm:	libdlpi libdevinfo
444libdtrace:	libproc libgen libctf
445libdtrace_jni:	libuutil libdtrace
446libefi:		libuuid
447$(CLOSED_BUILD)$(CLOSED)/lib/libelfsign: \
448			$(CLOSED)/lib/libike libcryptoutil pkcs11
449libinetcfg:	libnsl libsocket libdevinfo
450libnsl:		libmd5 libscf
451libmacadm:	libdevinfo
452libuuid:	libsocket
453libinetutil:	libsocket
454libsecdb:	libcmd libnsl
455librt:		libaio libmd
456libsasl:	libgss libsocket pkcs11 libmd
457sasl_plugins:	pkcs11 libgss libsocket libsasl
458libsctp:	libsocket
459libsocket:	libnsl
460libldap5:	libsasl libsocket libnsl libmd
461libsldap:	libldap5 libtsol
462libpool:	libnvpair libexacct
463libproject:	libpool libproc libsecdb
464libtsnet:	libnsl libtsol libsecdb
465libwrap:	libnsl libsocket
466libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
467		libdhcputil openssl
468libwanbootutil:	libnsl
469pam_modules:	libproject passwdutil $(SMARTCARD)
470libscf:		libuutil libmd
471libinetsvc:	libscf
472librestart:	libuutil libscf
473../cmd/sgs/libdl:	../cmd/sgs/libconv
474../cmd/sgs/libelf:	../cmd/sgs/libconv
475pkcs11:		libcryptoutil
476print:		libldap5
477udapl/udapl_tavor:	udapl/libdat
478libzfs:		libdevinfo libdevid libgen libnvpair libuutil
479libzfs_jni:	libdiskmgt libnvpair libzfs
480libzpool:	libavl libumem libnvpair
481libsec:		libavl
482
483#
484# The reason this rule checks for the existence of the
485# Makefile is that some of the directories do not exist
486# in certain situations (e.g., exportable source builds,
487# OpenSolaris).
488#
489$(SUBDIRS) abi: FRC
490	@if [ -f $@/Makefile  ]; then \
491		cd $@; pwd; $(MAKE) $(TARGET); \
492	else \
493		true; \
494	fi
495
496$(SUBDIRS:%=%-nodepend) abi-nodepend:
497	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
498		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
499	else \
500		true; \
501	fi
502
503FRC:
504