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