xref: /titanic_50/usr/src/lib/Makefile (revision 9f9b7953c22ba8b0f8372bd791fc6ecc63c69409)
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	iconv_modules	\
83	krb5		\
84	libadm		\
85	libads		\
86	libadt_jni	\
87	libadutils	\
88	libaio		\
89	libast		\
90	libavl		\
91	libbe		\
92	libbrand	\
93	libbsdmalloc	\
94	libbsm		\
95	libc_db		\
96	libcfgadm	\
97	libcmd		\
98	libcmdutils	\
99	libcommputil	\
100	libcontract	\
101	libcpc		\
102	libcrypt	\
103	libcryptoutil	\
104	libctf		\
105	libcurses	\
106	libcustr	\
107	libdevice	\
108	libdevid	\
109	libdevinfo	\
110	libdhcpagent	\
111	libdhcputil	\
112	libdisasm	\
113	libdiskmgt	\
114	libdladm	\
115	libdll		\
116	libdlpi		\
117	libdns_sd	\
118	libdoor		\
119	libdscfg	\
120	libdtrace	\
121	libdtrace_jni	\
122	libefi		\
123	libelfsign	\
124	libeti		\
125	libexacct	\
126	libexacct/demo	\
127	libfakekernel	\
128	libfcoe		\
129	libfru		\
130	libfruutils	\
131	libfsmgt	\
132	libfstyp	\
133	libgen		\
134	libgrubmgmt	\
135	libgss		\
136	libhotplug	\
137	libidmap	\
138	libilb		\
139	libima		\
140	libinetsvc	\
141	libinetutil	\
142	libinstzones	\
143	libintl		\
144	libipadm	\
145	libipd		\
146	libipmi		\
147	libipmp		\
148	libipp		\
149	libipsecutil	\
150	libiscsit	\
151	libjedec	\
152	libkmf		\
153	libkrb5		\
154	libkstat	\
155	libkvm		\
156	libldap5	\
157	liblgrp		\
158	liblm		\
159	libm1		\
160	libmail		\
161	libmalloc	\
162	libmapid	\
163	libmapmalloc	\
164	libmd5		\
165	libmtmalloc	\
166	libmvec		\
167	libndmp		\
168	libnisdb	\
169	libnls		\
170	libnsctl	\
171	libnwam		\
172	libpam		\
173	libpcidb	\
174	libpctx		\
175	libpicl		\
176	libpicltree	\
177	libpkg		\
178	libpool		\
179	libpp		\
180	libproc		\
181	libproject	\
182	libpthread	\
183	libraidcfg	\
184	librcm		\
185	librdc		\
186	libreparse	\
187	libresolv	\
188	libresolv2	\
189	librestart	\
190	librpcsvc	\
191	librsm		\
192	librstp		\
193	librt		\
194	libsasl		\
195	libscf		\
196	libsched	\
197	libsctp		\
198	libsec		\
199	libsecdb	\
200	libsendfile	\
201	libsff		\
202	libshare	\
203	libshell	\
204	libsip		\
205	libsldap	\
206	libslp		\
207	libsmbfs	\
208	libsmbios	\
209	libsmedia	\
210	libsqlite	\
211	libsrpt		\
212	libstmf		\
213	libstmfproxy	\
214	libsum		\
215	libsun_ima	\
216	libsys		\
217	libsysevent	\
218	libtecla	\
219	libtermcap	\
220	libthread	\
221	libtnf		\
222	libtnfctl	\
223	libtnfprobe	\
224	libtsnet	\
225	libtsol		\
226	libumem		\
227	libunistat	\
228	libuuid		\
229	libuutil	\
230	libvolmgt	\
231	libvrrpadm	\
232	libvscan	\
233	libw		\
234	libwanboot	\
235	libwanbootutil	\
236	libwrap		\
237	libxcurses	\
238	libxcurses2	\
239	libxnet		\
240	libzfs		\
241	libzfs_core	\
242	libzfs_jni	\
243	libzonecfg	\
244	libzoneinfo	\
245	libzonestat	\
246	libzpool	\
247	madv		\
248	mpapi		\
249	mpss		\
250	nametoaddr	\
251	ncad_addr	\
252	nsswitch	\
253	pam_modules	\
254	passwdutil	\
255	pkcs11		\
256	policykit	\
257	print		\
258	pylibbe		\
259	pysolaris	\
260	pyzfs		\
261	raidcfg_plugins	\
262	rpcsec_gss	\
263	sasl_plugins	\
264	scsi		\
265	smbsrv		\
266	smhba		\
267	sun_fc		\
268	sun_sas		\
269	udapl		\
270	watchmalloc	\
271	$($(MACH)_SUBDIRS)
272
273i386_SUBDIRS=		\
274	libfdisk	\
275	libsaveargs
276
277sparc_SUBDIRS=		\
278	efcode		\
279	libds		\
280	libdscp		\
281	libprtdiag	\
282	libprtdiag_psr	\
283	libpri		\
284	librsc		\
285	storage		\
286	libpcp		\
287	libtsalarm	\
288	libv12n
289
290#
291# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
292# clean and clobber targets (for more information, see those targets, below).
293#
294NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
295
296DCSUBDIRS=
297
298MSGSUBDIRS=		\
299	abi		\
300	auditd_plugins	\
301	brand		\
302	cfgadm_plugins	\
303	gss_mechs/mech_dh	\
304	gss_mechs/mech_krb5	\
305	krb5		\
306	libast		\
307	libbsm		\
308	libc		\
309	libcfgadm	\
310	libcmd		\
311	libcontract	\
312	libcurses	\
313	libdhcputil	\
314	libdiskmgt	\
315	libdladm	\
316	libdll		\
317	libgrubmgmt	\
318	libgss		\
319	libidmap	\
320	libilb		\
321	libinetutil	\
322	libinstzones	\
323	libipadm	\
324	libipmp		\
325	libipsecutil	\
326	libldap5	\
327	libnsl		\
328	libnwam		\
329	libpam		\
330	libpicl		\
331	libpkg		\
332	libpool		\
333	libpp		\
334	libreparse	\
335	libsasl		\
336	libscf		\
337	libsecdb	\
338	libshare	\
339	libshell	\
340	libsldap	\
341	libslp		\
342	libsmbfs	\
343	libsmedia	\
344	libsum		\
345	libtsol		\
346	libuutil	\
347	libvrrpadm	\
348	libvscan	\
349	libwanboot	\
350	libwanbootutil	\
351	libzfs		\
352	libzonecfg	\
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	libcustr	\
386	libdevice	\
387	libdevid	\
388	libdevinfo	\
389	libdhcpagent	\
390	libdhcputil	\
391	libdisasm	\
392	libdiskmgt	\
393	libdladm	\
394	libdll		\
395	libdlpi		\
396	libdns_sd	\
397	libdscfg	\
398	libdtrace	\
399	libdtrace_jni	\
400	libelfsign	\
401	libeti		\
402	libfakekernel	\
403	libfcoe		\
404	libfru		\
405	libfstyp	\
406	libgen		\
407	libgrubmgmt	\
408	libidmap	\
409	libilb		\
410	libima		\
411	libinetsvc	\
412	libinetutil	\
413	libinstzones	\
414	libipadm	\
415	libipd		\
416	libipmi		\
417	libipmp		\
418	libipp		\
419	libipsecutil	\
420	libiscsit	\
421	libkrb5		\
422	libkstat	\
423	libkvm		\
424	libmail		\
425	libmapid	\
426	libmd		\
427	libmtmalloc	\
428	libndmp		\
429	libnsctl	\
430	libnsl		\
431	libnvpair	\
432	libnwam		\
433	libpam		\
434	libpcidb	\
435	libpctx		\
436	libpicl		\
437	libpicltree	\
438	libpool		\
439	libpp		\
440	libproc		\
441	libraidcfg	\
442	librcm		\
443	librdc		\
444	libreparse	\
445	librestart	\
446	librpcsvc	\
447	librsm		\
448	librstp		\
449	libsasl		\
450	libscf		\
451	libsec		\
452	libsff		\
453	libshare	\
454	libshell	\
455	libsip		\
456	libslp		\
457	libsmbfs	\
458	libsmbios	\
459	libsmedia	\
460	libsocket	\
461	libsqlite	\
462	libsrpt		\
463	libstmf		\
464	libstmfproxy	\
465	libsum		\
466	libsun_ima	\
467	libsysevent	\
468	libtecla	\
469	libtermcap	\
470	libtnf		\
471	libtnfctl	\
472	libtnfprobe	\
473	libtsnet	\
474	libtsol		\
475	libumem		\
476	libunistat	\
477	libuutil	\
478	libvolmgt	\
479	libvrrpadm	\
480	libvscan	\
481	libwanboot	\
482	libwanbootutil	\
483	libwrap		\
484	libxcurses2	\
485	libzfs		\
486	libzfs_core	\
487	libzfs_jni	\
488	libzoneinfo	\
489	libzonestat	\
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
678madv:		libgen
679mpapi:		libpthread libdevinfo libsysevent
680mpss:		libgen
681nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
682pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
683passwdutil:	libsldap
684pkcs11:		libcryptoutil libgen libuuid
685policykit:	libsecdb
686print:		libldap5 libmd5 libsendfile
687pylibbe: 	libbe libzfs
688pysolaris:	libsec libidmap
689pyzfs:		libzfs
690raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
691rpcsec_gss:	libgss
692sasl_plugins:	pkcs11 libgss libsasl
693scsi:		libfru libumem libdevid libdevinfo
694smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
695		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
696		libuuid libfakekernel libads libgss libldap5 krb5
697storage:	libdevice libdevinfo libdevid
698sun_fc:		libdevinfo libsysevent
699sun_sas:	libdevinfo libsysevent libkstat libdevid
700udapl:		libdevinfo libdladm
701
702#
703# The reason this rule checks for the existence of the
704# Makefile is that some of the directories do not exist
705# in certain situations (e.g., exportable source builds,
706# OpenSolaris).
707#
708$(SUBDIRS): FRC
709	@if [ -f $@/Makefile  ]; then \
710		cd $@; pwd; $(MAKE) $(TARGET); \
711	else \
712		true; \
713	fi
714
715$(SUBDIRS:%=%-nodepend):
716	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
717		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
718	else \
719		true; \
720	fi
721
722FRC:
723