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