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