xref: /titanic_52/usr/src/lib/Makefile (revision 55f5292c612446ce6f93ddd248c0019b5974618b)
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
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	libipmp		\
116	libiscsit	\
117	libiscsitgt	\
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	libmapid	\
245	brand		\
246	policykit	\
247	hal		\
248	libshare	\
249	libsqlite	\
250	libidmap	\
251	libadutils	\
252	libipmi		\
253	libexacct/demo	\
254	libvrrpadm	\
255	libvscan	\
256	libgrubmgmt	\
257	smbsrv		\
258	libilb		\
259	scsi		\
260	mms		\
261	libima		\
262	libsun_ima	\
263	mpapi		\
264	librstp		\
265	libreparse	\
266	libhotplug	\
267	libfruutils	.WAIT	\
268	libfru		\
269	$($(MACH)_SUBDIRS)
270
271i386_SUBDIRS=		\
272	libntfs		\
273	libparted	\
274	libfdisk
275
276sparc_SUBDIRS= .WAIT	\
277	efcode		\
278	libc_psr	.WAIT	\
279	libds		\
280	libdscp		\
281	libprtdiag	.WAIT	\
282	libprtdiag_psr	\
283	libpri		\
284	librsc		\
285	storage		\
286	libpcp		\
287	libtsalarm
288
289FM_sparc_DEPLIBS= libpri
290
291fm:			\
292	libexacct	\
293	libipmi		\
294	libzfs		\
295	scsi		\
296	$(FM_$(MACH)_DEPLIBS)
297
298#
299# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
300# clean and clobber targets (for more information, see those targets, below).
301#
302NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
303
304DCSUBDIRS =		\
305	lvm
306
307MSGSUBDIRS=		\
308	abi		\
309	auditd_plugins	\
310	brand		\
311	cfgadm_plugins	\
312	gss_mechs/mech_dh	\
313	gss_mechs/mech_krb5	\
314	krb5		\
315	libast		\
316	libbsm		\
317	libc		\
318	libcfgadm	\
319	libcmd		\
320	libcontract	\
321	libcurses	\
322	libdhcpsvc 	\
323	libdhcputil	\
324	libipsecutil	\
325	libdiskmgt	\
326	libdladm	\
327	libdll		\
328	libgrubmgmt	\
329	libgss		\
330	libidmap	\
331	libinetcfg	\
332	libipmp		\
333	libilb		\
334	libinetutil	\
335	libinstzones	\
336	libnsl		\
337	libpam		\
338	libpicl		\
339	libpool		\
340	libpkg		\
341	libpp		\
342	libscf		\
343	libsasl		\
344	libldap5	\
345	libsecdb	\
346	libshare	\
347	libshell	\
348	libsldap	\
349	libslp		\
350	libsmbfs	\
351	libsmedia	\
352	libsum		\
353	libtsol		\
354	libuutil	\
355	libvrrpadm	\
356	libvscan	\
357	libwanboot	\
358	libwanbootutil	\
359	libzfs		\
360	libzonecfg	\
361	lvm		\
362	madv		\
363	mms		\
364	mpss		\
365	pam_modules	\
366	pyzfs		\
367	rpcsec_gss	\
368	libreparse
369MSGSUBDIRS += \
370	$($(MACH)_MSGSUBDIRS)
371
372sparc_MSGSUBDIRS=	\
373	libprtdiag	\
374	libprtdiag_psr
375
376i386_MSGSUBDIRS= libfdisk
377
378HDRSUBDIRS=		\
379	auditd_plugins	\
380	libast		\
381	libbrand	\
382	libbsm		\
383	libc		\
384	libcmd		\
385	libcmdutils	\
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	libwanboot	\
412	libwanbootutil	\
413	libipsecutil	\
414	libinetcfg	\
415	libinetsvc	\
416	libinetutil	\
417	libinstzones	\
418	libipmi		\
419	libipmp		\
420	libipp		\
421	libiscsit	\
422	libiscsitgt	\
423	libkstat	\
424	libkvm		\
425	libmail		\
426	libmd		\
427	libmtmalloc	\
428	libndmp		\
429	libnvpair	\
430	libnsctl	\
431	libnsl		\
432	libnwam		\
433	libpam		\
434	libpctx		\
435	libpicl		\
436	libpicltree	\
437	libplot		\
438	libpool		\
439	libpp		\
440	libproc		\
441	libraidcfg	\
442	librcm		\
443	librdc		\
444	libscf		\
445	libsip		\
446	libcommputil	\
447	libsmbios	\
448	librestart	\
449	librpcsvc	\
450	librsm		\
451	librstp		\
452	libsasl		\
453	libsec		\
454	libshell	\
455	libslp		\
456	libsmedia	\
457	libsqlite	\
458	libfcoe		\
459	libstmf		\
460	libstmfproxy	\
461	libsum		\
462	libsysevent	\
463	libtecla	\
464	libtnf		\
465	libtnfctl	\
466	libtnfprobe	\
467	libtsnet	\
468	libtsol		\
469	libvrrpadm	\
470	libvolmgt	\
471	libumem		\
472	libunistat	\
473	libuutil	\
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	mms		\
503	libreparse	\
504	$($(MACH)_HDRSUBDIRS)
505
506$(CLOSED_BUILD)HDRSUBDIRS += \
507	$(CLOSED)/lib/libc_i18n	\
508	$(CLOSED)/lib/libike
509
510i386_HDRSUBDIRS=	\
511	libparted	\
512	libfdisk
513
514sparc_HDRSUBDIRS=	\
515	libds		\
516	libdscp		\
517	libpri		\
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
584libdscfg:	libnsctl libunistat libsocket libnsl
585libdtrace:	libproc libgen libctf
586libdtrace_jni:	libuutil libdtrace
587libefi:		libuuid
588libfstyp:	libnvpair
589libelfsign:	libcryptoutil libkmf
590libidmap:	libadutils libldap5 libavl libsldap
591libinetcfg:	libnsl libsocket libdlpi
592libiscsit:	libc libnvpair libstmf libuuid libnsl
593libkmf:		libcryptoutil pkcs11
594libnsl:		libmd5 libscf
595libmapid:	libresolv
596libnwam:	libdoor
597librdc:		libsocket libnsl libnsctl libunistat libdscfg
598libuuid:	libdlpi
599$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
600libinetutil:	libsocket
601libipsecutil:	libtecla libsocket
602libinstzones:	libzonecfg libcontract
603libpkg:		libwanboot libscf libadm
604libsecdb:	libnsl
605libsasl:	libgss libsocket pkcs11 libmd
606sasl_plugins:	pkcs11 libgss libsocket libsasl
607libsctp:	libsocket
608libshell:	libast libcmd libdll libsocket libsecdb
609libsip:		libmd5
610libsmbfs:	libsocket libnsl libkrb5
611libsocket:	libnsl
612libstmfproxy: 	libstmf libsocket libnsl libpthread
613libsum: 	libast
614libldap5:	libsasl libsocket libnsl libmd
615libsldap:	libldap5 libtsol libnsl libc libscf libresolv
616libpool:	libnvpair libexacct
617libpp:		libast
618libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
619		libbrand libpool libscf
620libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
621libproject:	libpool libproc libsecdb
622libtsnet:	libnsl libtsol libsecdb
623libwrap:	libnsl libsocket
624libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
625		libdhcputil
626libwanbootutil:	libnsl
627pam_modules:	libproject passwdutil smbsrv
628libscf:		libuutil libmd libgen libsmbios
629libinetsvc:	libscf
630librestart:	libuutil libscf
631../cmd/sgs/libdl:	../cmd/sgs/libconv
632../cmd/sgs/libelf:	../cmd/sgs/libconv
633pkcs11:		libcryptoutil
634print:		libldap5
635udapl/udapl_tavor:	udapl/libdat
636libzfs:		libdevid libgen libnvpair libuutil libiscsitgt \
637		libadm libavl libefi libidmap
638libzfs_jni:	libdiskmgt libnvpair libzfs
639libzpool:	libavl libumem libnvpair
640libsec:		libavl libidmap
641brand:		libc libsocket
642libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
643libexacct/demo:	libexacct libproject libsocket libnsl
644libtsalarm:	libpcp
645smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
646		libshare libidmap pkcs11 libsqlite
647libvrrpadm:	libsocket libdladm
648libvscan:	libscf
649scsi:		libnvpair
650mpapi:		libpthread libdevinfo libsysevent libnvpair
651libgrubmgmt:	libdevinfo libzfs libfstyp
652pyzfs:		libnvpair libsec libidmap libzfs
653libreparse:	libnvpair
654libhotplug:	libnvpair
655cfgadm_plugins:	libhotplug
656libilb:		libsocket
657$(INTEL_BUILD)libdiskmgt:libfdisk
658
659#
660# The reason this rule checks for the existence of the
661# Makefile is that some of the directories do not exist
662# in certain situations (e.g., exportable source builds,
663# OpenSolaris).
664#
665$(SUBDIRS): FRC
666	@if [ -f $@/Makefile  ]; then \
667		cd $@; pwd; $(MAKE) $(TARGET); \
668	else \
669		true; \
670	fi
671
672$(SUBDIRS:%=%-nodepend):
673	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
674		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
675	else \
676		true; \
677	fi
678
679FRC:
680