xref: /illumos-gate/usr/src/lib/Makefile (revision 25d35568)
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 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	common			\
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	krb5		\
84	libadm		\
85	libads		\
86	libadt_jni	\
87	libadutils	\
88	libaio		\
89	libast		\
90	libavl		\
91	libbe		\
92	libbrand	\
93	libbsdmalloc	\
94	libbsm		\
95	libc_db		\
96	libcfgadm	\
97	libcmd		\
98	libcmdutils	\
99	libcommputil	\
100	libcontract	\
101	libcpc		\
102	libcrypt	\
103	libcryptoutil	\
104	libctf		\
105	libcurses	\
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	libficl		\
129	libfru		\
130	libfruutils	\
131	libfsmgt	\
132	libfstyp	\
133	libgen		\
134	libgrubmgmt	\
135	libgss		\
136	libhotplug	\
137	libidmap	\
138	libilb		\
139	libima		\
140	libinetsvc	\
141	libinetutil	\
142	libinstzones	\
143	libintl		\
144	libipadm	\
145	libipd		\
146	libipmi		\
147	libipmp		\
148	libipp		\
149	libipsecutil	\
150	libiscsit	\
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	libshare	\
201	libshell	\
202	libsip		\
203	libsldap	\
204	libslp		\
205	libsmbfs	\
206	libsmbios	\
207	libsmedia	\
208	libsqlite	\
209	libsrpt		\
210	libstmf		\
211	libstmfproxy	\
212	libsum		\
213	libsun_ima	\
214	libsys		\
215	libsysevent	\
216	libtecla	\
217	libtermcap	\
218	libthread	\
219	libtnf		\
220	libtnfctl	\
221	libtnfprobe	\
222	libtsnet	\
223	libtsol		\
224	libumem		\
225	libunistat	\
226	libuuid		\
227	libuutil	\
228	libvolmgt	\
229	libvrrpadm	\
230	libvscan	\
231	libw		\
232	libwanboot	\
233	libwanbootutil	\
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	libinetutil	\
320	libinstzones	\
321	libipadm	\
322	libipmp		\
323	libipsecutil	\
324	libldap5	\
325	libnsl		\
326	libnwam		\
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	libwanboot	\
348	libwanbootutil	\
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	libpam		\
431	libpcidb	\
432	libpctx		\
433	libpicl		\
434	libpicltree	\
435	libpool		\
436	libpp		\
437	libproc		\
438	libraidcfg	\
439	librcm		\
440	librdc		\
441	libreparse	\
442	librestart	\
443	librpcsvc	\
444	librsm		\
445	librstp		\
446	libsasl		\
447	libscf		\
448	libsec		\
449	libshare	\
450	libshell	\
451	libsip		\
452	libslp		\
453	libsmbfs	\
454	libsmbios	\
455	libsmedia	\
456	libsocket	\
457	libsqlite	\
458	libsrpt		\
459	libstmf		\
460	libstmfproxy	\
461	libsum		\
462	libsun_ima	\
463	libsysevent	\
464	libtecla	\
465	libtermcap	\
466	libtnf		\
467	libtnfctl	\
468	libtnfprobe	\
469	libtsnet	\
470	libtsol		\
471	libumem		\
472	libunistat	\
473	libuutil	\
474	libvolmgt	\
475	libvrrpadm	\
476	libvscan	\
477	libwanboot	\
478	libwanbootutil	\
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: common
550../cmd/sgs/libdl: common
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
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
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
631libpcp:		libumem libdevinfo
632libpctx:	libproc
633libpkg:		libwanboot 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
648libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
649libshell:	libast libcmd libdll libsecdb
650libsip:		libmd5
651libsldap:	libldap5 libscf
652libsmbfs:	libkrb5 libsec libidmap pkcs11
653libsmbios:	libdevinfo
654libsrpt:	libstmf
655libstmf:	libscf
656libstmfproxy: 	libstmf libpthread
657libsum: 	libast
658libsun_ima:	libdevinfo libsysevent
659libsysevent:	libsecdb
660libtecla:	libcurses
661libtermcap:	libcurses
662libtnfctl:	../cmd/sgs/libelf
663libtsalarm:	libpcp
664libtsnet:	libtsol libsecdb
665libtsol:	libsecdb
666libuuid:	libdlpi
667libv12n:	libds libuuid
668libvolmgt:	libadm
669libvrrpadm:	libdladm libscf
670libvscan:	libscf libsecdb
671libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
672libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
673		libumem libtsol libzfs_core
674libzfs_jni:	libdiskmgt libzfs
675libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
676		libuutil libbsm libsecdb
677libzonestat:	libcmdutils libumem
678libzpool:	libavl libumem libcmdutils libsysevent
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