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