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