xref: /titanic_50/usr/src/lib/Makefile (revision ab4a9beb2e4d596be0b3288c7d92919e27781b57)
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	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$(CLOSED_BUILD)SUBDIRS += \
150	$(CLOSED)/lib/smartcard
151SUBDIRS += \
152	passwdutil	\
153	pam_modules	\
154	crypt_modules	\
155	libadt_jni	\
156	abi		\
157	auditd_plugins	\
158	libvolmgt	\
159	libdevice	\
160	libdevid	\
161	libdhcpsvc	\
162	libc_db		\
163	libsec		\
164	libtnfprobe	\
165	libtnf		\
166	libtnfctl	\
167	libdhcpagent	\
168	libdhcpdu	\
169	libdhcputil	\
170	libipsecutil
171$(CLOSED_BUILD)SUBDIRS += \
172	$(CLOSED)/lib/libike
173SUBDIRS += \
174	nsswitch	\
175	print		\
176	libuutil	\
177	libscf		\
178	libinetsvc	\
179	librestart	\
180	libsched	\
181	libelfsign	\
182	pkcs11		.WAIT	\
183	libpctx		.WAIT	\
184	libcpc		\
185	watchmalloc	\
186	extendedFILE	\
187	madv		\
188	mpss		\
189	libdisasm	\
190	libwrap		\
191	libxcurses	\
192	libxcurses2	\
193	libxnet		\
194	libbrand	.WAIT   \
195	libzonecfg	\
196	libzoneinfo	\
197	libtsnet	\
198	libtsol		\
199	gss_mechs/mech_spnego	\
200	gss_mechs/mech_dummy	\
201	gss_mechs/mech_dh	\
202	rpcsec_gss	\
203	libraidcfg	.WAIT	\
204	librcm		.WAIT	\
205	libcfgadm	.WAIT	\
206	libpicl		.WAIT	\
207	libpicltree	.WAIT \
208	raidcfg_plugins	\
209	cfgadm_plugins	\
210	libmail		\
211	lvm		\
212	libsmedia	\
213	libipp		\
214	openssl		\
215	libdiskmgt	\
216	liblgrp		\
217	libfsmgt	\
218	fm		\
219	libavl		\
220	libcmdutils	\
221	libcontract	\
222	../cmd/sendmail/libmilter	\
223	sasl_plugins	\
224	udapl		\
225	libzpool	\
226	libzfs		\
227	libzfs_jni	\
228	libmapid	\
229	brand		\
230	policykit	\
231	hal		\
232	libshare	\
233	libsqlite	\
234	libidmap	\
235	libipmi		\
236	libexacct/demo	\
237	$($(MACH)_SUBDIRS)
238
239sparc_SUBDIRS= .WAIT	\
240	efcode		\
241	libc_psr	.WAIT	\
242	libdscp		\
243	libprtdiag	.WAIT	\
244	libprtdiag_psr	\
245	libpri		\
246	librsc		\
247	libfruutils	.WAIT	\
248	libfru		\
249	storage		\
250	libpcp		\
251	libtsalarm
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	libelfsign	\
353	libeti		\
354	libfstyp	\
355	libgen		\
356	libwanboot	\
357	libwanbootutil	\
358	libipsecutil	\
359	libinetcfg	\
360	libinetsvc	\
361	libinetutil	\
362	libipmi		\
363	libipmp		\
364	libipp		\
365	libiscsitgt	\
366	libkstat	\
367	libkvm		\
368	libmail		\
369	libmd		\
370	libmtmalloc	\
371	libnvpair	\
372	libnsl		\
373	libpam		\
374	libpctx		\
375	libpicl		\
376	libpicltree	\
377	libplot		\
378	libpool		\
379	libpp		\
380	libproc		\
381	libraidcfg	\
382	librcm		\
383	libscf		\
384	libsip		\
385	libcommputil	\
386	libsmbios	\
387	librestart	\
388	librpcsvc	\
389	librsm		\
390	libsasl		\
391	libsec		\
392	libshell	\
393	libslp		\
394	libsmedia	\
395	libsqlite	\
396	libsysevent	\
397	libtecla	\
398	libtnf		\
399	libtnfctl	\
400	libtnfprobe	\
401	libtsnet	\
402	libtsol		\
403	libvolmgt	\
404	libumem		\
405	libuutil	\
406	libwrap		\
407	libxcurses2	\
408	libzfs		\
409	libzfs_jni	\
410	libzoneinfo	\
411	hal		\
412	policykit	\
413	lvm		\
414	openssl		\
415	pkcs11		\
416	passwdutil	\
417	../cmd/sendmail/libmilter	\
418	fm		\
419	udapl		\
420	libmapid	\
421	libkrb5		\
422	libshare	\
423	libidmap	\
424	$($(MACH)_HDRSUBDIRS)
425
426$(CLOSED_BUILD)HDRSUBDIRS += \
427	$(CLOSED)/lib/libc_i18n	\
428	$(CLOSED)/lib/libike	\
429	$(CLOSED)/lib/smartcard
430
431sparc_HDRSUBDIRS=	\
432	libdscp		\
433	libpri
434
435all :=		TARGET= all
436check :=	TARGET= check
437clean :=	TARGET= clean
438clobber :=	TARGET= clobber
439install :=	TARGET= install
440install_h :=	TARGET= install_h
441lint :=		TARGET= lint
442_dc :=		TARGET= _dc
443_msg :=		TARGET= _msg
444
445.KEEP_STATE:
446
447#
448# For the all and install targets, we clearly must respect library
449# dependencies so that the libraries link correctly.  However, for
450# the remaining targets (check, clean, clobber, install_h, lint, _dc
451# and _msg), libraries do not have any dependencies on one another
452# and thus respecting dependencies just slows down the build.
453# As such, for these rules, we use pattern replacement to explicitly
454# avoid triggering the dependency information.  Note that for clean,
455# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
456# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
457#
458
459all:			$(SUBDIRS)
460
461install:		$(SUBDIRS) .WAIT install_extra
462
463# extra libraries kept in other source areas
464install_extra:
465	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
466	@pwd
467
468clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
469
470install_h check:	$(HDRSUBDIRS:%=%-nodepend)
471
472_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
473
474_dc:			$(DCSUBDIRS:%=%-nodepend)
475
476# dependencies for pam_modules (see below)
477$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
478
479#
480# Library interdependencies are called out explicitly here
481#
482auditd_plugins: libbsm libnsl libsecdb
483gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
484libadt_jni:	libbsm
485$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
486libast: 	libsocket
487libbsm:		libtsol
488libcmd: 	libast libsocket libnsl
489libcmdutils:	libavl
490libcontract:	libnvpair
491libdevid:	libdevinfo
492libdevinfo:	libnvpair libsec
493libdhcpagent:	libsocket libdhcputil libuuid libdlpi
494libdhcpsvc:	libinetutil
495libdhcputil:	libnsl libgen libinetutil libdlpi
496libdladm:	libdlpi libdevinfo libinetutil libsocket
497libdll: 	libast
498libdlpi:	libinetutil
499libdtrace:	libproc libgen libctf
500libdtrace_jni:	libuutil libdtrace
501libefi:		libuuid
502libfstyp:	libnvpair
503libelfsign:	libcryptoutil libkmf
504libidmap:	libnsl
505libinetcfg:	libnsl libsocket libdevinfo
506libkmf:		libcryptoutil pkcs11 openssl
507libnsl:		libmd5 libscf
508libmapid:	libresolv
509libuuid:	libdlpi libdladm
510libinetutil:	libsocket
511libsecdb:	libnsl
512libsasl:	libgss libsocket pkcs11 libmd
513sasl_plugins:	pkcs11 libgss libsocket libsasl
514libsctp:	libsocket
515libshell:	libast libcmd libdll libsocket libsecdb
516libsip:		libmd5
517libsocket:	libnsl
518libldap5:	libsasl libsocket libnsl libmd
519libsldap:	libldap5 libtsol
520libpool:	libnvpair libexacct
521libpp:		libast
522libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
523		libbrand libpool libscf
524libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
525libproject:	libpool libproc libsecdb
526libtsnet:	libnsl libtsol libsecdb
527libwrap:	libnsl libsocket
528libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
529		libdhcputil openssl
530libwanbootutil:	libnsl
531pam_modules:	libproject passwdutil $(SMARTCARD)
532libscf:		libuutil libmd libgen
533libinetsvc:	libscf
534librestart:	libuutil libscf
535../cmd/sgs/libdl:	../cmd/sgs/libconv
536../cmd/sgs/libelf:	../cmd/sgs/libconv
537pkcs11:		libcryptoutil
538print:		libldap5
539udapl/udapl_tavor:	udapl/libdat
540libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
541libzfs_jni:	libdiskmgt libnvpair libzfs
542libzpool:	libavl libumem libnvpair
543libsec:		libavl
544brand:		libc libsocket
545libshare:	libscf libzfs libuuid libfsmgt libsecdb
546libexacct/demo:	libexacct libproject libsocket libnsl
547libtsalarm:	libpcp
548
549#
550# The reason this rule checks for the existence of the
551# Makefile is that some of the directories do not exist
552# in certain situations (e.g., exportable source builds,
553# OpenSolaris).
554#
555$(SUBDIRS): FRC
556	@if [ -f $@/Makefile  ]; then \
557		cd $@; pwd; $(MAKE) $(TARGET); \
558	else \
559		true; \
560	fi
561
562$(SUBDIRS:%=%-nodepend):
563	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
564		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
565	else \
566		true; \
567	fi
568
569FRC:
570