xref: /illumos-gate/usr/src/lib/Makefile (revision 0173c38a73f34277e0c97a19fedfd25d81ba8380)
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#
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	../cmd/sgs/libconv		\
58	../cmd/sgs/libdl	.WAIT
59
60$(CLOSED_BUILD)SUBDIRS += \
61	$(CLOSED)/lib/libc_i18n
62
63SUBDIRS += \
64	libc			.WAIT	\
65	../cmd/sgs/libelf	.WAIT	\
66	libmd				\
67	libmd5				\
68	librsm				\
69	libmp			.WAIT	\
70	libcmd			\
71	libnsl			\
72	libsecdb		.WAIT	\
73	librpcsvc			\
74	libsocket		.WAIT	\
75	libsctp			\
76	libresolv			\
77	libresolv2		.WAIT	\
78	libw			.WAIT	\
79	libintl			.WAIT	\
80	../cmd/sgs/librtld_db	\
81	libaio			\
82	librt			\
83	libadm			\
84	libctf			\
85	libdtrace		\
86	libdtrace_jni		\
87	libcurses		\
88	libgen			\
89	libgss			\
90	libpam			\
91	libuuid			\
92	libthread		\
93	libpthread	.WAIT	\
94	libslp		\
95	libbsdmalloc	\
96	libdoor		\
97	libdevinfo	\
98	libdladm	\
99	libdlpi		\
100	libeti		\
101	libcrypt	\
102	libefi		\
103	libfstyp	\
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	libmapmalloc	\
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	abi		\
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): FRC
496	@if [ -f $@/Makefile  ]; then \
497		cd $@; pwd; $(MAKE) $(TARGET); \
498	else \
499		true; \
500	fi
501
502$(SUBDIRS:%=%-nodepend):
503	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
504		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
505	else \
506		true; \
507	fi
508
509FRC:
510