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