xref: /titanic_50/usr/src/lib/Makefile (revision 9113a79cf228b8f7bd509b1328adf88659dfe218)
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	libresolv			\
77	libresolv2		.WAIT	\
78	libw			.WAIT	\
79	libintl			.WAIT	\
80	../cmd/sgs/librtld_db	\
81	libaio			\
82	librt			\
83	libadm			\
84	libctf			\
85	libdtrace		\
86	libdtrace_jni		\
87	libcurses		\
88	libgen			\
89	libgss			\
90	libpam			\
91	libuuid			\
92	libthread		\
93	libpthread	.WAIT	\
94	libslp		\
95	libbsdmalloc	\
96	libcmd		\
97	libdoor		\
98	libdevinfo	\
99	libdladm	\
100	libdlpi		\
101	libeti		\
102	libcrypt	\
103	libefi		\
104	libfstyp	\
105	libwanboot	\
106	libwanbootutil	\
107	libcryptoutil	\
108	libinetcfg	\
109	libinetutil	\
110	libipmp		\
111	libiscsitgt	\
112	libkmf		\
113	libkstat	\
114	libkvm		\
115        liblaadm        \
116	liblm		\
117	libmacadm	\
118	libmalloc	\
119	libmapmalloc	\
120	libmtmalloc	\
121	libnls		\
122	libsmbios	\
123	libtecla	\
124	libumem		\
125	libnvpair	.WAIT	\
126	libexacct	\
127	libplot		\
128	libldap4	\
129	libsasl		\
130	libldap5	\
131	libsldap	.WAIT	\
132	libbsm		\
133	libsys		\
134	libsysevent	\
135	libnisdb	\
136	libpool		\
137	libproc		\
138	libproject	\
139	libsendfile	\
140	nametoaddr	\
141	ncad_addr	\
142	gss_mechs/mech_krb5	.WAIT	\
143	libkrb5	.WAIT	\
144	krb5	.WAIT
145$(CLOSED_BUILD)SUBDIRS += \
146	$(CLOSED)/lib/smartcard
147SUBDIRS += \
148	passwdutil	\
149	pam_modules	\
150	crypt_modules	\
151	libadt_jni	\
152	abi		\
153	auditd_plugins	\
154	libvolmgt	\
155	libdevice	\
156	libdevid	\
157	libdhcpsvc	\
158	libc_db		\
159	libsec		\
160	libtnfprobe	\
161	libtnf		\
162	libtnfctl	\
163	libdhcpagent	\
164	libdhcpdu	\
165	libdhcputil	\
166	libipsecutil
167$(CLOSED_BUILD)SUBDIRS += \
168	$(CLOSED)/lib/libike
169SUBDIRS += \
170	nsswitch	\
171	print		\
172	libuutil	\
173	libscf		\
174	libinetsvc	\
175	librestart	\
176	libsched
177$(CLOSED_BUILD)SUBDIRS += \
178	$(CLOSED)/lib/libelfsign
179SUBDIRS += \
180	pkcs11		.WAIT	\
181	libpctx		.WAIT	\
182	libcpc		\
183	watchmalloc	\
184	extendedFILE	\
185	madv		\
186	mpss		\
187	libdisasm	\
188	libwladm	\
189	libwrap		\
190	libxcurses	\
191	libxcurses2	\
192	libxnet		\
193	libbrand	.WAIT   \
194	libzonecfg	\
195	libzoneinfo	\
196	libtsnet	\
197	libtsol		\
198	gss_mechs/mech_spnego	\
199	gss_mechs/mech_dummy	\
200	gss_mechs/mech_dh	\
201	rpcsec_gss	\
202	libraidcfg	.WAIT	\
203	librcm		.WAIT	\
204	libcfgadm	.WAIT	\
205	libpicl		.WAIT	\
206	libpicltree	.WAIT \
207	raidcfg_plugins	\
208	cfgadm_plugins	\
209	libmail		\
210	lvm		\
211	libsmedia	\
212	libipp		\
213	openssl		\
214	libdiskmgt	\
215	liblgrp		\
216	libfsmgt	\
217	fm		\
218	libavl		\
219	libcmdutils	\
220	libcontract	\
221	../cmd/sendmail/libmilter	\
222	sasl_plugins	\
223	udapl		\
224	libzpool	\
225	libzfs		\
226	libzfs_jni	\
227	libmapid	\
228	brand		\
229	policykit	\
230	hal		\
231	libshare	\
232	libipmi		\
233	$($(MACH)_SUBDIRS)
234
235sparc_SUBDIRS= .WAIT	\
236	efcode		\
237	libc_psr	.WAIT	\
238	libdscp		\
239	libprtdiag	.WAIT	\
240	libprtdiag_psr	\
241	libpri		\
242	librsc		\
243	libfruutils	.WAIT	\
244	libfru		\
245	libwrsmconf	\
246	storage		\
247	wrsm		\
248	libpcp
249
250FM_sparc_DEPLIBS= libpri
251
252fm: libexacct $(FM_$(MACH)_DEPLIBS)
253
254#
255# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
256# clean and clobber targets (for more information, see those targets, below).
257#
258NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
259
260DCSUBDIRS =		\
261	lvm
262
263MSGSUBDIRS=		\
264	abi		\
265	auditd_plugins	\
266	brand		\
267	cfgadm_plugins	\
268	gss_mechs/mech_dh	\
269	gss_mechs/mech_krb5	\
270	krb5		\
271	libbsm		\
272	libc		\
273	libcfgadm	\
274	libcontract	\
275	libcurses	\
276	libdhcpsvc 	\
277	libdhcputil	\
278	libdladm	\
279	libgss		\
280	libinetcfg	\
281	libipmp		\
282	libnsl		\
283	libpam		\
284	libpicl		\
285	libpool		\
286	libscf		\
287	libsasl		\
288	libldap5	\
289	libsecdb	\
290	libshare	\
291	libsldap	\
292	libslp		\
293	libsmedia	\
294	libtsol		\
295	libuutil	\
296	libwanboot	\
297	libwanbootutil	\
298	libwladm	\
299	libzfs		\
300	libzonecfg	\
301	lvm		\
302	madv		\
303	mpss		\
304	pam_modules	\
305	rpcsec_gss
306$(CLOSED_BUILD)MSGSUBDIRS += \
307	$(CLOSED)/lib/smartcard
308MSGSUBDIRS += \
309	$($(MACH)_MSGSUBDIRS)
310
311sparc_MSGSUBDIRS=	\
312	libprtdiag	\
313	libprtdiag_psr
314
315HDRSUBDIRS=		\
316	auditd_plugins	\
317	libbrand	\
318	libbsm		\
319	libc		\
320	libcmdutils	\
321	libcontract	\
322	libcpc		\
323	libctf		\
324	libcurses	\
325	libcryptoutil	\
326	libdevice	\
327	libdevid	\
328	libdevinfo	\
329	libdiskmgt	\
330	libdladm	\
331	libdlpi		\
332	libdhcpagent	\
333	libdhcpsvc	\
334	libdhcputil	\
335	libdisasm	\
336	libdtrace	\
337	libdtrace_jni	\
338	libeti		\
339	libfstyp	\
340	libgen		\
341	libwanboot	\
342	libwanbootutil	\
343	libipsecutil	\
344	libinetcfg	\
345	libinetsvc	\
346	libinetutil	\
347	libipmi		\
348	libipmp		\
349	libipp		\
350	libiscsitgt	\
351	libkstat	\
352	libkvm		\
353        liblaadm        \
354	libmacadm	\
355	libmail		\
356	libmd		\
357	libmtmalloc	\
358	libnvpair	\
359	libnsl		\
360	libpam		\
361	libpctx		\
362	libpicl		\
363	libpicltree	\
364	libplot		\
365	libpool		\
366	libproc		\
367	libraidcfg	\
368	librcm		\
369	libscf		\
370	libsip		\
371	libsmbios	\
372	librestart	\
373	librpcsvc	\
374	librsm		\
375	libsasl		\
376	libsec		\
377	libslp		\
378	libsmedia	\
379	libsysevent	\
380	libtecla	\
381	libtnf		\
382	libtnfctl	\
383	libtnfprobe	\
384	libtsnet	\
385	libtsol		\
386	libvolmgt	\
387	libumem		\
388	libuutil	\
389	libwladm	\
390	libwrap		\
391	libxcurses2	\
392	libzfs		\
393	libzfs_jni	\
394	libzoneinfo	\
395	hal		\
396	policykit	\
397	lvm		\
398	openssl		\
399	pkcs11		\
400	passwdutil	\
401	../cmd/sendmail/libmilter	\
402	fm		\
403	udapl		\
404	libmapid	\
405	libkrb5		\
406	libshare	\
407	$($(MACH)_HDRSUBDIRS)
408
409$(CLOSED_BUILD)HDRSUBDIRS += \
410	$(CLOSED)/lib/libc_i18n	\
411	$(CLOSED)/lib/libike	\
412	$(CLOSED)/lib/smartcard
413
414sparc_HDRSUBDIRS=	\
415	libdscp		\
416	libpri		\
417	libwrsmconf
418
419all :=		TARGET= all
420check :=	TARGET= check
421clean :=	TARGET= clean
422clobber :=	TARGET= clobber
423install :=	TARGET= install
424install_h :=	TARGET= install_h
425lint :=		TARGET= lint
426_dc :=		TARGET= _dc
427_msg :=		TARGET= _msg
428
429.KEEP_STATE:
430
431#
432# For the all and install targets, we clearly must respect library
433# dependencies so that the libraries link correctly.  However, for
434# the remaining targets (check, clean, clobber, install_h, lint, _dc
435# and _msg), libraries do not have any dependencies on one another
436# and thus respecting dependencies just slows down the build.
437# As such, for these rules, we use pattern replacement to explicitly
438# avoid triggering the dependency information.  Note that for clean,
439# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
440# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
441#
442
443all:			$(SUBDIRS)
444
445install:		$(SUBDIRS) .WAIT install_extra
446
447# extra libraries kept in other source areas
448install_extra:
449	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
450	@pwd
451
452clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
453
454install_h check:	$(HDRSUBDIRS:%=%-nodepend)
455
456_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
457
458_dc:			$(DCSUBDIRS:%=%-nodepend)
459
460# dependencies for pam_modules (see below)
461$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
462
463#
464# Library interdependencies are called out explicitly here
465#
466auditd_plugins: libbsm libnsl libsecdb
467gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
468libadt_jni:	libbsm
469$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
470libbsm:		libtsol
471libcmdutils:	libavl
472libcontract:	libnvpair
473libdevid:	libdevinfo
474libdevinfo:	libnvpair libsec
475libdhcpagent:	libsocket libdhcputil libuuid libdlpi
476libdhcpsvc:	libinetutil
477libdhcputil:	libnsl libgen libinetutil libdlpi
478libdlpi:	libinetutil
479libdladm:	libdlpi libdevinfo libwladm libinetutil
480libdtrace:	libproc libgen libctf
481libdtrace_jni:	libuutil libdtrace
482libefi:		libuuid
483libfstyp:	libnvpair
484$(CLOSED_BUILD)$(CLOSED)/lib/libelfsign: \
485			$(CLOSED)/lib/libike libcryptoutil pkcs11
486libinetcfg:	libnsl libsocket libdevinfo
487libkmf:		libcryptoutil pkcs11 openssl
488libnsl:		libmd5 libscf
489libmapid:	libresolv
490libmacadm:	libdevinfo
491libuuid:	libsocket
492libinetutil:	libsocket
493libsecdb:	libnsl
494libsasl:	libgss libsocket pkcs11 libmd
495sasl_plugins:	pkcs11 libgss libsocket libsasl
496libsctp:	libsocket
497libsip:		libmd5
498libsocket:	libnsl
499libldap5:	libsasl libsocket libnsl libmd
500libsldap:	libldap5 libtsol
501libpool:	libnvpair libexacct
502libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
503		libbrand libpool libscf
504libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
505libproject:	libpool libproc libsecdb
506libtsnet:	libnsl libtsol libsecdb
507libwrap:	libnsl libsocket
508libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
509		libdhcputil openssl
510libwanbootutil:	libnsl
511libwladm:	libdevinfo libsocket
512pam_modules:	libproject passwdutil $(SMARTCARD)
513libscf:		libuutil libmd
514libinetsvc:	libscf
515librestart:	libuutil libscf
516../cmd/sgs/libdl:	../cmd/sgs/libconv
517../cmd/sgs/libelf:	../cmd/sgs/libconv
518pkcs11:		libcryptoutil
519print:		libldap5
520udapl/udapl_tavor:	udapl/libdat
521libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
522libzfs_jni:	libdiskmgt libnvpair libzfs
523libzpool:	libavl libumem libnvpair
524libsec:		libavl
525brand:		libc libsocket
526libshare:	libscf libzfs libuuid libfsmgt libsecdb
527
528#
529# The reason this rule checks for the existence of the
530# Makefile is that some of the directories do not exist
531# in certain situations (e.g., exportable source builds,
532# OpenSolaris).
533#
534$(SUBDIRS): FRC
535	@if [ -f $@/Makefile  ]; then \
536		cd $@; pwd; $(MAKE) $(TARGET); \
537	else \
538		true; \
539	fi
540
541$(SUBDIRS:%=%-nodepend):
542	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
543		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
544	else \
545		true; \
546	fi
547
548FRC:
549