xref: /illumos-gate/usr/src/lib/Makefile (revision 4abb96737d15cd2d6530b0aa7b8404ec911ad940)
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	libkrb5	.WAIT	\
141	krb5	.WAIT
142$(CLOSED_BUILD)SUBDIRS += \
143	$(CLOSED)/lib/smartcard
144SUBDIRS += \
145	passwdutil	\
146	pam_modules	\
147	crypt_modules	\
148	libadt_jni	\
149	auditd_plugins	\
150	libvolmgt	\
151	libdevice	\
152	libdevid	\
153	libdhcpsvc	\
154	libc_db		\
155	libsec		\
156	libtnfprobe	\
157	libtnf		\
158	libtnfctl	\
159	libdhcpagent	\
160	libdhcpdu	\
161	libdhcputil	\
162	libipsecutil
163$(CLOSED_BUILD)SUBDIRS += \
164	$(CLOSED)/lib/libike
165SUBDIRS += \
166	nsswitch	\
167	print		\
168	libuutil	\
169	libscf		\
170	libinetsvc	\
171	librestart	\
172	libsched
173$(CLOSED_BUILD)SUBDIRS += \
174	$(CLOSED)/lib/libelfsign
175SUBDIRS += \
176	pkcs11		.WAIT	\
177	libpctx		.WAIT	\
178	libcpc		\
179	watchmalloc	\
180	extendedFILE	\
181	madv		\
182	mpss		\
183	libdisasm	\
184	libwrap		\
185	libxcurses	\
186	libxcurses2	\
187	libxnet		\
188	libzonecfg	\
189	libzoneinfo	\
190	libtsnet	\
191	libtsol		\
192	gss_mechs/mech_spnego	\
193	gss_mechs/mech_dummy	\
194	gss_mechs/mech_dh	\
195	rpcsec_gss	\
196	librcm		.WAIT	\
197	libcfgadm	.WAIT	\
198	libpicl		.WAIT	\
199	libpicltree	.WAIT \
200	cfgadm_plugins	\
201	libmail		\
202	lvm		\
203	libsmedia	\
204	libipp		\
205	openssl		\
206	libdiskmgt	\
207	liblgrp		\
208	libfsmgt	\
209	fm		\
210	libavl		\
211	libcmdutils	\
212	libcontract	\
213	../cmd/sendmail/libmilter	\
214	sasl_plugins	\
215	udapl		\
216	libzpool	\
217	libzfs		\
218	libzfs_jni	\
219	libmapid	\
220	$($(MACH)_SUBDIRS)
221
222sparc_SUBDIRS= .WAIT	\
223	efcode		\
224	libc_psr	.WAIT	\
225	libdscp		\
226	libprtdiag	.WAIT	\
227	libprtdiag_psr	\
228	librsc		\
229	libfruutils	.WAIT	\
230	libfru		\
231	libwrsmconf	\
232	storage		\
233	wrsm		\
234	libpcp
235
236fm: libexacct
237
238#
239# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
240# clean and clobber targets (for more information, see those targets, below).
241#
242NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
243
244DCSUBDIRS =		\
245	lvm
246
247MSGSUBDIRS=		\
248	abi		\
249	auditd_plugins	\
250	cfgadm_plugins	\
251	gss_mechs/mech_dh	\
252	gss_mechs/mech_krb5	\
253	krb5		\
254	libbsm		\
255	libc		\
256	libcfgadm	\
257	libcontract	\
258	libcurses	\
259	libdhcpsvc 	\
260	libdhcputil	\
261	libgss		\
262	libinetcfg	\
263	libipmp		\
264	libnsl		\
265	libpam		\
266	libpicl		\
267	libpool		\
268	libscf		\
269	libsasl		\
270	libldap5	\
271	libsecdb	\
272	libsldap	\
273	libslp		\
274	libsmedia	\
275	libtsol		\
276	libuutil	\
277	libwanboot	\
278	libwanbootutil	\
279	libzonecfg	\
280	lvm		\
281	madv		\
282	mpss		\
283	pam_modules	\
284	rpcsec_gss
285$(CLOSED_BUILD)MSGSUBDIRS += \
286	$(CLOSED)/lib/smartcard
287MSGSUBDIRS += \
288	$($(MACH)_MSGSUBDIRS)
289
290sparc_MSGSUBDIRS=	\
291	libprtdiag	\
292	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	libmapid	\
375	libkrb5		\
376	$($(MACH)_HDRSUBDIRS)
377
378$(CLOSED_BUILD)HDRSUBDIRS += \
379	$(CLOSED)/lib/libc_i18n	\
380	$(CLOSED)/lib/libike	\
381	$(CLOSED)/lib/smartcard
382
383sparc_HDRSUBDIRS=	\
384	libdscp		\
385	libwrsmconf
386
387all :=		TARGET= all
388check :=	TARGET= check
389clean :=	TARGET= clean
390clobber :=	TARGET= clobber
391install :=	TARGET= install
392install_h :=	TARGET= install_h
393lint :=		TARGET= lint
394_dc :=		TARGET= _dc
395_msg :=		TARGET= _msg
396
397.KEEP_STATE:
398
399#
400# For the all and install targets, we clearly must respect library
401# dependencies so that the libraries link correctly.  However, for
402# the remaining targets (check, clean, clobber, install_h, lint, _dc
403# and _msg), libraries do not have any dependencies on one another
404# and thus respecting dependencies just slows down the build.
405# As such, for these rules, we use pattern replacement to explicitly
406# avoid triggering the dependency information.  Note that for clean,
407# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
408# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
409#
410
411all:			$(SUBDIRS)
412
413install:		$(SUBDIRS) .WAIT install_extra
414
415# extra libraries kept in other source areas
416install_extra:
417	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
418	@pwd
419
420clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
421
422install_h check:	$(HDRSUBDIRS:%=%-nodepend)
423
424_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
425
426_dc:			$(DCSUBDIRS:%=%-nodepend)
427
428# dependencies for pam_modules (see below)
429$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
430
431#
432# Library interdependencies are called out explicitly here
433#
434auditd_plugins: libbsm libnsl libsecdb
435gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
436libadt_jni:	libbsm
437$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
438libbsm:		libtsol
439libcmdutils:	libavl
440libcontract:	libnvpair
441libdevid:	libdevinfo
442libdevinfo:	libnvpair libsec
443libdhcpagent:	libdhcputil libnsl libsocket
444libdhcpsvc:	libinetutil
445libdhcputil:	libinetutil
446libdladm:	libdlpi libdevinfo
447libdtrace:	libproc libgen libctf
448libdtrace_jni:	libuutil libdtrace
449libefi:		libuuid
450$(CLOSED_BUILD)$(CLOSED)/lib/libelfsign: \
451			$(CLOSED)/lib/libike libcryptoutil pkcs11
452libinetcfg:	libnsl libsocket libdevinfo
453libnsl:		libmd5 libscf
454libmapid:	libresolv libcmd
455libmacadm:	libdevinfo
456libuuid:	libsocket
457libinetutil:	libsocket
458libsecdb:	libcmd libnsl
459librt:		libaio libmd
460libsasl:	libgss libsocket pkcs11 libmd
461sasl_plugins:	pkcs11 libgss libsocket libsasl
462libsctp:	libsocket
463libsocket:	libnsl
464libldap5:	libsasl libsocket libnsl libmd
465libsldap:	libldap5 libtsol
466libpool:	libnvpair libexacct
467libproject:	libpool libproc libsecdb
468libtsnet:	libnsl libtsol libsecdb
469libwrap:	libnsl libsocket
470libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
471		libdhcputil openssl
472libwanbootutil:	libnsl
473pam_modules:	libproject passwdutil $(SMARTCARD)
474libscf:		libuutil libmd
475libinetsvc:	libscf
476librestart:	libuutil libscf
477../cmd/sgs/libdl:	../cmd/sgs/libconv
478../cmd/sgs/libelf:	../cmd/sgs/libconv
479pkcs11:		libcryptoutil
480print:		libldap5
481udapl/udapl_tavor:	udapl/libdat
482libzfs:		libdevinfo libdevid libgen libnvpair libuutil
483libzfs_jni:	libdiskmgt libnvpair libzfs
484libzpool:	libavl libumem libnvpair
485libsec:		libavl
486
487#
488# The reason this rule checks for the existence of the
489# Makefile is that some of the directories do not exist
490# in certain situations (e.g., exportable source builds,
491# OpenSolaris).
492#
493$(SUBDIRS) abi: FRC
494	@if [ -f $@/Makefile  ]; then \
495		cd $@; pwd; $(MAKE) $(TARGET); \
496	else \
497		true; \
498	fi
499
500$(SUBDIRS:%=%-nodepend) abi-nodepend:
501	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
502		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
503	else \
504		true; \
505	fi
506
507FRC:
508