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