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