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