xref: /illumos-gate/usr/src/lib/Makefile (revision f22cbd2db87ae3945ed6a9166f8b9d61b65c6ab9)
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 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#
34
35include ../Makefile.master
36
37#	Note that libcurses installs commands along with its library.
38#	This is a minor bug which probably should be fixed.
39#	Note also that a few extra libraries are kept in cmd source.
40#
41# Certain libraries are linked with, hence depend on, other libraries.
42# Library dependencies are called out explicitly, see "Library
43# interdependencies" below.
44.PARALLEL:
45
46# Build libc and its dependencies
47SUBDIRS=			\
48	crt			\
49	../cmd/sgs/libconv	\
50	../cmd/sgs/libdl	\
51	libc			\
52	.WAIT
53
54# Build libraries with lots of dependents
55SUBDIRS +=		\
56	libm		\
57	libmd		\
58	libmp		\
59	libnsl		\
60	libnvpair	\
61	libsocket	\
62	.WAIT
63
64# Build everything else. Aside from explicit dependencies, all libraries
65# are built in parallel.
66SUBDIRS +=				\
67	../cmd/sendmail/libmilter	\
68	../cmd/sgs/libelf	\
69	../cmd/sgs/librtld_db	\
70	abi		\
71	auditd_plugins	\
72	brand		\
73	c_synonyms	\
74	cfgadm_plugins	\
75	crypt_modules	\
76	extendedFILE	\
77	fm		\
78	getloginx	\
79	gss_mechs/mech_dh	\
80	gss_mechs/mech_dummy	\
81	gss_mechs/mech_krb5	\
82	gss_mechs/mech_spnego	\
83	hal		\
84	hbaapi		\
85	krb5		\
86	libadm		\
87	libads		\
88	libadt_jni	\
89	libadutils	\
90	libaio		\
91	libast		\
92	libavl		\
93	libbe		\
94	libbrand	\
95	libbsdmalloc	\
96	libbsm		\
97	libc_db		\
98	libcfgadm	\
99	libcmd		\
100	libcmdutils	\
101	libcommputil	\
102	libcontract	\
103	libcpc		\
104	libcrypt	\
105	libcryptoutil	\
106	libctf		\
107	libcurses	\
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	libefi		\
124	libelfsign	\
125	libeti		\
126	libexacct	\
127	libexacct/demo	\
128	libfakekernel	\
129	libfcoe		\
130	libficl		\
131	libfru		\
132	libfruutils	\
133	libfsmgt	\
134	libfstyp	\
135	libgen		\
136	libgrubmgmt	\
137	libgss		\
138	libhotplug	\
139	libidmap	\
140	libilb		\
141	libima		\
142	libinetsvc	\
143	libinetutil	\
144	libinstzones	\
145	libintl		\
146	libipadm	\
147	libipd		\
148	libipmi		\
149	libipmp		\
150	libipp		\
151	libipsecutil	\
152	libiscsit	\
153	libkmf		\
154	libkrb5		\
155	libkstat	\
156	libkvm		\
157	libldap5	\
158	liblgrp		\
159	liblm		\
160	libm1		\
161	libmail		\
162	libmalloc	\
163	libmapid	\
164	libmapmalloc	\
165	libmd5		\
166	libmtmalloc	\
167	libmvec		\
168	libndmp		\
169	libnisdb	\
170	libnls		\
171	libnsctl	\
172	libnwam		\
173	libofmt		\
174	libpam		\
175	libpcidb	\
176	libpctx		\
177	libpicl		\
178	libpicltree	\
179	libpkg		\
180	libpool		\
181	libpp		\
182	libproc		\
183	libproject	\
184	libpthread	\
185	libraidcfg	\
186	librcm		\
187	librdc		\
188	libreparse	\
189	libresolv	\
190	libresolv2	\
191	librestart	\
192	librpcsvc	\
193	librsm		\
194	librstp		\
195	librt		\
196	libsasl		\
197	libscf		\
198	libsched	\
199	libsctp		\
200	libsec		\
201	libsecdb	\
202	libsendfile	\
203	libsff		\
204	libshare	\
205	libshell	\
206	libsip		\
207	libsldap	\
208	libslp		\
209	libsmbfs	\
210	libsmbios	\
211	libsmedia	\
212	libsqlite	\
213	libsrpt		\
214	libstmf		\
215	libstmfproxy	\
216	libsum		\
217	libsun_ima	\
218	libsys		\
219	libsysevent	\
220	libtecla	\
221	libtermcap	\
222	libthread	\
223	libtnf		\
224	libtnfctl	\
225	libtnfprobe	\
226	libtsnet	\
227	libtsol		\
228	libumem		\
229	libunistat	\
230	libuuid		\
231	libuutil	\
232	libvolmgt	\
233	libvrrpadm	\
234	libvscan	\
235	libw		\
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	libinstzones	\
322	libipadm	\
323	libipmp		\
324	libipsecutil	\
325	libldap5	\
326	libnsl		\
327	libnwam		\
328	libofmt		\
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	libzfs		\
350	libzonecfg	\
351	madv		\
352	mpss		\
353	pam_modules	\
354	pyzfs		\
355	rpcsec_gss	\
356	$($(MACH)_MSGSUBDIRS)
357
358sparc_MSGSUBDIRS=	\
359	libprtdiag	\
360	libprtdiag_psr
361
362i386_MSGSUBDIRS= libfdisk
363
364HDRSUBDIRS=				\
365	../cmd/sendmail/libmilter	\
366	auditd_plugins	\
367	fm		\
368	hal		\
369	hbaapi		\
370	libads		\
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	libofmt		\
431	libpam		\
432	libpcidb	\
433	libpctx		\
434	libpicl		\
435	libpicltree	\
436	libpool		\
437	libpp		\
438	libproc		\
439	libraidcfg	\
440	librcm		\
441	librdc		\
442	libreparse	\
443	librestart	\
444	librpcsvc	\
445	librsm		\
446	librstp		\
447	libsasl		\
448	libscf		\
449	libsec		\
450	libsff		\
451	libshare	\
452	libshell	\
453	libsip		\
454	libslp		\
455	libsmbfs	\
456	libsmbios	\
457	libsmedia	\
458	libsocket	\
459	libsqlite	\
460	libsrpt		\
461	libstmf		\
462	libstmfproxy	\
463	libsum		\
464	libsun_ima	\
465	libsysevent	\
466	libtecla	\
467	libtermcap	\
468	libtnf		\
469	libtnfctl	\
470	libtnfprobe	\
471	libtsnet	\
472	libtsol		\
473	libumem		\
474	libunistat	\
475	libuutil	\
476	libvolmgt	\
477	libvrrpadm	\
478	libvscan	\
479	libwrap		\
480	libxcurses2	\
481	libzfs		\
482	libzfs_core	\
483	libzfs_jni	\
484	libzoneinfo	\
485	libzonestat	\
486	mpapi		\
487	passwdutil	\
488	pkcs11		\
489	policykit	\
490	scsi		\
491	smbsrv		\
492	smhba		\
493	udapl		\
494	$($(MACH)_HDRSUBDIRS)
495
496i386_HDRSUBDIRS=	\
497	libfdisk	\
498	libsaveargs
499
500sparc_HDRSUBDIRS=	\
501	libds		\
502	libdscp		\
503	libpri		\
504	libv12n		\
505	storage
506
507all :=		TARGET= all
508check :=	TARGET= check
509clean :=	TARGET= clean
510clobber :=	TARGET= clobber
511install :=	TARGET= install
512install_h :=	TARGET= install_h
513lint :=		TARGET= lint
514_dc :=		TARGET= _dc
515_msg :=		TARGET= _msg
516
517.KEEP_STATE:
518
519#
520# For the all and install targets, we clearly must respect library
521# dependencies so that the libraries link correctly.  However, for
522# the remaining targets (check, clean, clobber, install_h, lint, _dc
523# and _msg), libraries do not have any dependencies on one another
524# and thus respecting dependencies just slows down the build.
525# As such, for these rules, we use pattern replacement to explicitly
526# avoid triggering the dependency information.  Note that for clean,
527# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
528# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
529#
530
531all:			$(SUBDIRS)
532
533install:		$(SUBDIRS) .WAIT install_extra
534
535# extra libraries kept in other source areas
536install_extra:
537	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
538	@pwd
539
540clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
541
542install_h check:	$(HDRSUBDIRS:%=%-nodepend)
543
544_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
545
546_dc:			$(DCSUBDIRS:%=%-nodepend)
547
548# Library interdependencies are called out explicitly here.
549../cmd/sgs/libconv: crt
550../cmd/sgs/libdl: crt
551libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
552
553libm:		libc
554libmd:		libc
555libmp:		libc
556libnsl:		libc libmd libmp
557libnvpair:	libc libnsl
558libsocket:	libc libnsl
559
560basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
561basedeps :=	TARGET=install
562
563# The following dependencies are currently required by libdbus-1 and should
564# be used for anything linking against it.
565dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
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 libsff
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
581hal:		dbusdeps
582krb5:		gss_mechs/mech_krb5 libtecla libldap5
583libadt_jni:	libbsm
584libadutils:	libldap5 libresolv2
585libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl
586libbsm:		libinetutil libscf libsecdb libtsol
587libcfgadm:	libdevinfo
588libcmd:		libsum libast
589libcmdutils:	libavl
590libcpc:		libpctx
591libcrypt:	libgen
592libdevid:	libdevinfo
593libdevinfo:	libsec libgen
594libdhcpagent:	libdhcputil libuuid libdlpi libcontract
595libdhcputil:	libgen libinetutil libdlpi
596libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
597$(INTEL_BLD)libdiskmgt: libfdisk
598libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
599		libpool
600libdll: 	libast
601libdlpi:	libinetutil libdladm
602libds:		libsysevent
603libdscfg:	libnsctl libunistat libadm
604libdtrace:	libproc libgen libctf libmapmalloc
605libdtrace_jni:	libuutil libdtrace
606libefi:		libuuid
607libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
608libeti:		libcurses
609libexacct/demo:	libexacct libproject
610libfakekernel:	libumem libcryptoutil
611libfcoe:	libdladm
612libficl:	libuuid libumem
613libfru:		libfruutils
614libfsmgt:	libkstat
615libgrubmgmt:	libdevinfo libzfs libfstyp libefi
616$(INTEL_BLD)libgrubmgmt: libfdisk
617libidmap:	libavl libuutil
618libinetsvc:	libscf
619libinstzones:	libzonecfg libcontract
620libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
621libipmp:	libinetutil
622libipsecutil:	libtecla libtsol
623libiscsit:	libstmf libuuid
624libkmf:		libcryptoutil pkcs11
625libkvm:		../cmd/sgs/libelf
626libldap5:	libsasl
627libmapid:	libresolv2 libscf
628libndmp:	libscf
629libnisdb:	libldap5
630libnwam:	libscf libbsm libdladm libipadm
631libpcp:		libumem libdevinfo
632libpctx:	libproc
633libpkg:		libscf libadm
634libpool:	libscf libexacct
635libpp:		libast
636libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
637$(INTEL_BLD)libproc: libsaveargs
638libproject:	libpool libproc libsecdb
639libprtdiag:	libkstat
640libprtdiag_psr:	libprtdiag
641libraidcfg:	libdevinfo
642librdc:		libnsctl libunistat libdscfg
643librestart:	libuutil libscf libpool libproject libsecdb libsysevent
644libsasl:	libgss pkcs11
645libsaveargs:	libdisasm
646libscf:		libuutil libgen libsmbios
647libsec:		libavl libidmap
648libsff:		libnvpair
649libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
650libshell:	libast libcmd libdll libsecdb
651libsip:		libmd5
652libsldap:	libldap5 libscf
653libsmbfs:	libkrb5 libsec libidmap pkcs11
654libsmbios:	libdevinfo
655libsrpt:	libstmf
656libstmf:	libscf
657libstmfproxy: 	libstmf libpthread
658libsum: 	libast
659libsun_ima:	libdevinfo libsysevent
660libsysevent:	libsecdb
661libtecla:	libcurses
662libtermcap:	libcurses
663libtnfctl:	../cmd/sgs/libelf
664libtsalarm:	libpcp
665libtsnet:	libtsol libsecdb
666libtsol:	libsecdb
667libuuid:	libdlpi
668libv12n:	libds libuuid
669libvolmgt:	libadm
670libvrrpadm:	libdladm libscf
671libvscan:	libscf libsecdb
672libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
673		libumem libtsol libzfs_core libcmdutils
674libzfs_jni:	libdiskmgt libzfs
675libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
676		libuutil libbsm libsecdb
677libzonestat:	libcmdutils libumem
678libzpool:	libavl libumem libcmdutils libsysevent libfakekernel
679madv:		libgen
680mpapi:		libpthread libdevinfo libsysevent
681mpss:		libgen
682nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
683pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
684passwdutil:	libsldap
685pkcs11:		libcryptoutil libgen libuuid
686policykit:	dbusdeps
687print:		libldap5 libmd5 libsendfile
688pylibbe: 	libbe libzfs
689pysolaris:	libsec libidmap
690pyzfs:		libzfs
691raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
692rpcsec_gss:	libgss
693sasl_plugins:	pkcs11 libgss libsasl
694scsi:		libfru libumem libdevid libdevinfo
695smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
696		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
697		libuuid libfakekernel libads libgss libldap5 krb5
698storage:	libdevice libdevinfo libdevid
699sun_fc:		libdevinfo libsysevent
700sun_sas:	libdevinfo libsysevent libkstat libdevid
701udapl:		libdevinfo libdladm
702
703#
704# The reason this rule checks for the existence of the
705# Makefile is that some of the directories do not exist
706# in certain situations (e.g., exportable source builds,
707# OpenSolaris).
708#
709$(SUBDIRS): FRC
710	@if [ -f $@/Makefile  ]; then \
711		cd $@; pwd; $(MAKE) $(TARGET); \
712	else \
713		true; \
714	fi
715
716$(SUBDIRS:%=%-nodepend):
717	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
718		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
719	else \
720		true; \
721	fi
722
723FRC:
724