xref: /titanic_44/usr/src/lib/Makefile (revision 702941cd97e30d600c2c1275823bc58231b2c361)
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 2011 Nexenta Systems, Inc.  All rights reserved.
23# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright (c) 2012 by Delphix. All rights reserved.
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
58SUBDIRS += \
59	libc			.WAIT	\
60	../cmd/sgs/libelf	.WAIT	\
61	c_synonyms			\
62	libmd				\
63	libmd5				\
64	librsm				\
65	libmp			.WAIT	\
66	libnsl			\
67	libsecdb		.WAIT	\
68	librpcsvc			\
69	libsocket		.WAIT	\
70	libsctp			\
71	libsip			\
72	libcommputil		\
73	libresolv			\
74	libresolv2		.WAIT	\
75	libw			.WAIT	\
76	libintl			.WAIT	\
77	../cmd/sgs/librtld_db	\
78	libaio			\
79	libast			\
80	libdll			\
81	libcmd			\
82	libshell		\
83	libsum			\
84	librt			\
85	libadm			\
86	libctf			\
87	libdtrace		\
88	libdtrace_jni		\
89	libcurses		\
90	libtermcap		\
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	libsasl		\
130	libldap5	\
131	libsldap	.WAIT	\
132	libbsm		\
133	libsys		\
134	libsysevent	\
135	libnisdb	\
136	libpool		\
137	libpp		\
138	libproc		\
139	libproject	\
140	libsendfile	\
141	nametoaddr	\
142	ncad_addr	\
143	hbaapi		\
144	smhba		\
145	sun_fc		\
146	sun_sas		\
147	gss_mechs/mech_krb5	.WAIT	\
148	libkrb5	.WAIT	\
149	krb5	.WAIT	\
150	libsmbfs	\
151	libfcoe		\
152	libsrpt		\
153	libstmf		\
154	libstmfproxy	\
155	libnsctl	\
156	libunistat	\
157	libdscfg	\
158	librdc		\
159	libinstzones	\
160	libpkg
161
162SUBDIRS += \
163	passwdutil	\
164	pam_modules	\
165	crypt_modules	\
166	libadt_jni	\
167	abi		\
168	auditd_plugins	\
169	libvolmgt	\
170	libdevice	\
171	libdevid	\
172	libdhcpsvc	\
173	libc_db		\
174	libndmp		\
175	libsec		\
176	libtnfprobe	\
177	libtnf		\
178	libtnfctl	\
179	libdhcpagent	\
180	libdhcpdu	\
181	libdhcputil	\
182	libxnet		\
183	libipsecutil
184$(CLOSED_BUILD)SUBDIRS += \
185	$(CLOSED)/lib/libike
186SUBDIRS += \
187	nsswitch	\
188	print		\
189	libuutil	\
190	libscf		\
191	libinetsvc	\
192	librestart	\
193	libsched	\
194	libelfsign	\
195	pkcs11		.WAIT	\
196	libpctx		.WAIT	\
197	libcpc		\
198	watchmalloc	\
199	extendedFILE	\
200	madv		\
201	mpss		\
202	libdisasm	\
203	libwrap		\
204	libxcurses	\
205	libxcurses2	\
206	libbrand	.WAIT   \
207	libzonecfg	\
208	libzoneinfo	\
209	libzonestat	\
210	libtsnet	\
211	libtsol		\
212	gss_mechs/mech_spnego	\
213	gss_mechs/mech_dummy	\
214	gss_mechs/mech_dh	\
215	rpcsec_gss	\
216	libraidcfg	.WAIT	\
217	librcm		.WAIT	\
218	libcfgadm	.WAIT	\
219	libpicl		.WAIT	\
220	libpicltree	.WAIT \
221	raidcfg_plugins	\
222	cfgadm_plugins	\
223	libmail		\
224	lvm		\
225	libsmedia	\
226	libipp		\
227	libdiskmgt	\
228	liblgrp		\
229	libfsmgt	\
230	fm		\
231	libavl		\
232	libcmdutils	\
233	libcontract	\
234	../cmd/sendmail/libmilter	\
235	sasl_plugins	\
236	udapl		\
237	libzpool	\
238	libzfs_core	\
239	libzfs		\
240	libbe		\
241	pylibbe		\
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	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	libsaveargs
276
277sparc_SUBDIRS= .WAIT	\
278	efcode		\
279	libds		\
280	libdscp		\
281	libprtdiag	.WAIT	\
282	libprtdiag_psr	\
283	libpri		\
284	librsc		\
285	storage		\
286	libpcp		\
287	libtsalarm	\
288	libv12n
289
290FM_sparc_DEPLIBS= libpri
291
292fm:			\
293	libexacct	\
294	libipmi		\
295	libzfs		\
296	scsi		\
297	$(FM_$(MACH)_DEPLIBS)
298
299#
300# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
301# clean and clobber targets (for more information, see those targets, below).
302#
303NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
304
305DCSUBDIRS =		\
306	lvm
307
308MSGSUBDIRS=		\
309	abi		\
310	auditd_plugins	\
311	brand		\
312	cfgadm_plugins	\
313	gss_mechs/mech_dh	\
314	gss_mechs/mech_krb5	\
315	krb5		\
316	libast		\
317	libbsm		\
318	libc		\
319	libcfgadm	\
320	libcmd		\
321	libcontract	\
322	libcurses	\
323	libdhcpsvc 	\
324	libdhcputil	\
325	libipsecutil	\
326	libdiskmgt	\
327	libdladm	\
328	libdll		\
329	libgrubmgmt	\
330	libgss		\
331	libidmap	\
332	libipmp		\
333	libilb		\
334	libinetutil	\
335	libinstzones	\
336	libipadm	\
337	libnsl		\
338	libnwam		\
339	libpam		\
340	libpicl		\
341	libpool		\
342	libpkg		\
343	libpp		\
344	libscf		\
345	libsasl		\
346	libldap5	\
347	libsecdb	\
348	libshare	\
349	libshell	\
350	libsldap	\
351	libslp		\
352	libsmbfs	\
353	libsmedia	\
354	libsum		\
355	libtsol		\
356	libuutil	\
357	libvrrpadm	\
358	libvscan	\
359	libwanboot	\
360	libwanbootutil	\
361	libzfs		\
362	libzonecfg	\
363	lvm		\
364	madv		\
365	mpss		\
366	pam_modules	\
367	pyzfs		\
368	pysolaris	\
369	rpcsec_gss	\
370	libreparse
371MSGSUBDIRS += \
372	$($(MACH)_MSGSUBDIRS)
373
374sparc_MSGSUBDIRS=	\
375	libprtdiag	\
376	libprtdiag_psr
377
378i386_MSGSUBDIRS= libfdisk
379
380HDRSUBDIRS=		\
381	auditd_plugins	\
382	libast		\
383	libbrand	\
384	libbsm		\
385	libc		\
386	libcmd		\
387	libcmdutils	\
388	libcommputil	\
389	libcontract	\
390	libcpc		\
391	libctf		\
392	libcurses	\
393	libtermcap	\
394	libcryptoutil	\
395	libdevice	\
396	libdevid	\
397	libdevinfo	\
398	libdiskmgt	\
399	libdladm	\
400	libdll		\
401	libdlpi		\
402	libdhcpagent	\
403	libdhcpsvc	\
404	libdhcputil	\
405	libdisasm	\
406	libdns_sd	\
407	libdscfg	\
408	libdtrace	\
409	libdtrace_jni	\
410	libelfsign	\
411	libeti		\
412	libfru		\
413	libfstyp	\
414	libgen		\
415	libipadm	\
416	libipsecutil	\
417	libinetsvc	\
418	libinetutil	\
419	libinstzones	\
420	libipmi		\
421	libipmp		\
422	libipp		\
423	libiscsit	\
424	libkstat	\
425	libkvm		\
426	libmail		\
427	libmd		\
428	libmtmalloc	\
429	libndmp		\
430	libnvpair	\
431	libnsctl	\
432	libnsl		\
433	libnwam		\
434	libpam		\
435	libpctx		\
436	libpicl		\
437	libpicltree	\
438	libpool		\
439	libpp		\
440	libproc		\
441	libraidcfg	\
442	librcm		\
443	librdc		\
444	libscf		\
445	libsip		\
446	libsmbios	\
447	librestart	\
448	librpcsvc	\
449	librsm		\
450	librstp		\
451	libsasl		\
452	libsec		\
453	libshell	\
454	libslp		\
455	libsmedia	\
456	libsocket	\
457	libsqlite	\
458	libfcoe		\
459	libsrpt		\
460	libstmf		\
461	libstmfproxy	\
462	libsum		\
463	libsysevent	\
464	libtecla	\
465	libtnf		\
466	libtnfctl	\
467	libtnfprobe	\
468	libtsnet	\
469	libtsol		\
470	libvrrpadm	\
471	libvolmgt	\
472	libumem		\
473	libunistat	\
474	libuutil	\
475	libwanboot	\
476	libwanbootutil	\
477	libwrap		\
478	libxcurses2	\
479	libzfs		\
480	libzfs_core	\
481	libzfs_jni	\
482	libzoneinfo	\
483	libzonestat	\
484	hal		\
485	policykit	\
486	lvm		\
487	pkcs11		\
488	passwdutil	\
489	../cmd/sendmail/libmilter	\
490	fm		\
491	udapl		\
492	libmapid	\
493	libkrb5		\
494	libsmbfs	\
495	libshare	\
496	libidmap	\
497	libvscan	\
498	libgrubmgmt	\
499	smbsrv		\
500	libilb		\
501	scsi		\
502	hbaapi		\
503	smhba		\
504	libima		\
505	libsun_ima	\
506	mpapi		\
507	libreparse	\
508	$($(MACH)_HDRSUBDIRS)
509
510$(CLOSED_BUILD)HDRSUBDIRS += \
511	$(CLOSED)/lib/libike
512
513i386_HDRSUBDIRS=	\
514	libparted	\
515	libfdisk	\
516	libsaveargs
517
518sparc_HDRSUBDIRS=	\
519	libds		\
520	libdscp		\
521	libpri		\
522	libv12n		\
523	storage
524
525all :=		TARGET= all
526check :=	TARGET= check
527clean :=	TARGET= clean
528clobber :=	TARGET= clobber
529install :=	TARGET= install
530install_h :=	TARGET= install_h
531lint :=		TARGET= lint
532_dc :=		TARGET= _dc
533_msg :=		TARGET= _msg
534
535.KEEP_STATE:
536
537#
538# For the all and install targets, we clearly must respect library
539# dependencies so that the libraries link correctly.  However, for
540# the remaining targets (check, clean, clobber, install_h, lint, _dc
541# and _msg), libraries do not have any dependencies on one another
542# and thus respecting dependencies just slows down the build.
543# As such, for these rules, we use pattern replacement to explicitly
544# avoid triggering the dependency information.  Note that for clean,
545# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
546# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
547#
548
549all:			$(SUBDIRS)
550
551install:		$(SUBDIRS) .WAIT install_extra
552
553# extra libraries kept in other source areas
554install_extra:
555	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
556	@pwd
557
558clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
559
560install_h check:	$(HDRSUBDIRS:%=%-nodepend)
561
562_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
563
564_dc:			$(DCSUBDIRS:%=%-nodepend)
565
566#
567# Library interdependencies are called out explicitly here
568#
569auditd_plugins: libbsm libnsl libsecdb
570gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
571libadt_jni:	libbsm
572libast: 	libsocket
573libadutils: 	libldap5 libresolv libsocket libnsl
574nsswitch:	libadutils libidmap
575libbe: 		libzfs
576libbsm:		libtsol
577libcmd: 	libsum libast libsocket libnsl
578libcmdutils:	libavl
579libcontract:	libnvpair
580libdevid:	libdevinfo
581libdevinfo:	libnvpair libsec
582libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
583libdhcpsvc:	libinetutil
584libdhcputil:	libnsl libgen libinetutil libdlpi
585libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
586		libexacct libnsl libkstat libcurses
587libdll: 	libast
588libdlpi:	libinetutil libdladm
589libds:		libsysevent
590libdscfg:	libnsctl libunistat libsocket libnsl
591libdtrace:	libproc libgen libctf
592libdtrace_jni:	libuutil libdtrace
593libefi:		libuuid
594libfstyp:	libnvpair
595libelfsign:	libcryptoutil libkmf
596libidmap:	libadutils libldap5 libavl libsldap libuutil
597libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
598		libdladm libsecdb
599libiscsit:	libc libnvpair libstmf libuuid libnsl
600libkmf:		libcryptoutil pkcs11
601libnsl:		libmd5
602libmapid:	libresolv
603librdc:		libsocket libnsl libnsctl libunistat libdscfg
604libuuid:	libdlpi
605$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
606libinetutil:	libsocket
607libipsecutil:	libtecla libsocket
608libinstzones:	libzonecfg libcontract
609libpkg:		libwanboot libscf libadm
610libnwam:	libscf
611libsecdb:	libnsl
612libsasl:	libgss libsocket pkcs11 libmd
613sasl_plugins:	pkcs11 libgss libsocket libsasl
614libsctp:	libsocket
615libshell:	libast libcmd libdll libsocket libsecdb
616libsip:		libmd5
617libsmbfs:	libcmdutils libsocket libnsl libkrb5
618libsocket:	libnsl
619libstmfproxy: 	libstmf libsocket libnsl libpthread
620libsum: 	libast
621libsysevent:	libsecdb
622libldap5:	libsasl libsocket libnsl libmd
623libsldap:	libldap5 libtsol libnsl libc libscf libresolv
624libpool:	libnvpair libexacct
625libpp:		libast
626libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
627		libbrand libpool libscf
628libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
629libproject:	libpool libproc libsecdb
630libtermcap:	libcurses
631libtsnet:	libnsl libtsol libsecdb
632libwrap:	libnsl libsocket
633libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
634		libdhcputil
635libwanbootutil:	libnsl
636pam_modules:	libproject passwdutil smbsrv
637libscf:		libuutil libmd libgen libsmbios libnsl
638libinetsvc:	libscf
639librestart:	libuutil libscf
640libsaveargs:	libdisasm
641../cmd/sgs/libdl:	../cmd/sgs/libconv
642../cmd/sgs/libelf:	../cmd/sgs/libconv
643pkcs11:		libcryptoutil
644print:		libldap5
645udapl/udapl_tavor:	udapl/libdat
646libzfs:		libdevid libgen libnvpair libuutil \
647		libadm libavl libefi libidmap libmd libzfs_core
648libzfs_core:	libnvpair
649libzfs_jni:	libdiskmgt libnvpair libzfs
650libzpool:	libavl libumem libnvpair libcmdutils
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 \
658		libreparse libcmdutils
659libv12n:	libds libuuid
660libvrrpadm:	libsocket libdladm libscf
661libvscan:	libscf
662libfru:		libfruutils
663scsi:		libnvpair libfru
664mpapi:		libpthread libdevinfo libsysevent libnvpair
665sun_fc:		libdevinfo libsysevent libnvpair
666libsun_ima:	libdevinfo libsysevent libnsl
667sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
668libgrubmgmt:	libdevinfo libzfs libfstyp
669pylibbe: 	libbe libzfs
670pyzfs:		libnvpair libzfs
671pysolaris:	libsec libidmap
672libreparse:	libnvpair
673libhotplug:	libnvpair
674cfgadm_plugins:	libhotplug
675libilb:		libsocket
676$(INTEL_BUILD)libdiskmgt:libfdisk
677
678#
679# The reason this rule checks for the existence of the
680# Makefile is that some of the directories do not exist
681# in certain situations (e.g., exportable source builds,
682# OpenSolaris).
683#
684$(SUBDIRS): FRC
685	@if [ -f $@/Makefile  ]; then \
686		cd $@; pwd; $(MAKE) $(TARGET); \
687	else \
688		true; \
689	fi
690
691$(SUBDIRS:%=%-nodepend):
692	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
693		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
694	else \
695		true; \
696	fi
697
698FRC:
699