xref: /titanic_44/usr/src/lib/Makefile (revision e31df31051ab05e561eab5b23bb1c00627a10d64)
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	smhba		\
151	sun_fc		\
152	sun_sas		\
153	gss_mechs/mech_krb5	.WAIT	\
154	libkrb5	.WAIT	\
155	krb5	.WAIT	\
156	libsmbfs	\
157	libfcoe		\
158	libstmf		\
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	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	librstp		\
263	$($(MACH)_SUBDIRS)
264
265i386_SUBDIRS=		\
266	libntfs		\
267	libparted	\
268	libfdisk
269
270sparc_SUBDIRS= .WAIT	\
271	efcode		\
272	libc_psr	.WAIT	\
273	libds		\
274	libdscp		\
275	libprtdiag	.WAIT	\
276	libprtdiag_psr	\
277	libpri		\
278	librsc		\
279	libfruutils	.WAIT	\
280	libfru		\
281	storage		\
282	libpcp		\
283	libtsalarm
284
285FM_sparc_DEPLIBS= libpri
286
287fm:			\
288	libexacct	\
289	libipmi		\
290	libzfs		\
291	scsi		\
292	$(FM_$(MACH)_DEPLIBS)
293
294#
295# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
296# clean and clobber targets (for more information, see those targets, below).
297#
298NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
299
300DCSUBDIRS =		\
301	lvm
302
303MSGSUBDIRS=		\
304	abi		\
305	auditd_plugins	\
306	brand		\
307	cfgadm_plugins	\
308	gss_mechs/mech_dh	\
309	gss_mechs/mech_krb5	\
310	krb5		\
311	libast		\
312	libbsm		\
313	libc		\
314	libcfgadm	\
315	libcmd		\
316	libcontract	\
317	libcurses	\
318	libdhcpsvc 	\
319	libdhcputil	\
320	libipsecutil	\
321	libdiskmgt	\
322	libdladm	\
323	libdll		\
324	libgrubmgmt	\
325	libgss		\
326	libidmap	\
327	libinetcfg	\
328	libipmp		\
329	libinetutil	\
330	libinstzones	\
331	libnsl		\
332	libpam		\
333	libpicl		\
334	libpool		\
335	libpkg		\
336	libpp		\
337	libscf		\
338	libsasl		\
339	libldap5	\
340	libsecdb	\
341	libshare	\
342	libshell	\
343	libsldap	\
344	libslp		\
345	libsmbfs	\
346	libsmedia	\
347	libsum		\
348	libtsol		\
349	libuutil	\
350	libvscan	\
351	libwanboot	\
352	libwanbootutil	\
353	libzfs		\
354	libzonecfg	\
355	lvm		\
356	madv		\
357	mms		\
358	mpss		\
359	pam_modules	\
360	pyzfs		\
361	rpcsec_gss
362MSGSUBDIRS += \
363	$($(MACH)_MSGSUBDIRS)
364
365sparc_MSGSUBDIRS=	\
366	libprtdiag	\
367	libprtdiag_psr
368
369i386_MSGSUBDIRS= libfdisk
370
371HDRSUBDIRS=		\
372	auditd_plugins	\
373	libast		\
374	libbrand	\
375	libbsm		\
376	libc		\
377	libcmd		\
378	libcmdutils	\
379	libcontract	\
380	libcpc		\
381	libctf		\
382	libcurses	\
383	libcryptoutil	\
384	libdevice	\
385	libdevid	\
386	libdevinfo	\
387	libdiskmgt	\
388	libdladm	\
389	libdll		\
390	libdlpi		\
391	libdhcpagent	\
392	libdhcpsvc	\
393	libdhcputil	\
394	libdisasm	\
395	libdns_sd	\
396	libdscfg	\
397	libdtrace	\
398	libdtrace_jni	\
399	libelfsign	\
400	libeti		\
401	libfstyp	\
402	libgen		\
403	libwanboot	\
404	libwanbootutil	\
405	libipsecutil	\
406	libinetcfg	\
407	libinetsvc	\
408	libinetutil	\
409	libinstzones	\
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	librstp		\
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	smhba		\
488	libima		\
489	libsun_ima	\
490	mpapi		\
491	mms		\
492	$($(MACH)_HDRSUBDIRS)
493
494$(CLOSED_BUILD)HDRSUBDIRS += \
495	$(CLOSED)/lib/libc_i18n	\
496	$(CLOSED)/lib/libike
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#
550# Library interdependencies are called out explicitly here
551#
552auditd_plugins: libbsm libnsl libsecdb
553gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
554libadt_jni:	libbsm
555$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
556libast: 	libsocket
557libadutils: 	libldap5 libresolv libsocket libnsl
558nsswitch:	libadutils libidmap
559libbsm:		libtsol
560libcmd: 	libsum libast libsocket libnsl
561libcmdutils:	libavl
562libcontract:	libnvpair
563libdevid:	libdevinfo
564libdevinfo:	libnvpair libsec
565libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
566libdhcpsvc:	libinetutil
567libdhcputil:	libnsl libgen libinetutil libdlpi
568libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
569		libexacct libnsl libkstat libcurses
570libdll: 	libast
571libdlpi:	libinetutil libdladm
572libdscfg:	libnsctl libunistat libsocket libnsl
573libdtrace:	libproc libgen libctf
574libdtrace_jni:	libuutil libdtrace
575libefi:		libuuid
576libfstyp:	libnvpair
577libelfsign:	libcryptoutil libkmf
578libidmap:	libadutils libldap5 libavl libsldap
579libinetcfg:	libnsl libsocket libdlpi
580libiscsit:	libc libnvpair libstmf libuuid libnsl
581libkmf:		libcryptoutil pkcs11
582libnsl:		libmd5 libscf
583libmapid:	libresolv
584libnwam:	libdoor
585librdc:		libsocket libnsl libnsctl libunistat libdscfg
586libuuid:	libdlpi
587libinetutil:	libsocket
588libinstzones:	libzonecfg libcontract
589libpkg:		libwanboot libscf libadm
590libsecdb:	libnsl
591libsasl:	libgss libsocket pkcs11 libmd
592sasl_plugins:	pkcs11 libgss libsocket libsasl
593libsctp:	libsocket
594libshell:	libast libcmd libdll libsocket libsecdb
595libsip:		libmd5
596libsmbfs:	libsocket libnsl libkrb5
597libsocket:	libnsl
598libsum: 	libast
599libldap5:	libsasl libsocket libnsl libmd
600libsldap:	libldap5 libtsol libnsl libc libscf libresolv
601libpool:	libnvpair libexacct
602libpp:		libast
603libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
604		libbrand libpool libscf
605libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
606libproject:	libpool libproc libsecdb
607libtsnet:	libnsl libtsol libsecdb
608libwrap:	libnsl libsocket
609libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
610		libdhcputil
611libwanbootutil:	libnsl
612pam_modules:	libproject passwdutil smbsrv
613libscf:		libuutil libmd libgen libsmbios
614libinetsvc:	libscf
615librestart:	libuutil libscf
616../cmd/sgs/libdl:	../cmd/sgs/libconv
617../cmd/sgs/libelf:	../cmd/sgs/libconv
618pkcs11:		libcryptoutil
619print:		libldap5
620udapl/udapl_tavor:	udapl/libdat
621libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt \
622		libavl libefi libidmap
623libzfs_jni:	libdiskmgt libnvpair libzfs
624libzpool:	libavl libumem libnvpair
625libsec:		libavl libidmap
626brand:		libc libsocket
627libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
628libexacct/demo:	libexacct libproject libsocket libnsl
629libtsalarm:	libpcp
630smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
631		libshare libidmap pkcs11 libsqlite
632libvscan:	libscf
633scsi:		libnvpair
634mpapi:		libpthread libdevinfo libsysevent libnvpair
635libgrubmgmt:	libdevinfo libzfs libfstyp
636pyzfs:		libnvpair libsec libidmap libzfs
637
638#
639# The reason this rule checks for the existence of the
640# Makefile is that some of the directories do not exist
641# in certain situations (e.g., exportable source builds,
642# OpenSolaris).
643#
644$(SUBDIRS): FRC
645	@if [ -f $@/Makefile  ]; then \
646		cd $@; pwd; $(MAKE) $(TARGET); \
647	else \
648		true; \
649	fi
650
651$(SUBDIRS:%=%-nodepend):
652	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
653		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
654	else \
655		true; \
656	fi
657
658FRC:
659