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