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