xref: /titanic_44/usr/src/lib/Makefile (revision 48a4016cae8aa2b8b3d8b258eb22e0c781912bed)
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#
31
32include ../Makefile.master
33
34#	Note that libcurses installs commands along with its library.
35#	This is a minor bug which probably should be fixed.
36#	Note also that a few extra libraries are kept in cmd source.
37#
38# Certain libraries are linked with, hence depend on, other libraries.
39# Library dependencies are called out explicitly, see "Library
40# interdependencies" below.
41.PARALLEL:
42
43# Build libc and its dependencies
44SUBDIRS=			\
45	common			\
46	../cmd/sgs/libconv	\
47	../cmd/sgs/libdl	\
48	libc			\
49	.WAIT
50
51# Build libraries with lots of dependents
52SUBDIRS +=		\
53	libm		\
54	libmd		\
55	libmp		\
56	libnsl		\
57	libnvpair	\
58	libsocket	\
59	.WAIT
60
61# Build everything else. Aside from explicit dependencies, all libraries
62# are built in parallel.
63SUBDIRS +=				\
64	../cmd/sendmail/libmilter	\
65	../cmd/sgs/libelf	\
66	../cmd/sgs/librtld_db	\
67	abi		\
68	auditd_plugins	\
69	brand		\
70	c_synonyms	\
71	cfgadm_plugins	\
72	crypt_modules	\
73	extendedFILE	\
74	fm		\
75	getloginx	\
76	gss_mechs/mech_dh	\
77	gss_mechs/mech_dummy	\
78	gss_mechs/mech_krb5	\
79	gss_mechs/mech_spnego	\
80	hal		\
81	hbaapi		\
82	krb5		\
83	libadm		\
84	libadt_jni	\
85	libadutils	\
86	libaio		\
87	libast		\
88	libavl		\
89	libbe		\
90	libbrand	\
91	libbsdmalloc	\
92	libbsm		\
93	libc_db		\
94	libcfgadm	\
95	libcmd		\
96	libcmdutils	\
97	libcommputil	\
98	libcontract	\
99	libcpc		\
100	libcrypt	\
101	libcryptoutil	\
102	libctf		\
103	libcurses	\
104	libdevice	\
105	libdevid	\
106	libdevinfo	\
107	libdhcpagent	\
108	libdhcputil	\
109	libdisasm	\
110	libdiskmgt	\
111	libdladm	\
112	libdll		\
113	libdlpi		\
114	libdns_sd	\
115	libdoor		\
116	libdscfg	\
117	libdtrace	\
118	libdtrace_jni	\
119	libefi		\
120	libelfsign	\
121	libeti		\
122	libexacct	\
123	libexacct/demo	\
124	libfakekernel	\
125	libfcoe		\
126	libfru		\
127	libfruutils	\
128	libfsmgt	\
129	libfstyp	\
130	libgen		\
131	libgrubmgmt	\
132	libgss		\
133	libhotplug	\
134	libidmap	\
135	libilb		\
136	libima		\
137	libinetsvc	\
138	libinetutil	\
139	libinstzones	\
140	libintl		\
141	libipadm	\
142	libipd		\
143	libipmi		\
144	libipmp		\
145	libipp		\
146	libipsecutil	\
147	libiscsit	\
148	libkmf		\
149	libkrb5		\
150	libkstat	\
151	libkvm		\
152	libldap5	\
153	liblgrp		\
154	liblm		\
155	libm1		\
156	libmail		\
157	libmalloc	\
158	libmapid	\
159	libmapmalloc	\
160	libmd5		\
161	libmtmalloc	\
162	libmvec		\
163	libndmp		\
164	libnisdb	\
165	libnls		\
166	libnsctl	\
167	libnwam		\
168	libpam		\
169	libpcidb	\
170	libpctx		\
171	libpicl		\
172	libpicltree	\
173	libpkg		\
174	libpool		\
175	libpp		\
176	libproc		\
177	libproject	\
178	libpthread	\
179	libraidcfg	\
180	librcm		\
181	librdc		\
182	libreparse	\
183	libresolv	\
184	libresolv2	\
185	librestart	\
186	librpcsvc	\
187	librsm		\
188	librstp		\
189	librt		\
190	libsasl		\
191	libscf		\
192	libsched	\
193	libsctp		\
194	libsec		\
195	libsecdb	\
196	libsendfile	\
197	libsff		\
198	libshare	\
199	libshell	\
200	libsip		\
201	libsldap	\
202	libslp		\
203	libsmbfs	\
204	libsmbios	\
205	libsmedia	\
206	libsqlite	\
207	libsrpt		\
208	libstmf		\
209	libstmfproxy	\
210	libsum		\
211	libsun_ima	\
212	libsys		\
213	libsysevent	\
214	libtecla	\
215	libtermcap	\
216	libthread	\
217	libtnf		\
218	libtnfctl	\
219	libtnfprobe	\
220	libtsnet	\
221	libtsol		\
222	libumem		\
223	libunistat	\
224	libuuid		\
225	libuutil	\
226	libvolmgt	\
227	libvrrpadm	\
228	libvscan	\
229	libw		\
230	libwanboot	\
231	libwanbootutil	\
232	libwrap		\
233	libxcurses	\
234	libxcurses2	\
235	libxnet		\
236	libzfs		\
237	libzfs_core	\
238	libzfs_jni	\
239	libzonecfg	\
240	libzoneinfo	\
241	libzonestat	\
242	libzpool	\
243	lvm		\
244	madv		\
245	mpapi		\
246	mpss		\
247	nametoaddr	\
248	ncad_addr	\
249	nsswitch	\
250	pam_modules	\
251	passwdutil	\
252	pkcs11		\
253	policykit	\
254	print		\
255	pylibbe		\
256	pysolaris	\
257	pyzfs		\
258	raidcfg_plugins	\
259	rpcsec_gss	\
260	sasl_plugins	\
261	scsi		\
262	smbsrv		\
263	smhba		\
264	sun_fc		\
265	sun_sas		\
266	udapl		\
267	watchmalloc	\
268	$($(MACH)_SUBDIRS)
269
270i386_SUBDIRS=		\
271	libfdisk	\
272	libsaveargs
273
274sparc_SUBDIRS=		\
275	efcode		\
276	libds		\
277	libdscp		\
278	libprtdiag	\
279	libprtdiag_psr	\
280	libpri		\
281	librsc		\
282	storage		\
283	libpcp		\
284	libtsalarm	\
285	libv12n
286
287#
288# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
289# clean and clobber targets (for more information, see those targets, below).
290#
291NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
292
293DCSUBDIRS =		\
294	lvm
295
296MSGSUBDIRS=		\
297	abi		\
298	auditd_plugins	\
299	brand		\
300	cfgadm_plugins	\
301	gss_mechs/mech_dh	\
302	gss_mechs/mech_krb5	\
303	krb5		\
304	libast		\
305	libbsm		\
306	libc		\
307	libcfgadm	\
308	libcmd		\
309	libcontract	\
310	libcurses	\
311	libdhcputil	\
312	libdiskmgt	\
313	libdladm	\
314	libdll		\
315	libgrubmgmt	\
316	libgss		\
317	libidmap	\
318	libilb		\
319	libinetutil	\
320	libinstzones	\
321	libipadm	\
322	libipmp		\
323	libipsecutil	\
324	libldap5	\
325	libnsl		\
326	libnwam		\
327	libpam		\
328	libpicl		\
329	libpkg		\
330	libpool		\
331	libpp		\
332	libreparse	\
333	libsasl		\
334	libscf		\
335	libsecdb	\
336	libshare	\
337	libshell	\
338	libsldap	\
339	libslp		\
340	libsmbfs	\
341	libsmedia	\
342	libsum		\
343	libtsol		\
344	libuutil	\
345	libvrrpadm	\
346	libvscan	\
347	libwanboot	\
348	libwanbootutil	\
349	libzfs		\
350	libzonecfg	\
351	lvm		\
352	madv		\
353	mpss		\
354	pam_modules	\
355	pysolaris	\
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	libast		\
373	libbrand	\
374	libbsm		\
375	libc		\
376	libcmd		\
377	libcmdutils	\
378	libcommputil	\
379	libcontract	\
380	libcpc		\
381	libcryptoutil	\
382	libctf		\
383	libcurses	\
384	libdevice	\
385	libdevid	\
386	libdevinfo	\
387	libdhcpagent	\
388	libdhcputil	\
389	libdisasm	\
390	libdiskmgt	\
391	libdladm	\
392	libdll		\
393	libdlpi		\
394	libdns_sd	\
395	libdscfg	\
396	libdtrace	\
397	libdtrace_jni	\
398	libelfsign	\
399	libeti		\
400	libfakekernel	\
401	libfcoe		\
402	libfru		\
403	libfstyp	\
404	libgen		\
405	libgrubmgmt	\
406	libidmap	\
407	libilb		\
408	libima		\
409	libinetsvc	\
410	libinetutil	\
411	libinstzones	\
412	libipadm	\
413	libipd		\
414	libipmi		\
415	libipmp		\
416	libipp		\
417	libipsecutil	\
418	libiscsit	\
419	libkrb5		\
420	libkstat	\
421	libkvm		\
422	libmail		\
423	libmapid	\
424	libmd		\
425	libmtmalloc	\
426	libndmp		\
427	libnsctl	\
428	libnsl		\
429	libnvpair	\
430	libnwam		\
431	libpam		\
432	libpcidb	\
433	libpctx		\
434	libpicl		\
435	libpicltree	\
436	libpool		\
437	libpp		\
438	libproc		\
439	libraidcfg	\
440	librcm		\
441	librdc		\
442	libreparse	\
443	librestart	\
444	librpcsvc	\
445	librsm		\
446	librstp		\
447	libsasl		\
448	libscf		\
449	libsec		\
450	libsff		\
451	libshare	\
452	libshell	\
453	libsip		\
454	libslp		\
455	libsmbfs	\
456	libsmbios	\
457	libsmedia	\
458	libsocket	\
459	libsqlite	\
460	libsrpt		\
461	libstmf		\
462	libstmfproxy	\
463	libsum		\
464	libsun_ima	\
465	libsysevent	\
466	libtecla	\
467	libtermcap	\
468	libtnf		\
469	libtnfctl	\
470	libtnfprobe	\
471	libtsnet	\
472	libtsol		\
473	libumem		\
474	libunistat	\
475	libuutil	\
476	libvolmgt	\
477	libvrrpadm	\
478	libvscan	\
479	libwanboot	\
480	libwanbootutil	\
481	libwrap		\
482	libxcurses2	\
483	libzfs		\
484	libzfs_core	\
485	libzfs_jni	\
486	libzoneinfo	\
487	libzonestat	\
488	lvm		\
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: common
553../cmd/sgs/libdl: common
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 don't need to be listed below as they are built
567# before everything else:
568# libc libm libmd libmp libnsl libnvpair libsocket
569abi:		libctf libmapmalloc libproc
570auditd_plugins: libbsm libsecdb libgss libmtmalloc
571brand:		libzonecfg libmapmalloc
572cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
573fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
574		libcontract libsysevent ../cmd/sgs/libelf libdladm
575$(SPARC_BLD)fm:	libpri
576gss_mechs/mech_dh: libgss
577gss_mechs/mech_dummy: libgss
578gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
579gss_mechs/mech_spnego: gss_mechs/mech_krb5
580krb5:		gss_mechs/mech_krb5 libtecla libldap5
581libadt_jni:	libbsm
582libadutils: 	libldap5 libresolv2
583libbe: 		libzfs libinstzones libuuid libgen libdevinfo libefi
584libbsm:		libinetutil libscf libsecdb libtsol
585libcfgadm:	libdevinfo
586libcmd: 	libsum libast
587libcmdutils:	libavl
588libcpc:		libpctx
589libcrypt:	libgen
590libdevid:	libdevinfo
591libdevinfo:	libsec libgen
592libdhcpagent:	libdhcputil libuuid libdlpi libcontract
593libdhcputil:	libgen libinetutil libdlpi
594libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
595$(INTEL_BLD)libdiskmgt: libfdisk
596libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
597		libpool
598libdll: 	libast
599libdlpi:	libinetutil libdladm
600libds:		libsysevent
601libdscfg:	libnsctl libunistat libadm
602libdtrace:	libproc libgen libctf libmapmalloc
603libdtrace_jni:	libuutil libdtrace
604libefi:		libuuid
605libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
606libeti:		libcurses
607libexacct/demo:	libexacct libproject
608libfakekernel:	libumem libcryptoutil
609libfcoe:	libdladm
610libfru:		libfruutils
611libfsmgt:	libkstat
612libgrubmgmt:	libdevinfo libzfs libfstyp libefi
613$(INTEL_BLD)libgrubmgmt: libfdisk
614libidmap:	libavl libuutil
615libinetsvc:	libscf
616libinstzones:	libzonecfg libcontract
617libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb
618libipmp:	libinetutil
619libipsecutil:	libtecla libtsol
620libiscsit:	libstmf libuuid
621libkmf:		libcryptoutil pkcs11
622libkvm:		../cmd/sgs/libelf
623libldap5:	libsasl
624libmapid:	libresolv2 libscf
625libndmp:	libscf
626libnisdb:	libldap5
627libnwam:	libscf libbsm libdladm
628libpcp:		libumem libdevinfo
629libpctx:	libproc
630libpkg:		libwanboot libscf libadm
631libpool:	libscf libexacct
632libpp:		libast
633libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
634$(INTEL_BLD)libproc: libsaveargs
635libproject:	libpool libproc libsecdb
636libprtdiag:	libkstat
637libprtdiag_psr:	libprtdiag
638libraidcfg:	libdevinfo
639librdc:		libnsctl libunistat libdscfg
640librestart:	libuutil libscf libpool libproject libsecdb libsysevent
641libsasl:	libgss pkcs11
642libsaveargs:	libdisasm
643libscf:		libuutil libgen libsmbios
644libsec:		libavl libidmap
645libsff:		libnvpair
646libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
647libshell:	libast libcmd libdll libsecdb
648libsip:		libmd5
649libsldap:	libldap5 libscf
650libsmbfs:	libkrb5 libsec libidmap pkcs11
651libsmbios:	libdevinfo
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 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