xref: /illumos-gate/usr/src/lib/Makefile (revision 3e76f9d6851ef6c63217178eb67278ec2809b944)
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# Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
32#
33
34include ../Makefile.master
35
36#	Note that libcurses installs commands along with its library.
37#	This is a minor bug which probably should be fixed.
38#	Note also that a few extra libraries are kept in cmd source.
39#
40# Certain libraries are linked with, hence depend on, other libraries.
41# Library dependencies are called out explicitly, see "Library
42# interdependencies" below.
43.PARALLEL:
44
45# Build libc and its dependencies
46SUBDIRS=			\
47	crt			\
48	../cmd/sgs/libconv	\
49	../cmd/sgs/libdl	\
50	libc			\
51	.WAIT
52
53# Build libraries with lots of dependents
54SUBDIRS +=		\
55	libm		\
56	libmd		\
57	libmp		\
58	libnsl		\
59	libnvpair	\
60	libsocket	\
61	.WAIT
62
63# Build everything else. Aside from explicit dependencies, all libraries
64# are built in parallel.
65SUBDIRS +=				\
66	../cmd/sendmail/libmilter	\
67	../cmd/sgs/libelf	\
68	../cmd/sgs/librtld_db	\
69	abi		\
70	auditd_plugins	\
71	brand		\
72	c_synonyms	\
73	cfgadm_plugins	\
74	crypt_modules	\
75	extendedFILE	\
76	fm		\
77	getloginx	\
78	gss_mechs/mech_dh	\
79	gss_mechs/mech_dummy	\
80	gss_mechs/mech_krb5	\
81	gss_mechs/mech_spnego	\
82	hal		\
83	hbaapi		\
84	krb5		\
85	libadm		\
86	libads		\
87	libadt_jni	\
88	libadutils	\
89	libaio		\
90	libast		\
91	libavl		\
92	libbe		\
93	libbrand	\
94	libbsdmalloc	\
95	libbsm		\
96	libc_db		\
97	libcfgadm	\
98	libcmd		\
99	libcmdutils	\
100	libcommputil	\
101	libcontract	\
102	libcpc		\
103	libcrypt	\
104	libcryptoutil	\
105	libctf		\
106	libcurses	\
107	libdevice	\
108	libdevid	\
109	libdevinfo	\
110	libdhcpagent	\
111	libdhcputil	\
112	libdisasm	\
113	libdiskmgt	\
114	libdladm	\
115	libdll		\
116	libdlpi		\
117	libdns_sd	\
118	libdoor		\
119	libdscfg	\
120	libdtrace	\
121	libdtrace_jni	\
122	libefi		\
123	libelfsign	\
124	libeti		\
125	libexacct	\
126	libexacct/demo	\
127	libfakekernel	\
128	libfcoe		\
129	libficl		\
130	libfru		\
131	libfruutils	\
132	libfsmgt	\
133	libfstyp	\
134	libgen		\
135	libgrubmgmt	\
136	libgss		\
137	libhotplug	\
138	libidmap	\
139	libilb		\
140	libima		\
141	libinetsvc	\
142	libinetutil	\
143	libinstzones	\
144	libintl		\
145	libipadm	\
146	libipd		\
147	libipmi		\
148	libipmp		\
149	libipp		\
150	libipsecutil	\
151	libiscsit	\
152	libkmf		\
153	libkrb5		\
154	libkstat	\
155	libkvm		\
156	libldap5	\
157	liblgrp		\
158	liblm		\
159	libm1		\
160	libmail		\
161	libmalloc	\
162	libmapid	\
163	libmapmalloc	\
164	libmd5		\
165	libmtmalloc	\
166	libmvec		\
167	libndmp		\
168	libnisdb	\
169	libnls		\
170	libnsctl	\
171	libnwam		\
172	libofmt		\
173	libpam		\
174	libpcidb	\
175	libpctx		\
176	libpicl		\
177	libpicltree	\
178	libpkg		\
179	libpool		\
180	libpp		\
181	libproc		\
182	libproject	\
183	libpthread	\
184	libraidcfg	\
185	librcm		\
186	librdc		\
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	libshare	\
203	libshell	\
204	libsip		\
205	libsldap	\
206	libslp		\
207	libsmbfs	\
208	libsmbios	\
209	libsmedia	\
210	libsqlite	\
211	libsrpt		\
212	libstmf		\
213	libstmfproxy	\
214	libsum		\
215	libsun_ima	\
216	libsys		\
217	libsysevent	\
218	libtecla	\
219	libtermcap	\
220	libthread	\
221	libtnf		\
222	libtnfctl	\
223	libtnfprobe	\
224	libtsnet	\
225	libtsol		\
226	libumem		\
227	libunistat	\
228	libuuid		\
229	libuutil	\
230	libvolmgt	\
231	libvrrpadm	\
232	libvscan	\
233	libw		\
234	libwanboot	\
235	libwanbootutil	\
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	libwanboot	\
350	libwanbootutil	\
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	libdevice	\
386	libdevid	\
387	libdevinfo	\
388	libdhcpagent	\
389	libdhcputil	\
390	libdisasm	\
391	libdiskmgt	\
392	libdladm	\
393	libdll		\
394	libdlpi		\
395	libdns_sd	\
396	libdscfg	\
397	libdtrace	\
398	libdtrace_jni	\
399	libelfsign	\
400	libeti		\
401	libfakekernel	\
402	libfcoe		\
403	libfru		\
404	libfstyp	\
405	libgen		\
406	libgrubmgmt	\
407	libidmap	\
408	libilb		\
409	libima		\
410	libinetsvc	\
411	libinetutil	\
412	libinstzones	\
413	libipadm	\
414	libipd		\
415	libipmi		\
416	libipmp		\
417	libipp		\
418	libipsecutil	\
419	libiscsit	\
420	libkrb5		\
421	libkstat	\
422	libkvm		\
423	libmail		\
424	libmapid	\
425	libmd		\
426	libmtmalloc	\
427	libndmp		\
428	libnsctl	\
429	libnsl		\
430	libnvpair	\
431	libnwam		\
432	libofmt		\
433	libpam		\
434	libpcidb	\
435	libpctx		\
436	libpicl		\
437	libpicltree	\
438	libpool		\
439	libpp		\
440	libproc		\
441	libraidcfg	\
442	librcm		\
443	librdc		\
444	libreparse	\
445	librestart	\
446	librpcsvc	\
447	librsm		\
448	librstp		\
449	libsasl		\
450	libscf		\
451	libsec		\
452	libshare	\
453	libshell	\
454	libsip		\
455	libslp		\
456	libsmbfs	\
457	libsmbios	\
458	libsmedia	\
459	libsocket	\
460	libsqlite	\
461	libsrpt		\
462	libstmf		\
463	libstmfproxy	\
464	libsum		\
465	libsun_ima	\
466	libsysevent	\
467	libtecla	\
468	libtermcap	\
469	libtnf		\
470	libtnfctl	\
471	libtnfprobe	\
472	libtsnet	\
473	libtsol		\
474	libumem		\
475	libunistat	\
476	libuutil	\
477	libvolmgt	\
478	libvrrpadm	\
479	libvscan	\
480	libwanboot	\
481	libwanbootutil	\
482	libwrap		\
483	libxcurses2	\
484	libzfs		\
485	libzfs_core	\
486	libzfs_jni	\
487	libzoneinfo	\
488	libzonestat	\
489	mpapi		\
490	passwdutil	\
491	pkcs11		\
492	policykit	\
493	scsi		\
494	smbsrv		\
495	smhba		\
496	udapl		\
497	$($(MACH)_HDRSUBDIRS)
498
499i386_HDRSUBDIRS=	\
500	libfdisk	\
501	libsaveargs
502
503sparc_HDRSUBDIRS=	\
504	libds		\
505	libdscp		\
506	libpri		\
507	libv12n		\
508	storage
509
510all :=		TARGET= all
511check :=	TARGET= check
512clean :=	TARGET= clean
513clobber :=	TARGET= clobber
514install :=	TARGET= install
515install_h :=	TARGET= install_h
516lint :=		TARGET= lint
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, lint, _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,
530# clobber and lint, 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 lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
544
545install_h check:	$(HDRSUBDIRS:%=%-nodepend)
546
547_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
548
549_dc:			$(DCSUBDIRS:%=%-nodepend)
550
551# Library interdependencies are called out explicitly here.
552../cmd/sgs/libconv: crt
553../cmd/sgs/libdl: crt
554libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
555
556libm:		libc
557libmd:		libc
558libmp:		libc
559libnsl:		libc libmd libmp
560libnvpair:	libc libnsl
561libsocket:	libc libnsl
562
563basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
564basedeps :=	TARGET=install
565
566# The following dependencies are currently required by libdbus-1 and should
567# be used for anything linking against it.
568dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
569
570# The following dependencies don't need to be listed below as they are built
571# before everything else:
572# libc libm libmd libmp libnsl libnvpair libsocket
573abi:		libctf libmapmalloc libproc
574auditd_plugins: libbsm libsecdb libgss libmtmalloc
575brand:		libzonecfg libmapmalloc
576cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
577fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
578		libcontract libsysevent ../cmd/sgs/libelf
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
595libdevid:	libdevinfo
596libdevinfo:	libsec libgen
597libdhcpagent:	libdhcputil libuuid libdlpi libcontract
598libdhcputil:	libgen libinetutil libdlpi
599libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
600$(INTEL_BLD)libdiskmgt: libfdisk
601libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
602		libpool
603libdll: 	libast
604libdlpi:	libinetutil libdladm
605libds:		libsysevent
606libdscfg:	libnsctl libunistat libadm
607libdtrace:	libproc libgen libctf libmapmalloc
608libdtrace_jni:	libuutil libdtrace
609libefi:		libuuid
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
626libiscsit:	libstmf libuuid
627libkmf:		libcryptoutil pkcs11
628libkvm:		../cmd/sgs/libelf
629libldap5:	libsasl
630libmapid:	libresolv2 libscf
631libndmp:	libscf
632libnisdb:	libldap5
633libnwam:	libscf libbsm libdladm libipadm
634libpcp:		libumem libdevinfo
635libpctx:	libproc
636libpkg:		libwanboot libscf libadm
637libpool:	libscf libexacct
638libpp:		libast
639libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
640$(INTEL_BLD)libproc: libsaveargs
641libproject:	libpool libproc libsecdb
642libprtdiag:	libkstat
643libprtdiag_psr:	libprtdiag
644libraidcfg:	libdevinfo
645librdc:		libnsctl libunistat libdscfg
646librestart:	libuutil libscf libpool libproject libsecdb libsysevent
647libsasl:	libgss pkcs11
648libsaveargs:	libdisasm
649libscf:		libuutil libgen libsmbios
650libsec:		libavl libidmap
651libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
652libshell:	libast libcmd libdll libsecdb
653libsip:		libmd5
654libsldap:	libldap5 libscf
655libsmbfs:	libkrb5 libsec libidmap pkcs11
656libsmbios:	libdevinfo
657libsrpt:	libstmf
658libstmf:	libscf
659libstmfproxy: 	libstmf libpthread
660libsum: 	libast
661libsun_ima:	libdevinfo libsysevent
662libsysevent:	libsecdb
663libtecla:	libcurses
664libtermcap:	libcurses
665libtnfctl:	../cmd/sgs/libelf
666libtsalarm:	libpcp
667libtsnet:	libtsol libsecdb
668libtsol:	libsecdb
669libuuid:	libdlpi
670libv12n:	libds libuuid
671libvolmgt:	libadm
672libvrrpadm:	libdladm libscf
673libvscan:	libscf libsecdb
674libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
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
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
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