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