xref: /illumos-gate/usr/src/lib/Makefile (revision 52675910)
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	libcustr	\
109	libdevice	\
110	libdevid	\
111	libdevinfo	\
112	libdhcpagent	\
113	libdhcputil	\
114	libdisasm	\
115	libdiskmgt	\
116	libdladm	\
117	libdll		\
118	libdlpi		\
119	libdns_sd	\
120	libdoor		\
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	libmlrpc	\
167	libmtmalloc	\
168	libmvec		\
169	libndmp		\
170	libnisdb	\
171	libnls		\
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	libreparse	\
188	libresolv	\
189	libresolv2	\
190	librestart	\
191	librpcsvc	\
192	librsm		\
193	librstp		\
194	librt		\
195	libsasl		\
196	libscf		\
197	libsched	\
198	libsctp		\
199	libsec		\
200	libsecdb	\
201	libsendfile	\
202	libsff		\
203	libshare	\
204	libshell	\
205	libsip		\
206	libsldap	\
207	libslp		\
208	libsmbfs	\
209	libsmbios	\
210	libsmedia	\
211	libsqlite	\
212	libsrpt		\
213	libstmf		\
214	libstmfproxy	\
215	libsum		\
216	libsun_ima	\
217	libsys		\
218	libsysevent	\
219	libtecla	\
220	libtermcap	\
221	libthread	\
222	libtnf		\
223	libtnfctl	\
224	libtnfprobe	\
225	libtsnet	\
226	libtsol		\
227	libumem		\
228	libuuid		\
229	libuutil	\
230	libvolmgt	\
231	libvrrpadm	\
232	libvscan	\
233	libw		\
234	libwrap		\
235	libxcurses	\
236	libxcurses2	\
237	libxnet		\
238	libzfs		\
239	libzfs_core	\
240	libzfs_jni	\
241	libzonecfg	\
242	libzoneinfo	\
243	libzonestat	\
244	libzpool	\
245	madv		\
246	mpapi		\
247	mpss		\
248	nametoaddr	\
249	ncad_addr	\
250	nsswitch	\
251	pam_modules	\
252	passwdutil	\
253	pkcs11		\
254	policykit	\
255	print		\
256	pylibbe		\
257	pysolaris	\
258	pyzfs		\
259	raidcfg_plugins	\
260	rpcsec_gss	\
261	sasl_plugins	\
262	scsi		\
263	smbsrv		\
264	smhba		\
265	sun_fc		\
266	sun_sas		\
267	udapl		\
268	watchmalloc	\
269	$($(MACH)_SUBDIRS)
270
271i386_SUBDIRS=		\
272	libfdisk	\
273	libsaveargs
274
275sparc_SUBDIRS=		\
276	efcode		\
277	libds		\
278	libdscp		\
279	libprtdiag	\
280	libprtdiag_psr	\
281	libpri		\
282	librsc		\
283	storage		\
284	libpcp		\
285	libtsalarm	\
286	libv12n
287
288#
289# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
290# clean and clobber targets (for more information, see those targets, below).
291#
292NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
293
294DCSUBDIRS=
295
296MSGSUBDIRS=		\
297	abi		\
298	auditd_plugins	\
299	brand		\
300	cfgadm_plugins	\
301	gss_mechs/mech_dh	\
302	gss_mechs/mech_krb5	\
303	krb5		\
304	libast		\
305	libbsm		\
306	libc		\
307	libcfgadm	\
308	libcmd		\
309	libcontract	\
310	libcurses	\
311	libdhcputil	\
312	libdiskmgt	\
313	libdladm	\
314	libdll		\
315	libgrubmgmt	\
316	libgss		\
317	libidmap	\
318	libilb		\
319	libinstzones	\
320	libipadm	\
321	libipmp		\
322	libipsecutil	\
323	libldap5	\
324	libnsl		\
325	libnwam		\
326	libofmt		\
327	libpam		\
328	libpicl		\
329	libpkg		\
330	libpool		\
331	libpp		\
332	libreparse	\
333	libsasl		\
334	libscf		\
335	libsecdb	\
336	libshare	\
337	libshell	\
338	libsldap	\
339	libslp		\
340	libsmbfs	\
341	libsmedia	\
342	libsum		\
343	libtsol		\
344	libuutil	\
345	libvrrpadm	\
346	libvscan	\
347	libzfs		\
348	libzonecfg	\
349	madv		\
350	mpss		\
351	pam_modules	\
352	pyzfs		\
353	rpcsec_gss	\
354	$($(MACH)_MSGSUBDIRS)
355
356sparc_MSGSUBDIRS=	\
357	libprtdiag	\
358	libprtdiag_psr
359
360i386_MSGSUBDIRS= libfdisk
361
362HDRSUBDIRS=				\
363	../cmd/sendmail/libmilter	\
364	auditd_plugins	\
365	fm		\
366	hal		\
367	hbaapi		\
368	libads		\
369	libast		\
370	libbrand	\
371	libbsm		\
372	libc		\
373	libcmd		\
374	libcmdutils	\
375	libcommputil	\
376	libcontract	\
377	libcpc		\
378	libcryptoutil	\
379	libctf		\
380	libcurses	\
381	libcustr	\
382	libdevice	\
383	libdevid	\
384	libdevinfo	\
385	libdhcpagent	\
386	libdhcputil	\
387	libdisasm	\
388	libdiskmgt	\
389	libdladm	\
390	libdll		\
391	libdlpi		\
392	libdns_sd	\
393	libdtrace	\
394	libdtrace_jni	\
395	libelfsign	\
396	libeti		\
397	libfakekernel	\
398	libfcoe		\
399	libfru		\
400	libfstyp	\
401	libgen		\
402	libgrubmgmt	\
403	libidmap	\
404	libilb		\
405	libima		\
406	libinetsvc	\
407	libinetutil	\
408	libinstzones	\
409	libipadm	\
410	libipd		\
411	libipmi		\
412	libipmp		\
413	libipp		\
414	libipsecutil	\
415	libiscsit	\
416	libkrb5		\
417	libkstat	\
418	libkvm		\
419	libmail		\
420	libmapid	\
421	libmd		\
422	libmlrpc	\
423	libmtmalloc	\
424	libndmp		\
425	libnsl		\
426	libnvpair	\
427	libnwam		\
428	libofmt		\
429	libpam		\
430	libpcidb	\
431	libpctx		\
432	libpicl		\
433	libpicltree	\
434	libpool		\
435	libpp		\
436	libproc		\
437	libraidcfg	\
438	librcm		\
439	libreparse	\
440	librestart	\
441	librpcsvc	\
442	librsm		\
443	librstp		\
444	libsasl		\
445	libscf		\
446	libsec		\
447	libsff		\
448	libshare	\
449	libshell	\
450	libsip		\
451	libslp		\
452	libsmbfs	\
453	libsmbios	\
454	libsmedia	\
455	libsocket	\
456	libsqlite	\
457	libsrpt		\
458	libstmf		\
459	libstmfproxy	\
460	libsum		\
461	libsun_ima	\
462	libsysevent	\
463	libtecla	\
464	libtermcap	\
465	libtnf		\
466	libtnfctl	\
467	libtnfprobe	\
468	libtsnet	\
469	libtsol		\
470	libumem		\
471	libuutil	\
472	libvolmgt	\
473	libvrrpadm	\
474	libvscan	\
475	libwrap		\
476	libxcurses2	\
477	libzfs		\
478	libzfs_core	\
479	libzfs_jni	\
480	libzoneinfo	\
481	libzonestat	\
482	mpapi		\
483	passwdutil	\
484	pkcs11		\
485	policykit	\
486	scsi		\
487	smbsrv		\
488	smhba		\
489	udapl		\
490	$($(MACH)_HDRSUBDIRS)
491
492i386_HDRSUBDIRS=	\
493	libfdisk	\
494	libsaveargs
495
496sparc_HDRSUBDIRS=	\
497	libds		\
498	libdscp		\
499	libpri		\
500	libv12n		\
501	storage
502
503all :=		TARGET= all
504check :=	TARGET= check
505clean :=	TARGET= clean
506clobber :=	TARGET= clobber
507install :=	TARGET= install
508install_h :=	TARGET= install_h
509lint :=		TARGET= lint
510_dc :=		TARGET= _dc
511_msg :=		TARGET= _msg
512
513.KEEP_STATE:
514
515#
516# For the all and install targets, we clearly must respect library
517# dependencies so that the libraries link correctly.  However, for
518# the remaining targets (check, clean, clobber, install_h, lint, _dc
519# and _msg), libraries do not have any dependencies on one another
520# and thus respecting dependencies just slows down the build.
521# As such, for these rules, we use pattern replacement to explicitly
522# avoid triggering the dependency information.  Note that for clean,
523# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
524# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
525#
526
527all:			$(SUBDIRS)
528
529install:		$(SUBDIRS) .WAIT install_extra
530
531# extra libraries kept in other source areas
532install_extra:
533	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
534	@pwd
535
536clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
537
538install_h check:	$(HDRSUBDIRS:%=%-nodepend)
539
540_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
541
542_dc:			$(DCSUBDIRS:%=%-nodepend)
543
544# Library interdependencies are called out explicitly here.
545../cmd/sgs/libconv: crt
546../cmd/sgs/libdl: crt
547libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
548
549libm:		libc
550libmd:		libc
551libmp:		libc
552libnsl:		libc libmd libmp
553libnvpair:	libc libnsl
554libsocket:	libc libnsl
555
556basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
557basedeps :=	TARGET=install
558
559# The following dependencies are currently required by libdbus-1 and should
560# be used for anything linking against it.
561dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
562
563# The following dependencies don't need to be listed below as they are built
564# before everything else:
565# libc libm libmd libmp libnsl libnvpair libsocket
566abi:		libctf libmapmalloc libproc
567auditd_plugins: libbsm libsecdb libgss libmtmalloc
568brand:		libzonecfg libmapmalloc
569cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
570fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
571		libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
572		libpcidb
573$(SPARC_BLD)fm:	libpri
574gss_mechs/mech_dh: libgss
575gss_mechs/mech_dummy: libgss
576gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
577gss_mechs/mech_spnego: gss_mechs/mech_krb5
578hal:		dbusdeps
579krb5:		gss_mechs/mech_krb5 libtecla libldap5
580libadt_jni:	libbsm
581libadutils:	libldap5 libresolv2
582libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl
583libbsm:		libinetutil libscf libsecdb libtsol
584libcfgadm:	libdevinfo
585libcmd:		libsum libast
586libcmdutils:	libavl
587libcpc:		libpctx
588libcrypt:	libgen
589libdevid:	libdevinfo
590libdevinfo:	libsec libgen
591libdhcpagent:	libdhcputil libuuid libdlpi libcontract
592libdhcputil:	libgen libinetutil libdlpi
593libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
594$(INTEL_BLD)libdiskmgt: libfdisk
595libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
596		libpool
597libdll:		libast
598libdlpi:	libinetutil libdladm
599libds:		libsysevent
600libdtrace:	libproc libgen libctf libmapmalloc
601libdtrace_jni:	libuutil libdtrace
602libefi:		libuuid libsmbios
603libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
604libeti:		libcurses
605libexacct/demo:	libexacct libproject
606libfakekernel:	libumem libcryptoutil
607libfcoe:	libdladm
608libficl:	libuuid libumem
609libfru:		libfruutils
610libfsmgt:	libkstat
611libgrubmgmt:	libdevinfo libzfs libfstyp libefi
612$(INTEL_BLD)libgrubmgmt: libfdisk
613libidmap:	libavl libuutil
614libinetsvc:	libscf
615libinstzones:	libzonecfg libcontract
616libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
617libipmp:	libinetutil
618libipsecutil:	libtecla libtsol libkmf
619libiscsit:	libstmf libuuid
620libkmf:		libcryptoutil pkcs11 libcustr
621libkvm:		../cmd/sgs/libelf
622libldap5:	libsasl
623libmapid:	libresolv2 libscf
624libmlrpc:	libsmbfs libuuid
625libndmp:	libscf
626libnisdb:	libldap5
627libnwam:	libscf libbsm libdladm libipadm
628libpcp:		libumem libdevinfo
629libpctx:	libproc
630libpkg:		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
639librestart:	libuutil libscf libpool libproject libsecdb libsysevent
640libsasl:	libgss pkcs11
641libsaveargs:	libdisasm
642libscf:		libuutil libgen libsmbios
643libsec:		libavl libidmap
644libsff:		libnvpair
645libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
646libshell:	libast libcmd libdll libsecdb
647libsip:		libmd5
648libsldap:	libldap5 libscf
649libsmbfs:	libkrb5 libsec libidmap pkcs11
650libsmbios:	libdevinfo
651libsrpt:	libstmf
652libstmf:	libscf
653libstmfproxy:	libstmf libpthread
654libsum:		libast
655libsun_ima:	libdevinfo libsysevent
656libsysevent:	libsecdb
657libtecla:	libcurses
658libtermcap:	libcurses
659libtnfctl:	../cmd/sgs/libelf
660libtsalarm:	libpcp
661libtsnet:	libtsol libsecdb
662libtsol:	libsecdb
663libuuid:	libdlpi
664libv12n:	libds libuuid
665libvolmgt:	libadm
666libvrrpadm:	libdladm libscf
667libvscan:	libscf libsecdb
668libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
669		libumem libtsol libzfs_core
670libzfs_jni:	libdiskmgt libzfs
671libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
672		libuutil libbsm libsecdb
673libzonestat:	libcmdutils libumem
674libzpool:	libavl libumem libcmdutils libsysevent libfakekernel
675madv:		libgen
676mpapi:		libpthread libdevinfo libsysevent
677mpss:		libgen
678nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
679pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
680passwdutil:	libsldap
681pkcs11:		libcryptoutil libgen libuuid
682policykit:	dbusdeps
683print:		libldap5 libmd5 libsendfile
684pylibbe:	libbe libzfs
685pysolaris:	libsec libidmap
686pyzfs:		libzfs
687raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
688rpcsec_gss:	libgss
689sasl_plugins:	pkcs11 libgss libsasl
690scsi:		libfru libumem libdevid libdevinfo
691smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
692		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
693		libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
694storage:	libdevice libdevinfo libdevid
695sun_fc:		libdevinfo libsysevent
696sun_sas:	libdevinfo libsysevent libkstat libdevid
697udapl:		libdevinfo libdladm
698
699#
700# The reason this rule checks for the existence of the
701# Makefile is that some of the directories do not exist
702# in certain situations (e.g., exportable source builds,
703# OpenSolaris).
704#
705$(SUBDIRS): FRC
706	@if [ -f $@/Makefile  ]; then \
707		cd $@; pwd; $(MAKE) $(TARGET); \
708	else \
709		true; \
710	fi
711
712$(SUBDIRS:%=%-nodepend):
713	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
714		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
715	else \
716		true; \
717	fi
718
719FRC:
720