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