xref: /titanic_51/usr/src/lib/Makefile (revision 613a2f6ba31e891e3d947a356daf5e563d43c1ce)
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	libipmi		\
411	libipmp		\
412	libipp		\
413	libiscsit	\
414	libiscsitgt	\
415	libkstat	\
416	libkvm		\
417	libmail		\
418	libmd		\
419	libmtmalloc	\
420	libndmp		\
421	libnvpair	\
422	libnsctl	\
423	libnsl		\
424	libnwam		\
425	libpam		\
426	libpctx		\
427	libpicl		\
428	libpicltree	\
429	libplot		\
430	libpool		\
431	libpp		\
432	libproc		\
433	libraidcfg	\
434	librcm		\
435	librdc		\
436	libscf		\
437	libsip		\
438	libcommputil	\
439	libsmbios	\
440	librestart	\
441	librpcsvc	\
442	librsm		\
443	libsasl		\
444	libsec		\
445	libshell	\
446	libslp		\
447	libsmedia	\
448	libsqlite	\
449	libfcoe		\
450	libstmf		\
451	libsum		\
452	libsysevent	\
453	libtecla	\
454	libtnf		\
455	libtnfctl	\
456	libtnfprobe	\
457	libtsnet	\
458	libtsol		\
459	libvolmgt	\
460	libumem		\
461	libunistat	\
462	libuutil	\
463	libwrap		\
464	libxcurses2	\
465	libzfs		\
466	libzfs_jni	\
467	libzoneinfo	\
468	hal		\
469	policykit	\
470	lvm		\
471	pkcs11		\
472	passwdutil	\
473	../cmd/sendmail/libmilter	\
474	fm		\
475	udapl		\
476	libmapid	\
477	libkrb5		\
478	libsmbfs	\
479	libshare	\
480	libidmap	\
481	libvscan	\
482	libgrubmgmt	\
483	smbsrv		\
484	scsi		\
485	hbaapi		\
486	libima		\
487	libsun_ima	\
488	mpapi		\
489	mms		\
490	$($(MACH)_HDRSUBDIRS)
491
492$(CLOSED_BUILD)HDRSUBDIRS += \
493	$(CLOSED)/lib/libc_i18n	\
494	$(CLOSED)/lib/libike	\
495	$(CLOSED)/lib/smartcard
496
497i386_HDRSUBDIRS=	\
498	libparted	\
499	libfdisk
500
501sparc_HDRSUBDIRS=	\
502	libds		\
503	libdscp		\
504	libpri		\
505	storage
506
507all :=		TARGET= all
508check :=	TARGET= check
509clean :=	TARGET= clean
510clobber :=	TARGET= clobber
511install :=	TARGET= install
512install_h :=	TARGET= install_h
513lint :=		TARGET= lint
514_dc :=		TARGET= _dc
515_msg :=		TARGET= _msg
516
517.KEEP_STATE:
518
519#
520# For the all and install targets, we clearly must respect library
521# dependencies so that the libraries link correctly.  However, for
522# the remaining targets (check, clean, clobber, install_h, lint, _dc
523# and _msg), libraries do not have any dependencies on one another
524# and thus respecting dependencies just slows down the build.
525# As such, for these rules, we use pattern replacement to explicitly
526# avoid triggering the dependency information.  Note that for clean,
527# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
528# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
529#
530
531all:			$(SUBDIRS)
532
533install:		$(SUBDIRS) .WAIT install_extra
534
535# extra libraries kept in other source areas
536install_extra:
537	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
538	@pwd
539
540clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
541
542install_h check:	$(HDRSUBDIRS:%=%-nodepend)
543
544_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
545
546_dc:			$(DCSUBDIRS:%=%-nodepend)
547
548# dependencies for pam_modules (see below)
549$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
550
551#
552# Library interdependencies are called out explicitly here
553#
554auditd_plugins: libbsm libnsl libsecdb
555gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
556libadt_jni:	libbsm
557$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
558libast: 	libsocket
559libadutils: 	libldap5 libresolv libsocket libnsl
560nsswitch:	libadutils libidmap
561libbsm:		libtsol
562libcmd: 	libsum libast libsocket libnsl
563libcmdutils:	libavl
564libcontract:	libnvpair
565libdevid:	libdevinfo
566libdevinfo:	libnvpair libsec
567libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
568libdhcpsvc:	libinetutil
569libdhcputil:	libnsl libgen libinetutil libdlpi
570libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
571		libexacct libnsl libkstat libcurses
572libdll: 	libast
573libdlpi:	libinetutil libdladm
574libdscfg:	libnsctl libunistat libsocket libnsl
575libdtrace:	libproc libgen libctf
576libdtrace_jni:	libuutil libdtrace
577libefi:		libuuid
578libfstyp:	libnvpair
579libelfsign:	libcryptoutil libkmf
580libidmap:	libadutils libldap5 libavl libsldap
581libinetcfg:	libnsl libsocket libdlpi
582libiscsit:	libc libnvpair libstmf libuuid libnsl
583libkmf:		libcryptoutil pkcs11
584libnsl:		libmd5 libscf
585libmapid:	libresolv
586libnwam:	libdoor
587librdc:		libsocket libnsl libnsctl libunistat libdscfg
588libuuid:	libdlpi
589libinetutil:	libsocket
590libinstzones:	libzonecfg libcontract
591libpkg:		libwanboot libscf libadm
592libsecdb:	libnsl
593libsasl:	libgss libsocket pkcs11 libmd
594sasl_plugins:	pkcs11 libgss libsocket libsasl
595libsctp:	libsocket
596libshell:	libast libcmd libdll libsocket libsecdb
597libsip:		libmd5
598libsmbfs:	libsocket libnsl libkrb5
599libsocket:	libnsl
600libsum: 	libast
601libldap5:	libsasl libsocket libnsl libmd
602libsldap:	libldap5 libtsol libnsl libc libscf libresolv
603libpool:	libnvpair libexacct
604libpp:		libast
605libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
606		libbrand libpool libscf
607libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
608libproject:	libpool libproc libsecdb
609libtsnet:	libnsl libtsol libsecdb
610libwrap:	libnsl libsocket
611libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
612		libdhcputil
613libwanbootutil:	libnsl
614pam_modules:	libproject passwdutil $(SMARTCARD) smbsrv
615libscf:		libuutil libmd libgen libsmbios
616libinetsvc:	libscf
617librestart:	libuutil libscf
618../cmd/sgs/libdl:	../cmd/sgs/libconv
619../cmd/sgs/libelf:	../cmd/sgs/libconv
620pkcs11:		libcryptoutil
621print:		libldap5
622udapl/udapl_tavor:	udapl/libdat
623libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt \
624		libavl libefi libidmap libsec
625libzfs_jni:	libdiskmgt libnvpair libzfs
626libzpool:	libavl libumem libnvpair
627libsec:		libavl libidmap
628brand:		libc libsocket
629libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
630libexacct/demo:	libexacct libproject libsocket libnsl
631libtsalarm:	libpcp
632smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
633		libshare libidmap pkcs11 libsqlite
634libvscan:	libscf
635scsi:		libnvpair
636mpapi:		libpthread libdevinfo libsysevent libnvpair
637libgrubmgmt:	libdevinfo libzfs libfstyp
638pyzfs:		libnvpair libsec libidmap libzfs
639
640#
641# The reason this rule checks for the existence of the
642# Makefile is that some of the directories do not exist
643# in certain situations (e.g., exportable source builds,
644# OpenSolaris).
645#
646$(SUBDIRS): FRC
647	@if [ -f $@/Makefile  ]; then \
648		cd $@; pwd; $(MAKE) $(TARGET); \
649	else \
650		true; \
651	fi
652
653$(SUBDIRS:%=%-nodepend):
654	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
655		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
656	else \
657		true; \
658	fi
659
660FRC:
661