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