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