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