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