xref: /illumos-gate/usr/src/lib/Makefile (revision 4ba5b9616327ef64e8abc737d29b3faabc6ae68c)
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 2015 Nexenta Systems, Inc.  All rights reserved.
30# Copyright 2016 Toomas Soome <tsoome@me.com>
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	lvm		\
246	madv		\
247	mpapi		\
248	mpss		\
249	nametoaddr	\
250	ncad_addr	\
251	nsswitch	\
252	pam_modules	\
253	passwdutil	\
254	pkcs11		\
255	policykit	\
256	print		\
257	pylibbe		\
258	pysolaris	\
259	pyzfs		\
260	raidcfg_plugins	\
261	rpcsec_gss	\
262	sasl_plugins	\
263	scsi		\
264	smbsrv		\
265	smhba		\
266	sun_fc		\
267	sun_sas		\
268	udapl		\
269	watchmalloc	\
270	$($(MACH)_SUBDIRS)
271
272i386_SUBDIRS=		\
273	libfdisk	\
274	libsaveargs
275
276sparc_SUBDIRS=		\
277	efcode		\
278	libds		\
279	libdscp		\
280	libprtdiag	\
281	libprtdiag_psr	\
282	libpri		\
283	librsc		\
284	storage		\
285	libpcp		\
286	libtsalarm	\
287	libv12n
288
289#
290# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
291# clean and clobber targets (for more information, see those targets, below).
292#
293NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
294
295DCSUBDIRS =		\
296	lvm
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	libinetutil	\
322	libinstzones	\
323	libipadm	\
324	libipmp		\
325	libipsecutil	\
326	libldap5	\
327	libnsl		\
328	libnwam		\
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	lvm		\
354	madv		\
355	mpss		\
356	pam_modules	\
357	pyzfs		\
358	rpcsec_gss	\
359	$($(MACH)_MSGSUBDIRS)
360
361sparc_MSGSUBDIRS=	\
362	libprtdiag	\
363	libprtdiag_psr
364
365i386_MSGSUBDIRS= libfdisk
366
367HDRSUBDIRS=				\
368	../cmd/sendmail/libmilter	\
369	auditd_plugins	\
370	fm		\
371	hal		\
372	hbaapi		\
373	libads		\
374	libast		\
375	libbrand	\
376	libbsm		\
377	libc		\
378	libcmd		\
379	libcmdutils	\
380	libcommputil	\
381	libcontract	\
382	libcpc		\
383	libcryptoutil	\
384	libctf		\
385	libcurses	\
386	libdevice	\
387	libdevid	\
388	libdevinfo	\
389	libdhcpagent	\
390	libdhcputil	\
391	libdisasm	\
392	libdiskmgt	\
393	libdladm	\
394	libdll		\
395	libdlpi		\
396	libdns_sd	\
397	libdscfg	\
398	libdtrace	\
399	libdtrace_jni	\
400	libelfsign	\
401	libeti		\
402	libfakekernel	\
403	libfcoe		\
404	libfru		\
405	libfstyp	\
406	libgen		\
407	libgrubmgmt	\
408	libidmap	\
409	libilb		\
410	libima		\
411	libinetsvc	\
412	libinetutil	\
413	libinstzones	\
414	libipadm	\
415	libipd		\
416	libipmi		\
417	libipmp		\
418	libipp		\
419	libipsecutil	\
420	libiscsit	\
421	libkrb5		\
422	libkstat	\
423	libkvm		\
424	libmail		\
425	libmapid	\
426	libmd		\
427	libmtmalloc	\
428	libndmp		\
429	libnsctl	\
430	libnsl		\
431	libnvpair	\
432	libnwam		\
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	lvm		\
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
517lint :=		TARGET= lint
518_dc :=		TARGET= _dc
519_msg :=		TARGET= _msg
520
521.KEEP_STATE:
522
523#
524# For the all and install targets, we clearly must respect library
525# dependencies so that the libraries link correctly.  However, for
526# the remaining targets (check, clean, clobber, install_h, lint, _dc
527# and _msg), libraries do not have any dependencies on one another
528# and thus respecting dependencies just slows down the build.
529# As such, for these rules, we use pattern replacement to explicitly
530# avoid triggering the dependency information.  Note that for clean,
531# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
532# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
533#
534
535all:			$(SUBDIRS)
536
537install:		$(SUBDIRS) .WAIT install_extra
538
539# extra libraries kept in other source areas
540install_extra:
541	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
542	@pwd
543
544clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
545
546install_h check:	$(HDRSUBDIRS:%=%-nodepend)
547
548_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
549
550_dc:			$(DCSUBDIRS:%=%-nodepend)
551
552# Library interdependencies are called out explicitly here.
553../cmd/sgs/libconv: common
554../cmd/sgs/libdl: common
555libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
556
557libm:		libc
558libmd:		libc
559libmp:		libc
560libnsl:		libc libmd libmp
561libnvpair:	libc libnsl
562libsocket:	libc libnsl
563
564basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
565basedeps :=	TARGET=install
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
581krb5:		gss_mechs/mech_krb5 libtecla libldap5
582libadt_jni:	libbsm
583libadutils:	libldap5 libresolv2
584libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl
585libbsm:		libinetutil libscf libsecdb libtsol
586libcfgadm:	libdevinfo
587libcmd:		libsum libast
588libcmdutils:	libavl
589libcpc:		libpctx
590libcrypt:	libgen
591libdevid:	libdevinfo
592libdevinfo:	libsec libgen
593libdhcpagent:	libdhcputil libuuid libdlpi libcontract
594libdhcputil:	libgen libinetutil libdlpi
595libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
596$(INTEL_BLD)libdiskmgt: libfdisk
597libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
598		libpool
599libdll: 	libast
600libdlpi:	libinetutil libdladm
601libds:		libsysevent
602libdscfg:	libnsctl libunistat libadm
603libdtrace:	libproc libgen libctf libmapmalloc
604libdtrace_jni:	libuutil libdtrace
605libefi:		libuuid
606libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
607libeti:		libcurses
608libexacct/demo:	libexacct libproject
609libfakekernel:	libumem libcryptoutil
610libfcoe:	libdladm
611libficl:	libumem
612libfru:		libfruutils
613libfsmgt:	libkstat
614libgrubmgmt:	libdevinfo libzfs libfstyp libefi
615$(INTEL_BLD)libgrubmgmt: libfdisk
616libidmap:	libavl libuutil
617libinetsvc:	libscf
618libinstzones:	libzonecfg libcontract
619libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb
620libipmp:	libinetutil
621libipsecutil:	libtecla libtsol
622libiscsit:	libstmf libuuid
623libkmf:		libcryptoutil pkcs11
624libkvm:		../cmd/sgs/libelf
625libldap5:	libsasl
626libmapid:	libresolv2 libscf
627libndmp:	libscf
628libnisdb:	libldap5
629libnwam:	libscf libbsm libdladm
630libpcp:		libumem libdevinfo
631libpctx:	libproc
632libpkg:		libwanboot libscf libadm
633libpool:	libscf libexacct
634libpp:		libast
635libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
636$(INTEL_BLD)libproc: libsaveargs
637libproject:	libpool libproc libsecdb
638libprtdiag:	libkstat
639libprtdiag_psr:	libprtdiag
640libraidcfg:	libdevinfo
641librdc:		libnsctl libunistat libdscfg
642librestart:	libuutil libscf libpool libproject libsecdb libsysevent
643libsasl:	libgss pkcs11
644libsaveargs:	libdisasm
645libscf:		libuutil libgen libsmbios
646libsec:		libavl libidmap
647libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
648libshell:	libast libcmd libdll libsecdb
649libsip:		libmd5
650libsldap:	libldap5 libscf
651libsmbfs:	libkrb5 libsec libidmap pkcs11
652libsrpt:	libstmf
653libstmf:	libscf
654libstmfproxy: 	libstmf libpthread
655libsum: 	libast
656libsun_ima:	libdevinfo libsysevent
657libsysevent:	libsecdb
658libtecla:	libcurses
659libtermcap:	libcurses
660libtnfctl:	../cmd/sgs/libelf
661libtsalarm:	libpcp
662libtsnet:	libtsol libsecdb
663libtsol:	libsecdb
664libuuid:	libdlpi
665libv12n:	libds libuuid
666libvolmgt:	libadm
667libvrrpadm:	libdladm libscf
668libvscan:	libscf libsecdb
669libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
670libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
671		libumem libtsol libzfs_core
672libzfs_jni:	libdiskmgt libzfs
673libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
674		libuutil libbsm libsecdb
675libzonestat:	libcmdutils libumem
676libzpool:	libavl libumem libcmdutils libsysevent
677lvm:		libadm libdevid libdevinfo libefi libgen libscf
678madv:		libgen
679mpapi:		libpthread libdevinfo libsysevent
680mpss:		libgen
681nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
682pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
683passwdutil:	libsldap
684pkcs11:		libcryptoutil libgen libuuid
685policykit:	libsecdb
686print:		libldap5 libmd5 libsendfile
687pylibbe: 	libbe libzfs
688pysolaris:	libsec libidmap
689pyzfs:		libzfs
690raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
691rpcsec_gss:	libgss
692sasl_plugins:	pkcs11 libgss libsasl
693scsi:		libfru libumem libdevid libdevinfo
694smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
695		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
696		libuuid libfakekernel libads libgss libldap5 krb5
697storage:	libdevice libdevinfo libdevid
698sun_fc:		libdevinfo libsysevent
699sun_sas:	libdevinfo libsysevent libkstat libdevid
700udapl:		libdevinfo libdladm
701
702#
703# The reason this rule checks for the existence of the
704# Makefile is that some of the directories do not exist
705# in certain situations (e.g., exportable source builds,
706# OpenSolaris).
707#
708$(SUBDIRS): FRC
709	@if [ -f $@/Makefile  ]; then \
710		cd $@; pwd; $(MAKE) $(TARGET); \
711	else \
712		true; \
713	fi
714
715$(SUBDIRS:%=%-nodepend):
716	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
717		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
718	else \
719		true; \
720	fi
721
722FRC:
723