xref: /titanic_51/usr/src/lib/Makefile (revision 80feccabd0bc0fca1df2b60bfa50449d9a6e3e09)
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	$($(MACH)_SUBDIRS)
242
243sparc_SUBDIRS= .WAIT	\
244	efcode		\
245	libc_psr	.WAIT	\
246	libdscp		\
247	libprtdiag	.WAIT	\
248	libprtdiag_psr	\
249	libpri		\
250	librsc		\
251	libfruutils	.WAIT	\
252	libfru		\
253	storage		\
254	libpcp		\
255	libtsalarm
256
257FM_sparc_DEPLIBS= libpri
258
259fm: libexacct $(FM_$(MACH)_DEPLIBS)
260
261#
262# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
263# clean and clobber targets (for more information, see those targets, below).
264#
265NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
266
267DCSUBDIRS =		\
268	lvm
269
270MSGSUBDIRS=		\
271	abi		\
272	auditd_plugins	\
273	brand		\
274	cfgadm_plugins	\
275	gss_mechs/mech_dh	\
276	gss_mechs/mech_krb5	\
277	krb5		\
278	libast		\
279	libbsm		\
280	libc		\
281	libcfgadm	\
282	libcmd		\
283	libcontract	\
284	libcurses	\
285	libdhcpsvc 	\
286	libdhcputil	\
287	libipsecutil	\
288	libdiskmgt	\
289	libdladm	\
290	libdll		\
291	libgss		\
292	libidmap	\
293	libinetcfg	\
294	libipmp		\
295	libnsl		\
296	libpam		\
297	libpicl		\
298	libpool		\
299	libpp		\
300	libscf		\
301	libsasl		\
302	libldap5	\
303	libsecdb	\
304	libshare	\
305	libshell	\
306	libsldap	\
307	libslp		\
308	libsmbfs	\
309	libsmedia	\
310	libtsol		\
311	libuutil	\
312	libvscan	\
313	libwanboot	\
314	libwanbootutil	\
315	libzfs		\
316	libzonecfg	\
317	lvm		\
318	madv		\
319	mpss		\
320	pam_modules	\
321	rpcsec_gss
322$(CLOSED_BUILD)MSGSUBDIRS += \
323	$(CLOSED)/lib/smartcard
324MSGSUBDIRS += \
325	$($(MACH)_MSGSUBDIRS)
326
327sparc_MSGSUBDIRS=	\
328	libprtdiag	\
329	libprtdiag_psr
330
331HDRSUBDIRS=		\
332	auditd_plugins	\
333	libast		\
334	libbrand	\
335	libbsm		\
336	libc		\
337	libcmd		\
338	libcmdutils	\
339	libcontract	\
340	libcpc		\
341	libctf		\
342	libcurses	\
343	libcryptoutil	\
344	libdevice	\
345	libdevid	\
346	libdevinfo	\
347	libdiskmgt	\
348	libdladm	\
349	libdll		\
350	libdlpi		\
351	libdhcpagent	\
352	libdhcpsvc	\
353	libdhcputil	\
354	libdisasm	\
355	libdns_sd	\
356	libdtrace	\
357	libdtrace_jni	\
358	libelfsign	\
359	libeti		\
360	libfstyp	\
361	libgen		\
362	libwanboot	\
363	libwanbootutil	\
364	libipsecutil	\
365	libinetcfg	\
366	libinetsvc	\
367	libinetutil	\
368	libipmi		\
369	libipmp		\
370	libipp		\
371	libiscsitgt	\
372	libkstat	\
373	libkvm		\
374	libmail		\
375	libmd		\
376	libmtmalloc	\
377	libnvpair	\
378	libnsl		\
379	libpam		\
380	libpctx		\
381	libpicl		\
382	libpicltree	\
383	libplot		\
384	libpool		\
385	libpp		\
386	libproc		\
387	libraidcfg	\
388	librcm		\
389	libscf		\
390	libsip		\
391	libcommputil	\
392	libsmbios	\
393	librestart	\
394	librpcsvc	\
395	librsm		\
396	libsasl		\
397	libsec		\
398	libshell	\
399	libslp		\
400	libsmedia	\
401	libsqlite	\
402	libsysevent	\
403	libtecla	\
404	libtnf		\
405	libtnfctl	\
406	libtnfprobe	\
407	libtsnet	\
408	libtsol		\
409	libvolmgt	\
410	libumem		\
411	libuutil	\
412	libwrap		\
413	libxcurses2	\
414	libzfs		\
415	libzfs_jni	\
416	libzoneinfo	\
417	hal		\
418	policykit	\
419	lvm		\
420	openssl		\
421	pkcs11		\
422	passwdutil	\
423	../cmd/sendmail/libmilter	\
424	fm		\
425	udapl		\
426	libmapid	\
427	libkrb5		\
428	libshare	\
429	libidmap	\
430	libvscan	\
431	smbsrv		\
432	$($(MACH)_HDRSUBDIRS)
433
434$(CLOSED_BUILD)HDRSUBDIRS += \
435	$(CLOSED)/lib/libc_i18n	\
436	$(CLOSED)/lib/libike	\
437	$(CLOSED)/lib/libndmp	\
438	$(CLOSED)/lib/smartcard
439
440sparc_HDRSUBDIRS=	\
441	libdscp		\
442	libpri
443
444all :=		TARGET= all
445check :=	TARGET= check
446clean :=	TARGET= clean
447clobber :=	TARGET= clobber
448install :=	TARGET= install
449install_h :=	TARGET= install_h
450lint :=		TARGET= lint
451_dc :=		TARGET= _dc
452_msg :=		TARGET= _msg
453
454.KEEP_STATE:
455
456#
457# For the all and install targets, we clearly must respect library
458# dependencies so that the libraries link correctly.  However, for
459# the remaining targets (check, clean, clobber, install_h, lint, _dc
460# and _msg), libraries do not have any dependencies on one another
461# and thus respecting dependencies just slows down the build.
462# As such, for these rules, we use pattern replacement to explicitly
463# avoid triggering the dependency information.  Note that for clean,
464# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
465# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
466#
467
468all:			$(SUBDIRS)
469
470install:		$(SUBDIRS) .WAIT install_extra
471
472# extra libraries kept in other source areas
473install_extra:
474	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
475	@pwd
476
477clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
478
479install_h check:	$(HDRSUBDIRS:%=%-nodepend)
480
481_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
482
483_dc:			$(DCSUBDIRS:%=%-nodepend)
484
485# dependencies for pam_modules (see below)
486$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
487
488#
489# Library interdependencies are called out explicitly here
490#
491auditd_plugins: libbsm libnsl libsecdb
492gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
493libadt_jni:	libbsm
494$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
495libast: 	libsocket
496libbsm:		libtsol
497libcmd: 	libast libsocket libnsl
498libcmdutils:	libavl
499libcontract:	libnvpair
500libdevid:	libdevinfo
501libdevinfo:	libnvpair libsec
502libdhcpagent:	libsocket libdhcputil libuuid libdlpi
503libdhcpsvc:	libinetutil
504libdhcputil:	libnsl libgen libinetutil libdlpi
505libdladm:	libdevinfo libinetutil libsocket
506libdll: 	libast
507libdlpi:	libinetutil libdladm
508libdtrace:	libproc libgen libctf
509libdtrace_jni:	libuutil libdtrace
510libefi:		libuuid
511libfstyp:	libnvpair
512libelfsign:	libcryptoutil libkmf
513libidmap:	libnsl
514libinetcfg:	libnsl libsocket libdlpi
515libkmf:		libcryptoutil pkcs11 openssl
516libnsl:		libmd5 libscf
517libmapid:	libresolv
518libuuid:	libdlpi
519libinetutil:	libsocket
520libsecdb:	libnsl
521libsasl:	libgss libsocket pkcs11 libmd
522sasl_plugins:	pkcs11 libgss libsocket libsasl
523libsctp:	libsocket
524libshell:	libast libcmd libdll libsocket libsecdb
525libsip:		libmd5
526libsmbfs:	libsocket libnsl libkrb5
527libsocket:	libnsl
528libldap5:	libsasl libsocket libnsl libmd
529libsldap:	libldap5 libtsol
530libpool:	libnvpair libexacct
531libpp:		libast
532libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
533		libbrand libpool libscf
534libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
535libproject:	libpool libproc libsecdb
536libtsnet:	libnsl libtsol libsecdb
537libwrap:	libnsl libsocket
538libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
539		libdhcputil openssl
540libwanbootutil:	libnsl
541pam_modules:	libproject passwdutil $(SMARTCARD) smbsrv
542libscf:		libuutil libmd libgen
543libinetsvc:	libscf
544librestart:	libuutil libscf
545../cmd/sgs/libdl:	../cmd/sgs/libconv
546../cmd/sgs/libelf:	../cmd/sgs/libconv
547pkcs11:		libcryptoutil
548print:		libldap5
549udapl/udapl_tavor:	udapl/libdat
550libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
551libzfs_jni:	libdiskmgt libnvpair libzfs
552libzpool:	libavl libumem libnvpair
553libsec:		libavl
554brand:		libc libsocket
555libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
556libexacct/demo:	libexacct libproject libsocket libnsl
557libtsalarm:	libpcp
558smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
559		libshare libidmap pkcs11 libsqlite
560libvscan:	libscf
561
562#
563# The reason this rule checks for the existence of the
564# Makefile is that some of the directories do not exist
565# in certain situations (e.g., exportable source builds,
566# OpenSolaris).
567#
568$(SUBDIRS): FRC
569	@if [ -f $@/Makefile  ]; then \
570		cd $@; pwd; $(MAKE) $(TARGET); \
571	else \
572		true; \
573	fi
574
575$(SUBDIRS:%=%-nodepend):
576	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
577		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
578	else \
579		true; \
580	fi
581
582FRC:
583