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