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