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