xref: /illumos-gate/usr/src/lib/Makefile (revision 5cabbc6b49070407fb9610cfe73d4c0e0dea3e77)
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	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	libunistat	\
229	libuuid		\
230	libuutil	\
231	libvolmgt	\
232	libvrrpadm	\
233	libvscan	\
234	libw		\
235	libwanboot	\
236	libwanbootutil	\
237	libwrap		\
238	libxcurses	\
239	libxcurses2	\
240	libxnet		\
241	libzfs		\
242	libzfs_core	\
243	libzfs_jni	\
244	libzonecfg	\
245	libzoneinfo	\
246	libzonestat	\
247	libzpool	\
248	madv		\
249	mpapi		\
250	mpss		\
251	nametoaddr	\
252	ncad_addr	\
253	nsswitch	\
254	pam_modules	\
255	passwdutil	\
256	pkcs11		\
257	policykit	\
258	print		\
259	pylibbe		\
260	pysolaris	\
261	pyzfs		\
262	raidcfg_plugins	\
263	rpcsec_gss	\
264	sasl_plugins	\
265	scsi		\
266	smbsrv		\
267	smhba		\
268	sun_fc		\
269	sun_sas		\
270	udapl		\
271	watchmalloc	\
272	$($(MACH)_SUBDIRS)
273
274i386_SUBDIRS=		\
275	libfdisk	\
276	libsaveargs
277
278sparc_SUBDIRS=		\
279	efcode		\
280	libds		\
281	libdscp		\
282	libprtdiag	\
283	libprtdiag_psr	\
284	libpri		\
285	librsc		\
286	storage		\
287	libpcp		\
288	libtsalarm	\
289	libv12n
290
291#
292# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
293# clean and clobber targets (for more information, see those targets, below).
294#
295NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
296
297DCSUBDIRS=
298
299MSGSUBDIRS=		\
300	abi		\
301	auditd_plugins	\
302	brand		\
303	cfgadm_plugins	\
304	gss_mechs/mech_dh	\
305	gss_mechs/mech_krb5	\
306	krb5		\
307	libast		\
308	libbsm		\
309	libc		\
310	libcfgadm	\
311	libcmd		\
312	libcontract	\
313	libcurses	\
314	libdhcputil	\
315	libdiskmgt	\
316	libdladm	\
317	libdll		\
318	libgrubmgmt	\
319	libgss		\
320	libidmap	\
321	libilb		\
322	libinstzones	\
323	libipadm	\
324	libipmp		\
325	libipsecutil	\
326	libldap5	\
327	libnsl		\
328	libnwam		\
329	libofmt		\
330	libpam		\
331	libpicl		\
332	libpkg		\
333	libpool		\
334	libpp		\
335	libreparse	\
336	libsasl		\
337	libscf		\
338	libsecdb	\
339	libshare	\
340	libshell	\
341	libsldap	\
342	libslp		\
343	libsmbfs	\
344	libsmedia	\
345	libsum		\
346	libtsol		\
347	libuutil	\
348	libvrrpadm	\
349	libvscan	\
350	libwanboot	\
351	libwanbootutil	\
352	libzfs		\
353	libzonecfg	\
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	libofmt		\
434	libpam		\
435	libpcidb	\
436	libpctx		\
437	libpicl		\
438	libpicltree	\
439	libpool		\
440	libpp		\
441	libproc		\
442	libraidcfg	\
443	librcm		\
444	librdc		\
445	libreparse	\
446	librestart	\
447	librpcsvc	\
448	librsm		\
449	librstp		\
450	libsasl		\
451	libscf		\
452	libsec		\
453	libsff		\
454	libshare	\
455	libshell	\
456	libsip		\
457	libslp		\
458	libsmbfs	\
459	libsmbios	\
460	libsmedia	\
461	libsocket	\
462	libsqlite	\
463	libsrpt		\
464	libstmf		\
465	libstmfproxy	\
466	libsum		\
467	libsun_ima	\
468	libsysevent	\
469	libtecla	\
470	libtermcap	\
471	libtnf		\
472	libtnfctl	\
473	libtnfprobe	\
474	libtsnet	\
475	libtsol		\
476	libumem		\
477	libunistat	\
478	libuutil	\
479	libvolmgt	\
480	libvrrpadm	\
481	libvscan	\
482	libwanboot	\
483	libwanbootutil	\
484	libwrap		\
485	libxcurses2	\
486	libzfs		\
487	libzfs_core	\
488	libzfs_jni	\
489	libzoneinfo	\
490	libzonestat	\
491	mpapi		\
492	passwdutil	\
493	pkcs11		\
494	policykit	\
495	scsi		\
496	smbsrv		\
497	smhba		\
498	udapl		\
499	$($(MACH)_HDRSUBDIRS)
500
501i386_HDRSUBDIRS=	\
502	libfdisk	\
503	libsaveargs
504
505sparc_HDRSUBDIRS=	\
506	libds		\
507	libdscp		\
508	libpri		\
509	libv12n		\
510	storage
511
512all :=		TARGET= all
513check :=	TARGET= check
514clean :=	TARGET= clean
515clobber :=	TARGET= clobber
516install :=	TARGET= install
517install_h :=	TARGET= install_h
518lint :=		TARGET= lint
519_dc :=		TARGET= _dc
520_msg :=		TARGET= _msg
521
522.KEEP_STATE:
523
524#
525# For the all and install targets, we clearly must respect library
526# dependencies so that the libraries link correctly.  However, for
527# the remaining targets (check, clean, clobber, install_h, lint, _dc
528# and _msg), libraries do not have any dependencies on one another
529# and thus respecting dependencies just slows down the build.
530# As such, for these rules, we use pattern replacement to explicitly
531# avoid triggering the dependency information.  Note that for clean,
532# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
533# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
534#
535
536all:			$(SUBDIRS)
537
538install:		$(SUBDIRS) .WAIT install_extra
539
540# extra libraries kept in other source areas
541install_extra:
542	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
543	@pwd
544
545clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
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
575abi:		libctf libmapmalloc libproc
576auditd_plugins: libbsm libsecdb libgss libmtmalloc
577brand:		libzonecfg libmapmalloc
578cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
579fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
580		libcontract libsysevent ../cmd/sgs/libelf libdladm
581$(SPARC_BLD)fm:	libpri
582gss_mechs/mech_dh: libgss
583gss_mechs/mech_dummy: libgss
584gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
585gss_mechs/mech_spnego: gss_mechs/mech_krb5
586hal:		dbusdeps
587krb5:		gss_mechs/mech_krb5 libtecla libldap5
588libadt_jni:	libbsm
589libadutils:	libldap5 libresolv2
590libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl
591libbsm:		libinetutil libscf libsecdb libtsol
592libcfgadm:	libdevinfo
593libcmd:		libsum libast
594libcmdutils:	libavl
595libcpc:		libpctx
596libcrypt:	libgen
597libdevid:	libdevinfo
598libdevinfo:	libsec libgen
599libdhcpagent:	libdhcputil libuuid libdlpi libcontract
600libdhcputil:	libgen libinetutil libdlpi
601libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
602$(INTEL_BLD)libdiskmgt: libfdisk
603libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
604		libpool
605libdll: 	libast
606libdlpi:	libinetutil libdladm
607libds:		libsysevent
608libdscfg:	libnsctl libunistat libadm
609libdtrace:	libproc libgen libctf libmapmalloc
610libdtrace_jni:	libuutil libdtrace
611libefi:		libuuid
612libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
613libeti:		libcurses
614libexacct/demo:	libexacct libproject
615libfakekernel:	libumem libcryptoutil
616libfcoe:	libdladm
617libficl:	libuuid libumem
618libfru:		libfruutils
619libfsmgt:	libkstat
620libgrubmgmt:	libdevinfo libzfs libfstyp libefi
621$(INTEL_BLD)libgrubmgmt: libfdisk
622libidmap:	libavl libuutil
623libinetsvc:	libscf
624libinstzones:	libzonecfg libcontract
625libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
626libipmp:	libinetutil
627libipsecutil:	libtecla libtsol
628libiscsit:	libstmf libuuid
629libkmf:		libcryptoutil pkcs11
630libkvm:		../cmd/sgs/libelf
631libldap5:	libsasl
632libmapid:	libresolv2 libscf
633libndmp:	libscf
634libnisdb:	libldap5
635libnwam:	libscf libbsm libdladm libipadm
636libpcp:		libumem libdevinfo
637libpctx:	libproc
638libpkg:		libwanboot libscf libadm
639libpool:	libscf libexacct
640libpp:		libast
641libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
642$(INTEL_BLD)libproc: libsaveargs
643libproject:	libpool libproc libsecdb
644libprtdiag:	libkstat
645libprtdiag_psr:	libprtdiag
646libraidcfg:	libdevinfo
647librdc:		libnsctl libunistat libdscfg
648librestart:	libuutil libscf libpool libproject libsecdb libsysevent
649libsasl:	libgss pkcs11
650libsaveargs:	libdisasm
651libscf:		libuutil libgen libsmbios
652libsec:		libavl libidmap
653libsff:		libnvpair
654libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
655libshell:	libast libcmd libdll libsecdb
656libsip:		libmd5
657libsldap:	libldap5 libscf
658libsmbfs:	libkrb5 libsec libidmap pkcs11
659libsmbios:	libdevinfo
660libsrpt:	libstmf
661libstmf:	libscf
662libstmfproxy: 	libstmf libpthread
663libsum: 	libast
664libsun_ima:	libdevinfo libsysevent
665libsysevent:	libsecdb
666libtecla:	libcurses
667libtermcap:	libcurses
668libtnfctl:	../cmd/sgs/libelf
669libtsalarm:	libpcp
670libtsnet:	libtsol libsecdb
671libtsol:	libsecdb
672libuuid:	libdlpi
673libv12n:	libds libuuid
674libvolmgt:	libadm
675libvrrpadm:	libdladm libscf
676libvscan:	libscf libsecdb
677libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
678libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
679		libumem libtsol libzfs_core
680libzfs_jni:	libdiskmgt libzfs
681libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
682		libuutil libbsm libsecdb
683libzonestat:	libcmdutils libumem
684libzpool:	libavl libumem libcmdutils libsysevent
685madv:		libgen
686mpapi:		libpthread libdevinfo libsysevent
687mpss:		libgen
688nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
689pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
690passwdutil:	libsldap
691pkcs11:		libcryptoutil libgen libuuid
692policykit:	dbusdeps
693print:		libldap5 libmd5 libsendfile
694pylibbe: 	libbe libzfs
695pysolaris:	libsec libidmap
696pyzfs:		libzfs
697raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
698rpcsec_gss:	libgss
699sasl_plugins:	pkcs11 libgss libsasl
700scsi:		libfru libumem libdevid libdevinfo
701smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
702		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
703		libuuid libfakekernel libads libgss libldap5 krb5
704storage:	libdevice libdevinfo libdevid
705sun_fc:		libdevinfo libsysevent
706sun_sas:	libdevinfo libsysevent libkstat libdevid
707udapl:		libdevinfo libdladm
708
709#
710# The reason this rule checks for the existence of the
711# Makefile is that some of the directories do not exist
712# in certain situations (e.g., exportable source builds,
713# OpenSolaris).
714#
715$(SUBDIRS): FRC
716	@if [ -f $@/Makefile  ]; then \
717		cd $@; pwd; $(MAKE) $(TARGET); \
718	else \
719		true; \
720	fi
721
722$(SUBDIRS:%=%-nodepend):
723	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
724		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
725	else \
726		true; \
727	fi
728
729FRC:
730