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