xref: /titanic_44/usr/src/lib/Makefile (revision 12f130f292b17d30e8cf927d99f846261c92105c)
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	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	libsmbfs
150$(CLOSED_BUILD)SUBDIRS += \
151	$(CLOSED)/lib/smartcard
152SUBDIRS += \
153	passwdutil	\
154	pam_modules	\
155	crypt_modules	\
156	libadt_jni	\
157	abi		\
158	auditd_plugins	\
159	libvolmgt	\
160	libdevice	\
161	libdevid	\
162	libdhcpsvc	\
163	libc_db		\
164	libsec		\
165	libtnfprobe	\
166	libtnf		\
167	libtnfctl	\
168	libdhcpagent	\
169	libdhcpdu	\
170	libdhcputil	\
171	libipsecutil
172$(CLOSED_BUILD)SUBDIRS += \
173	$(CLOSED)/lib/libike \
174	$(CLOSED)/lib/libndmp
175SUBDIRS += \
176	nsswitch	\
177	print		\
178	libuutil	\
179	libscf		\
180	libinetsvc	\
181	librestart	\
182	libsched	\
183	libelfsign	\
184	pkcs11		.WAIT	\
185	libpctx		.WAIT	\
186	libcpc		\
187	watchmalloc	\
188	extendedFILE	\
189	madv		\
190	mpss		\
191	libdisasm	\
192	libwrap		\
193	libxcurses	\
194	libxcurses2	\
195	libxnet		\
196	libbrand	.WAIT   \
197	libzonecfg	\
198	libzoneinfo	\
199	libtsnet	\
200	libtsol		\
201	gss_mechs/mech_spnego	\
202	gss_mechs/mech_dummy	\
203	gss_mechs/mech_dh	\
204	rpcsec_gss	\
205	libraidcfg	.WAIT	\
206	librcm		.WAIT	\
207	libcfgadm	.WAIT	\
208	libpicl		.WAIT	\
209	libpicltree	.WAIT \
210	raidcfg_plugins	\
211	cfgadm_plugins	\
212	libmail		\
213	lvm		\
214	libsmedia	\
215	libipp		\
216	openssl		\
217	libdiskmgt	\
218	liblgrp		\
219	libfsmgt	\
220	fm		\
221	libavl		\
222	libcmdutils	\
223	libcontract	\
224	../cmd/sendmail/libmilter	\
225	sasl_plugins	\
226	udapl		\
227	libzpool	\
228	libzfs		\
229	libzfs_jni	\
230	libmapid	\
231	brand		\
232	policykit	\
233	hal		\
234	libshare	\
235	libsqlite	\
236	libidmap	\
237	libipmi		\
238	libexacct/demo	\
239	libvscan	\
240	smbsrv		\
241	scsi		\
242	mms		\
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