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