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