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