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