xref: /titanic_52/usr/src/lib/Makefile (revision a23420cf95f05ac67f2c299116a3225581e519d1)
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 2010 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26include ../Makefile.master
27
28#	Note that libcurses installs commands along with its library.
29#	This is a minor bug which probably should be fixed.
30#	Note also that a few extra libraries are kept in cmd source.
31#
32# Certain libraries are linked with, hence depend on, other libraries.
33#
34# Although we have historically used .WAIT to express dependencies, it
35# reduces the amount of parallelism and thus lengthens the time it
36# takes to build the libraries.  Thus, we now require that any new
37# libraries explicitly call out their dependencies.  Eventually, all
38# the library dependencies will be called out explicitly.  See
39# "Library interdependencies" near the end of this file.
40#
41# Aside from explicit dependencies (and legacy .WAITs), all libraries
42# are built in parallel.
43#
44.PARALLEL:
45
46#
47# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
48# but required due to the "dependencies" of using .WAIT to barrier the
49# parallel dmake builds.  once 4631488 has been fixed, they can be
50# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
51# shown in HDRSUBDIRS
52#
53SUBDIRS= \
54	common			.WAIT	\
55	../cmd/sgs/libconv		\
56	../cmd/sgs/libdl	.WAIT
57
58$(CLOSED_BUILD)SUBDIRS += \
59	$(CLOSED)/lib/libc_i18n
60
61SUBDIRS += \
62	libc			.WAIT	\
63	../cmd/sgs/libelf	.WAIT	\
64	c_synonyms			\
65	libmd				\
66	libmd5				\
67	librsm				\
68	libmp			.WAIT	\
69	libnsl			\
70	libsecdb		.WAIT	\
71	librpcsvc			\
72	libsocket		.WAIT	\
73	libsctp			\
74	libsip			\
75	libcommputil		\
76	libresolv			\
77	libresolv2		.WAIT	\
78	libw			.WAIT	\
79	libintl			.WAIT	\
80	../cmd/sgs/librtld_db	\
81	libaio			\
82	libast			\
83	libdll			\
84	libcmd			\
85	libshell		\
86	libsum			\
87	librt			\
88	libadm			\
89	libctf			\
90	libdtrace		\
91	libdtrace_jni		\
92	libcurses		\
93	libgen			\
94	libgss			\
95	libpam			\
96	libuuid			\
97	libthread		\
98	libpthread	.WAIT	\
99	libslp		\
100	libbsdmalloc	\
101	libdoor		\
102	libdevinfo	\
103	libdladm	\
104	libdlpi		\
105	libeti		\
106	libcrypt	\
107	libdns_sd	\
108	libefi		\
109	libfstyp	\
110	libwanboot	\
111	libwanbootutil	\
112	libcryptoutil	\
113	libinetcfg	\
114	libinetutil	\
115	libipadm	\
116	libipmp		\
117	libiscsit	\
118	libkmf		\
119	libkstat	\
120	libkvm		\
121	liblm		\
122	libmalloc	\
123	libmapmalloc	\
124	libmtmalloc	\
125	libnls		\
126	libnwam		\
127	libsmbios	\
128	libtecla	\
129	libumem		\
130	libnvpair	.WAIT	\
131	libexacct	\
132	libplot		\
133	libldap4	\
134	libsasl		\
135	libldap5	\
136	libsldap	.WAIT	\
137	libbsm		\
138	libsys		\
139	libsysevent	\
140	libnisdb	\
141	libpool		\
142	libpp		\
143	libproc		\
144	libproject	\
145	libsendfile	\
146	nametoaddr	\
147	ncad_addr	\
148	hbaapi		\
149	smhba		\
150	sun_fc		\
151	sun_sas		\
152	gss_mechs/mech_krb5	.WAIT	\
153	libkrb5	.WAIT	\
154	krb5	.WAIT	\
155	libsmbfs	\
156	libfcoe		\
157	libstmf		\
158	libstmfproxy	\
159	libnsctl	\
160	libunistat	\
161	libdscfg	\
162	librdc		\
163	libinstzones	\
164	libpkg
165
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	libxnet		\
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	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	pysolaris	\
245	libmapid	\
246	brand		\
247	policykit	\
248	hal		\
249	libshare	\
250	libsqlite	\
251	libidmap	\
252	libadutils	\
253	libipmi		\
254	libexacct/demo	\
255	libvrrpadm	\
256	libvscan	\
257	libgrubmgmt	\
258	smbsrv		\
259	libilb		\
260	scsi		\
261	mms		\
262	libima		\
263	libsun_ima	\
264	mpapi		\
265	librstp		\
266	libreparse	\
267	libhotplug	\
268	libfruutils	.WAIT	\
269	libfru		\
270	$($(MACH)_SUBDIRS)
271
272i386_SUBDIRS=		\
273	libntfs		\
274	libparted	\
275	libfdisk
276
277sparc_SUBDIRS= .WAIT	\
278	efcode		\
279	libc_psr	.WAIT	\
280	libds		\
281	libdscp		\
282	libprtdiag	.WAIT	\
283	libprtdiag_psr	\
284	libpri		\
285	librsc		\
286	storage		\
287	libpcp		\
288	libtsalarm	\
289	libv12n
290
291FM_sparc_DEPLIBS= libpri
292
293fm:			\
294	libexacct	\
295	libipmi		\
296	libzfs		\
297	scsi		\
298	$(FM_$(MACH)_DEPLIBS)
299
300#
301# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
302# clean and clobber targets (for more information, see those targets, below).
303#
304NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
305
306DCSUBDIRS =		\
307	lvm
308
309MSGSUBDIRS=		\
310	abi		\
311	auditd_plugins	\
312	brand		\
313	cfgadm_plugins	\
314	gss_mechs/mech_dh	\
315	gss_mechs/mech_krb5	\
316	krb5		\
317	libast		\
318	libbsm		\
319	libc		\
320	libcfgadm	\
321	libcmd		\
322	libcontract	\
323	libcurses	\
324	libdhcpsvc 	\
325	libdhcputil	\
326	libipsecutil	\
327	libdiskmgt	\
328	libdladm	\
329	libdll		\
330	libgrubmgmt	\
331	libgss		\
332	libidmap	\
333	libinetcfg	\
334	libipmp		\
335	libilb		\
336	libinetutil	\
337	libinstzones	\
338	libipadm	\
339	libnsl		\
340	libnwam		\
341	libpam		\
342	libpicl		\
343	libpool		\
344	libpkg		\
345	libpp		\
346	libscf		\
347	libsasl		\
348	libldap5	\
349	libsecdb	\
350	libshare	\
351	libshell	\
352	libsldap	\
353	libslp		\
354	libsmbfs	\
355	libsmedia	\
356	libsum		\
357	libtsol		\
358	libuutil	\
359	libvrrpadm	\
360	libvscan	\
361	libwanboot	\
362	libwanbootutil	\
363	libzfs		\
364	libzonecfg	\
365	lvm		\
366	madv		\
367	mms		\
368	mpss		\
369	pam_modules	\
370	pyzfs		\
371	pysolaris	\
372	rpcsec_gss	\
373	libreparse
374MSGSUBDIRS += \
375	$($(MACH)_MSGSUBDIRS)
376
377sparc_MSGSUBDIRS=	\
378	libprtdiag	\
379	libprtdiag_psr
380
381i386_MSGSUBDIRS= libfdisk
382
383HDRSUBDIRS=		\
384	auditd_plugins	\
385	libast		\
386	libbrand	\
387	libbsm		\
388	libc		\
389	libcmd		\
390	libcmdutils	\
391	libcommputil	\
392	libcontract	\
393	libcpc		\
394	libctf		\
395	libcurses	\
396	libcryptoutil	\
397	libdevice	\
398	libdevid	\
399	libdevinfo	\
400	libdiskmgt	\
401	libdladm	\
402	libdll		\
403	libdlpi		\
404	libdhcpagent	\
405	libdhcpsvc	\
406	libdhcputil	\
407	libdisasm	\
408	libdns_sd	\
409	libdscfg	\
410	libdtrace	\
411	libdtrace_jni	\
412	libelfsign	\
413	libeti		\
414	libfru		\
415	libfstyp	\
416	libgen		\
417	libipadm	\
418	libipsecutil	\
419	libinetcfg	\
420	libinetsvc	\
421	libinetutil	\
422	libinstzones	\
423	libipmi		\
424	libipmp		\
425	libipp		\
426	libiscsit	\
427	libkstat	\
428	libkvm		\
429	libmail		\
430	libmd		\
431	libmtmalloc	\
432	libndmp		\
433	libnvpair	\
434	libnsctl	\
435	libnsl		\
436	libnwam		\
437	libpam		\
438	libpctx		\
439	libpicl		\
440	libpicltree	\
441	libplot		\
442	libpool		\
443	libpp		\
444	libproc		\
445	libraidcfg	\
446	librcm		\
447	librdc		\
448	libscf		\
449	libsip		\
450	libsmbios	\
451	librestart	\
452	librpcsvc	\
453	librsm		\
454	librstp		\
455	libsasl		\
456	libsec		\
457	libshell	\
458	libslp		\
459	libsmedia	\
460	libsocket	\
461	libsqlite	\
462	libfcoe		\
463	libstmf		\
464	libstmfproxy	\
465	libsum		\
466	libsysevent	\
467	libtecla	\
468	libtnf		\
469	libtnfctl	\
470	libtnfprobe	\
471	libtsnet	\
472	libtsol		\
473	libvrrpadm	\
474	libvolmgt	\
475	libumem		\
476	libunistat	\
477	libuutil	\
478	libwanboot	\
479	libwanbootutil	\
480	libwrap		\
481	libxcurses2	\
482	libzfs		\
483	libzfs_jni	\
484	libzoneinfo	\
485	hal		\
486	policykit	\
487	lvm		\
488	pkcs11		\
489	passwdutil	\
490	../cmd/sendmail/libmilter	\
491	fm		\
492	udapl		\
493	libmapid	\
494	libkrb5		\
495	libsmbfs	\
496	libshare	\
497	libidmap	\
498	libvscan	\
499	libgrubmgmt	\
500	smbsrv		\
501	libilb		\
502	scsi		\
503	hbaapi		\
504	smhba		\
505	libima		\
506	libsun_ima	\
507	mpapi		\
508	mms		\
509	libreparse	\
510	$($(MACH)_HDRSUBDIRS)
511
512$(CLOSED_BUILD)HDRSUBDIRS += \
513	$(CLOSED)/lib/libc_i18n	\
514	$(CLOSED)/lib/libike
515
516i386_HDRSUBDIRS=	\
517	libparted	\
518	libfdisk
519
520sparc_HDRSUBDIRS=	\
521	libds		\
522	libdscp		\
523	libpri		\
524	libv12n		\
525	storage
526
527all :=		TARGET= all
528check :=	TARGET= check
529clean :=	TARGET= clean
530clobber :=	TARGET= clobber
531install :=	TARGET= install
532install_h :=	TARGET= install_h
533lint :=		TARGET= lint
534_dc :=		TARGET= _dc
535_msg :=		TARGET= _msg
536
537.KEEP_STATE:
538
539#
540# For the all and install targets, we clearly must respect library
541# dependencies so that the libraries link correctly.  However, for
542# the remaining targets (check, clean, clobber, install_h, lint, _dc
543# and _msg), libraries do not have any dependencies on one another
544# and thus respecting dependencies just slows down the build.
545# As such, for these rules, we use pattern replacement to explicitly
546# avoid triggering the dependency information.  Note that for clean,
547# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
548# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
549#
550
551all:			$(SUBDIRS)
552
553install:		$(SUBDIRS) .WAIT install_extra
554
555# extra libraries kept in other source areas
556install_extra:
557	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
558	@pwd
559
560clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
561
562install_h check:	$(HDRSUBDIRS:%=%-nodepend)
563
564_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
565
566_dc:			$(DCSUBDIRS:%=%-nodepend)
567
568#
569# Library interdependencies are called out explicitly here
570#
571auditd_plugins: libbsm libnsl libsecdb
572gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
573libadt_jni:	libbsm
574$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
575libast: 	libsocket
576libadutils: 	libldap5 libresolv libsocket libnsl
577nsswitch:	libadutils libidmap
578libbsm:		libtsol
579libcmd: 	libsum libast libsocket libnsl
580libcmdutils:	libavl
581libcontract:	libnvpair
582libdevid:	libdevinfo
583libdevinfo:	libnvpair libsec
584libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
585libdhcpsvc:	libinetutil
586libdhcputil:	libnsl libgen libinetutil libdlpi
587libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
588		libexacct libnsl libkstat libcurses
589libdll: 	libast
590libdlpi:	libinetutil libdladm
591libds:		libsysevent
592libdscfg:	libnsctl libunistat libsocket libnsl
593libdtrace:	libproc libgen libctf
594libdtrace_jni:	libuutil libdtrace
595libefi:		libuuid
596libfstyp:	libnvpair
597libelfsign:	libcryptoutil libkmf
598libidmap:	libadutils libldap5 libavl libsldap
599libinetcfg:	libnsl libsocket libdlpi libinetutil
600libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
601		libdladm libsecdb
602libiscsit:	libc libnvpair libstmf libuuid libnsl
603libkmf:		libcryptoutil pkcs11
604libnsl:		libmd5 libscf
605libmapid:	libresolv
606librdc:		libsocket libnsl libnsctl libunistat libdscfg
607libuuid:	libdlpi
608$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
609libinetutil:	libsocket
610libipsecutil:	libtecla libsocket
611libinstzones:	libzonecfg libcontract
612libpkg:		libwanboot libscf libadm
613libnwam:	libscf
614libsecdb:	libnsl
615libsasl:	libgss libsocket pkcs11 libmd
616sasl_plugins:	pkcs11 libgss libsocket libsasl
617libsctp:	libsocket
618libshell:	libast libcmd libdll libsocket libsecdb
619libsip:		libmd5
620libsmbfs:	libsocket libnsl libkrb5
621libsocket:	libnsl
622libstmfproxy: 	libstmf libsocket libnsl libpthread
623libsum: 	libast
624libsysevent:	libsecdb
625libldap5:	libsasl libsocket libnsl libmd
626libsldap:	libldap5 libtsol libnsl libc libscf libresolv
627libpool:	libnvpair libexacct
628libpp:		libast
629libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
630		libbrand libpool libscf
631libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
632libproject:	libpool libproc libsecdb
633libtsnet:	libnsl libtsol libsecdb
634libwrap:	libnsl libsocket
635libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
636		libdhcputil
637libwanbootutil:	libnsl
638pam_modules:	libproject passwdutil smbsrv
639libscf:		libuutil libmd libgen libsmbios
640libinetsvc:	libscf
641librestart:	libuutil libscf
642../cmd/sgs/libdl:	../cmd/sgs/libconv
643../cmd/sgs/libelf:	../cmd/sgs/libconv
644pkcs11:		libcryptoutil
645print:		libldap5
646udapl/udapl_tavor:	udapl/libdat
647libzfs:		libdevid libgen libnvpair libuutil \
648		libadm libavl libefi libidmap libmd
649libzfs_jni:	libdiskmgt libnvpair libzfs
650libzpool:	libavl libumem libnvpair
651libsec:		libavl libidmap
652brand:		libc libsocket
653libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
654libexacct/demo:	libexacct libproject libsocket libnsl
655libtsalarm:	libpcp
656smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
657		libshare libidmap pkcs11 libsqlite libcryptoutil libreparse
658libv12n:	libds libuuid
659libvrrpadm:	libsocket libdladm libscf
660libvscan:	libscf
661scsi:		libnvpair
662mpapi:		libpthread libdevinfo libsysevent libnvpair
663sun_fc:		libdevinfo libsysevent libnvpair
664libsun_ima:	libdevinfo libsysevent libnsl
665sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
666libgrubmgmt:	libdevinfo libzfs libfstyp
667pyzfs:		libnvpair libzfs
668pysolaris:	libsec libidmap
669libreparse:	libnvpair
670libhotplug:	libnvpair
671cfgadm_plugins:	libhotplug
672libilb:		libsocket
673$(INTEL_BUILD)libdiskmgt:libfdisk
674
675#
676# The reason this rule checks for the existence of the
677# Makefile is that some of the directories do not exist
678# in certain situations (e.g., exportable source builds,
679# OpenSolaris).
680#
681$(SUBDIRS): FRC
682	@if [ -f $@/Makefile  ]; then \
683		cd $@; pwd; $(MAKE) $(TARGET); \
684	else \
685		true; \
686	fi
687
688$(SUBDIRS:%=%-nodepend):
689	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
690		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
691	else \
692		true; \
693	fi
694
695FRC:
696