xref: /titanic_50/usr/src/lib/Makefile (revision 1f0c339e39c0c782f9d4c4f3f11d373e24e1d76f)
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	libcustr	\
106	libdevice	\
107	libdevid	\
108	libdevinfo	\
109	libdhcpagent	\
110	libdhcputil	\
111	libdisasm	\
112	libdiskmgt	\
113	libdladm	\
114	libdll		\
115	libdlpi		\
116	libdns_sd	\
117	libdoor		\
118	libdscfg	\
119	libdtrace	\
120	libdtrace_jni	\
121	libefi		\
122	libelfsign	\
123	libeti		\
124	libexacct	\
125	libexacct/demo	\
126	libfakekernel	\
127	libfcoe		\
128	libfru		\
129	libfruutils	\
130	libfsmgt	\
131	libfstyp	\
132	libgen		\
133	libgrubmgmt	\
134	libgss		\
135	libhotplug	\
136	libidmap	\
137	libilb		\
138	libima		\
139	libinetsvc	\
140	libinetutil	\
141	libinstzones	\
142	libintl		\
143	libipadm	\
144	libipd		\
145	libipmi		\
146	libipmp		\
147	libipp		\
148	libipsecutil	\
149	libiscsit	\
150	libjedec	\
151	libkmf		\
152	libkrb5		\
153	libkstat	\
154	libkvm		\
155	libldap5	\
156	liblgrp		\
157	liblm		\
158	libm1		\
159	libmail		\
160	libmalloc	\
161	libmapid	\
162	libmapmalloc	\
163	libmd5		\
164	libmtmalloc	\
165	libmvec		\
166	libndmp		\
167	libnisdb	\
168	libnls		\
169	libnsctl	\
170	libnwam		\
171	libpam		\
172	libpcidb	\
173	libpctx		\
174	libpicl		\
175	libpicltree	\
176	libpkg		\
177	libpool		\
178	libpp		\
179	libproc		\
180	libproject	\
181	libpthread	\
182	libraidcfg	\
183	librcm		\
184	librdc		\
185	libreparse	\
186	libresolv	\
187	libresolv2	\
188	librestart	\
189	librpcsvc	\
190	librsm		\
191	librstp		\
192	librt		\
193	libsasl		\
194	libscf		\
195	libsched	\
196	libsctp		\
197	libsec		\
198	libsecdb	\
199	libsendfile	\
200	libsff		\
201	libshare	\
202	libshell	\
203	libsip		\
204	libsldap	\
205	libslp		\
206	libsmbfs	\
207	libsmbios	\
208	libsmedia	\
209	libsqlite	\
210	libsrpt		\
211	libstmf		\
212	libstmfproxy	\
213	libsum		\
214	libsun_ima	\
215	libsys		\
216	libsysevent	\
217	libtecla	\
218	libtermcap	\
219	libthread	\
220	libtnf		\
221	libtnfctl	\
222	libtnfprobe	\
223	libtsnet	\
224	libtsol		\
225	libumem		\
226	libunistat	\
227	libuuid		\
228	libuutil	\
229	libvolmgt	\
230	libvrrpadm	\
231	libvscan	\
232	libw		\
233	libwanboot	\
234	libwanbootutil	\
235	libwrap		\
236	libxcurses	\
237	libxcurses2	\
238	libxnet		\
239	libzfs		\
240	libzfs_core	\
241	libzfs_jni	\
242	libzonecfg	\
243	libzoneinfo	\
244	libzonestat	\
245	libzpool	\
246	madv		\
247	mpapi		\
248	mpss		\
249	nametoaddr	\
250	ncad_addr	\
251	nsswitch	\
252	pam_modules	\
253	passwdutil	\
254	pkcs11		\
255	policykit	\
256	print		\
257	pylibbe		\
258	pysolaris	\
259	pyzfs		\
260	raidcfg_plugins	\
261	rpcsec_gss	\
262	sasl_plugins	\
263	scsi		\
264	smbsrv		\
265	smhba		\
266	sun_fc		\
267	sun_sas		\
268	udapl		\
269	watchmalloc	\
270	$($(MACH)_SUBDIRS)
271
272i386_SUBDIRS=		\
273	libfdisk	\
274	libsaveargs
275
276sparc_SUBDIRS=		\
277	efcode		\
278	libds		\
279	libdscp		\
280	libprtdiag	\
281	libprtdiag_psr	\
282	libpri		\
283	librsc		\
284	storage		\
285	libpcp		\
286	libtsalarm	\
287	libv12n
288
289#
290# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
291# clean and clobber targets (for more information, see those targets, below).
292#
293NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
294
295DCSUBDIRS=
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	madv		\
353	mpss		\
354	pam_modules	\
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	libads		\
372	libast		\
373	libbrand	\
374	libbsm		\
375	libc		\
376	libcmd		\
377	libcmdutils	\
378	libcommputil	\
379	libcontract	\
380	libcpc		\
381	libcryptoutil	\
382	libctf		\
383	libcurses	\
384	libcustr	\
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	mpapi		\
490	passwdutil	\
491	pkcs11		\
492	policykit	\
493	scsi		\
494	smbsrv		\
495	smhba		\
496	udapl		\
497	$($(MACH)_HDRSUBDIRS)
498
499i386_HDRSUBDIRS=	\
500	libfdisk	\
501	libsaveargs
502
503sparc_HDRSUBDIRS=	\
504	libds		\
505	libdscp		\
506	libpri		\
507	libv12n		\
508	storage
509
510all :=		TARGET= all
511check :=	TARGET= check
512clean :=	TARGET= clean
513clobber :=	TARGET= clobber
514install :=	TARGET= install
515install_h :=	TARGET= install_h
516lint :=		TARGET= lint
517_dc :=		TARGET= _dc
518_msg :=		TARGET= _msg
519
520.KEEP_STATE:
521
522#
523# For the all and install targets, we clearly must respect library
524# dependencies so that the libraries link correctly.  However, for
525# the remaining targets (check, clean, clobber, install_h, lint, _dc
526# and _msg), libraries do not have any dependencies on one another
527# and thus respecting dependencies just slows down the build.
528# As such, for these rules, we use pattern replacement to explicitly
529# avoid triggering the dependency information.  Note that for clean,
530# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
531# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
532#
533
534all:			$(SUBDIRS)
535
536install:		$(SUBDIRS) .WAIT install_extra
537
538# extra libraries kept in other source areas
539install_extra:
540	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
541	@pwd
542
543clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
544
545install_h check:	$(HDRSUBDIRS:%=%-nodepend)
546
547_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
548
549_dc:			$(DCSUBDIRS:%=%-nodepend)
550
551# Library interdependencies are called out explicitly here.
552../cmd/sgs/libconv: common
553../cmd/sgs/libdl: common
554libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
555
556libm:		libc
557libmd:		libc
558libmp:		libc
559libnsl:		libc libmd libmp
560libnvpair:	libc libnsl
561libsocket:	libc libnsl
562
563basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
564basedeps :=	TARGET=install
565
566# The following dependencies don't need to be listed below as they are built
567# before everything else:
568# libc libm libmd libmp libnsl libnvpair libsocket
569abi:		libctf libmapmalloc libproc
570auditd_plugins: libbsm libsecdb libgss libmtmalloc
571brand:		libzonecfg libmapmalloc
572cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
573fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
574		libcontract libsysevent ../cmd/sgs/libelf libdladm
575$(SPARC_BLD)fm:	libpri
576gss_mechs/mech_dh: libgss
577gss_mechs/mech_dummy: libgss
578gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
579gss_mechs/mech_spnego: gss_mechs/mech_krb5
580krb5:		gss_mechs/mech_krb5 libtecla libldap5
581libadt_jni:	libbsm
582libadutils: 	libldap5 libresolv2
583libbe: 		libzfs libinstzones libuuid libgen libdevinfo libefi
584libbsm:		libinetutil libscf libsecdb libtsol
585libcfgadm:	libdevinfo
586libcmd: 	libsum libast
587libcmdutils:	libavl
588libcpc:		libpctx
589libcrypt:	libgen
590libdevid:	libdevinfo
591libdevinfo:	libsec libgen
592libdhcpagent:	libdhcputil libuuid libdlpi libcontract
593libdhcputil:	libgen libinetutil libdlpi
594libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
595$(INTEL_BLD)libdiskmgt: libfdisk
596libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
597		libpool
598libdll: 	libast
599libdlpi:	libinetutil libdladm
600libds:		libsysevent
601libdscfg:	libnsctl libunistat libadm
602libdtrace:	libproc libgen libctf libmapmalloc
603libdtrace_jni:	libuutil libdtrace
604libefi:		libuuid
605libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
606libeti:		libcurses
607libexacct/demo:	libexacct libproject
608libfakekernel:	libumem libcryptoutil
609libfcoe:	libdladm
610libfru:		libfruutils
611libfsmgt:	libkstat
612libgrubmgmt:	libdevinfo libzfs libfstyp libefi
613$(INTEL_BLD)libgrubmgmt: libfdisk
614libidmap:	libavl libuutil
615libinetsvc:	libscf
616libinstzones:	libzonecfg libcontract
617libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb
618libipmp:	libinetutil
619libipsecutil:	libtecla libtsol
620libiscsit:	libstmf libuuid
621libkmf:		libcryptoutil pkcs11
622libkvm:		../cmd/sgs/libelf
623libldap5:	libsasl
624libmapid:	libresolv2 libscf
625libndmp:	libscf
626libnisdb:	libldap5
627libnwam:	libscf libbsm libdladm
628libpcp:		libumem libdevinfo
629libpctx:	libproc
630libpkg:		libwanboot libscf libadm
631libpool:	libscf libexacct
632libpp:		libast
633libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
634$(INTEL_BLD)libproc: libsaveargs
635libproject:	libpool libproc libsecdb
636libprtdiag:	libkstat
637libprtdiag_psr:	libprtdiag
638libraidcfg:	libdevinfo
639librdc:		libnsctl libunistat libdscfg
640librestart:	libuutil libscf libpool libproject libsecdb libsysevent
641libsasl:	libgss pkcs11
642libsaveargs:	libdisasm
643libscf:		libuutil libgen libsmbios
644libsec:		libavl libidmap
645libsff:		libnvpair
646libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
647libshell:	libast libcmd libdll libsecdb
648libsip:		libmd5
649libsldap:	libldap5 libscf
650libsmbfs:	libkrb5 libsec libidmap pkcs11
651libsmbios:	libdevinfo
652libsrpt:	libstmf
653libstmf:	libscf
654libstmfproxy: 	libstmf libpthread
655libsum: 	libast
656libsun_ima:	libdevinfo libsysevent
657libsysevent:	libsecdb
658libtecla:	libcurses
659libtermcap:	libcurses
660libtnfctl:	../cmd/sgs/libelf
661libtsalarm:	libpcp
662libtsnet:	libtsol libsecdb
663libtsol:	libsecdb
664libuuid:	libdlpi
665libv12n:	libds libuuid
666libvolmgt:	libadm
667libvrrpadm:	libdladm libscf
668libvscan:	libscf libsecdb
669libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
670libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
671		libumem libtsol libzfs_core
672libzfs_jni:	libdiskmgt libzfs
673libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
674		libuutil libbsm libsecdb
675libzonestat:	libcmdutils libumem
676libzpool:	libavl libumem libcmdutils libsysevent
677madv:		libgen
678mpapi:		libpthread libdevinfo libsysevent
679mpss:		libgen
680nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
681pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
682passwdutil:	libsldap
683pkcs11:		libcryptoutil libgen libuuid
684policykit:	libsecdb
685print:		libldap5 libmd5 libsendfile
686pylibbe: 	libbe libzfs
687pysolaris:	libsec libidmap
688pyzfs:		libzfs
689raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
690rpcsec_gss:	libgss
691sasl_plugins:	pkcs11 libgss libsasl
692scsi:		libfru libumem libdevid libdevinfo
693smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
694		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
695		libuuid libfakekernel libads libgss libldap5 krb5
696storage:	libdevice libdevinfo libdevid
697sun_fc:		libdevinfo libsysevent
698sun_sas:	libdevinfo libsysevent libkstat libdevid
699udapl:		libdevinfo libdladm
700
701#
702# The reason this rule checks for the existence of the
703# Makefile is that some of the directories do not exist
704# in certain situations (e.g., exportable source builds,
705# OpenSolaris).
706#
707$(SUBDIRS): FRC
708	@if [ -f $@/Makefile  ]; then \
709		cd $@; pwd; $(MAKE) $(TARGET); \
710	else \
711		true; \
712	fi
713
714$(SUBDIRS:%=%-nodepend):
715	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
716		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
717	else \
718		true; \
719	fi
720
721FRC:
722