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