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