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