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