xref: /titanic_51/usr/src/lib/Makefile (revision d379c830a798d7a1d6833f58a35467893e5201b4)
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	libads		\
85	libadt_jni	\
86	libadutils	\
87	libaio		\
88	libast		\
89	libavl		\
90	libbe		\
91	libbrand	\
92	libbsdmalloc	\
93	libbsm		\
94	libc_db		\
95	libcfgadm	\
96	libcmd		\
97	libcmdutils	\
98	libcommputil	\
99	libcontract	\
100	libcpc		\
101	libcrypt	\
102	libcryptoutil	\
103	libctf		\
104	libcurses	\
105	libdevice	\
106	libdevid	\
107	libdevinfo	\
108	libdhcpagent	\
109	libdhcputil	\
110	libdisasm	\
111	libdiskmgt	\
112	libdladm	\
113	libdll		\
114	libdlpi		\
115	libdns_sd	\
116	libdoor		\
117	libdscfg	\
118	libdtrace	\
119	libdtrace_jni	\
120	libefi		\
121	libelfsign	\
122	libeti		\
123	libexacct	\
124	libexacct/demo	\
125	libfakekernel	\
126	libfcoe		\
127	libfru		\
128	libfruutils	\
129	libfsmgt	\
130	libfstyp	\
131	libgen		\
132	libgrubmgmt	\
133	libgss		\
134	libhotplug	\
135	libidmap	\
136	libilb		\
137	libima		\
138	libinetsvc	\
139	libinetutil	\
140	libinstzones	\
141	libintl		\
142	libipadm	\
143	libipd		\
144	libipmi		\
145	libipmp		\
146	libipp		\
147	libipsecutil	\
148	libiscsit	\
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	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	pyzfs		\
356	rpcsec_gss	\
357	$($(MACH)_MSGSUBDIRS)
358
359sparc_MSGSUBDIRS=	\
360	libprtdiag	\
361	libprtdiag_psr
362
363i386_MSGSUBDIRS= libfdisk
364
365HDRSUBDIRS=				\
366	../cmd/sendmail/libmilter	\
367	auditd_plugins	\
368	fm		\
369	hal		\
370	hbaapi		\
371	libads		\
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	libshare	\
451	libshell	\
452	libsip		\
453	libslp		\
454	libsmbfs	\
455	libsmbios	\
456	libsmedia	\
457	libsocket	\
458	libsqlite	\
459	libsrpt		\
460	libstmf		\
461	libstmfproxy	\
462	libsum		\
463	libsun_ima	\
464	libsysevent	\
465	libtecla	\
466	libtermcap	\
467	libtnf		\
468	libtnfctl	\
469	libtnfprobe	\
470	libtsnet	\
471	libtsol		\
472	libumem		\
473	libunistat	\
474	libuutil	\
475	libvolmgt	\
476	libvrrpadm	\
477	libvscan	\
478	libwanboot	\
479	libwanbootutil	\
480	libwrap		\
481	libxcurses2	\
482	libzfs		\
483	libzfs_core	\
484	libzfs_jni	\
485	libzoneinfo	\
486	libzonestat	\
487	lvm		\
488	mpapi		\
489	passwdutil	\
490	pkcs11		\
491	policykit	\
492	scsi		\
493	smbsrv		\
494	smhba		\
495	udapl		\
496	$($(MACH)_HDRSUBDIRS)
497
498i386_HDRSUBDIRS=	\
499	libfdisk	\
500	libsaveargs
501
502sparc_HDRSUBDIRS=	\
503	libds		\
504	libdscp		\
505	libpri		\
506	libv12n		\
507	storage
508
509all :=		TARGET= all
510check :=	TARGET= check
511clean :=	TARGET= clean
512clobber :=	TARGET= clobber
513install :=	TARGET= install
514install_h :=	TARGET= install_h
515lint :=		TARGET= lint
516_dc :=		TARGET= _dc
517_msg :=		TARGET= _msg
518
519.KEEP_STATE:
520
521#
522# For the all and install targets, we clearly must respect library
523# dependencies so that the libraries link correctly.  However, for
524# the remaining targets (check, clean, clobber, install_h, lint, _dc
525# and _msg), libraries do not have any dependencies on one another
526# and thus respecting dependencies just slows down the build.
527# As such, for these rules, we use pattern replacement to explicitly
528# avoid triggering the dependency information.  Note that for clean,
529# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
530# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
531#
532
533all:			$(SUBDIRS)
534
535install:		$(SUBDIRS) .WAIT install_extra
536
537# extra libraries kept in other source areas
538install_extra:
539	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
540	@pwd
541
542clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
543
544install_h check:	$(HDRSUBDIRS:%=%-nodepend)
545
546_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
547
548_dc:			$(DCSUBDIRS:%=%-nodepend)
549
550# Library interdependencies are called out explicitly here.
551../cmd/sgs/libconv: common
552../cmd/sgs/libdl: common
553libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
554
555libm:		libc
556libmd:		libc
557libmp:		libc
558libnsl:		libc libmd libmp
559libnvpair:	libc libnsl
560libsocket:	libc libnsl
561
562basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
563basedeps :=	TARGET=install
564
565# The following dependencies don't need to be listed below as they are built
566# before everything else:
567# libc libm libmd libmp libnsl libnvpair libsocket
568abi:		libctf libmapmalloc libproc
569auditd_plugins: libbsm libsecdb libgss libmtmalloc
570brand:		libzonecfg libmapmalloc
571cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
572fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
573		libcontract libsysevent ../cmd/sgs/libelf
574$(SPARC_BLD)fm:	libpri
575gss_mechs/mech_dh: libgss
576gss_mechs/mech_dummy: libgss
577gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
578gss_mechs/mech_spnego: gss_mechs/mech_krb5
579krb5:		gss_mechs/mech_krb5 libtecla libldap5
580libadt_jni:	libbsm
581libadutils: 	libldap5 libresolv2
582libbe: 		libzfs libinstzones libuuid libgen libdevinfo libefi
583libbsm:		libinetutil libscf libsecdb libtsol
584libcfgadm:	libdevinfo
585libcmd: 	libsum libast
586libcmdutils:	libavl
587libcpc:		libpctx
588libcrypt:	libgen
589libdevid:	libdevinfo
590libdevinfo:	libsec libgen
591libdhcpagent:	libdhcputil libuuid libdlpi libcontract
592libdhcputil:	libgen libinetutil libdlpi
593libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
594$(INTEL_BLD)libdiskmgt: libfdisk
595libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
596		libpool
597libdll: 	libast
598libdlpi:	libinetutil libdladm
599libds:		libsysevent
600libdscfg:	libnsctl libunistat libadm
601libdtrace:	libproc libgen libctf libmapmalloc
602libdtrace_jni:	libuutil libdtrace
603libefi:		libuuid
604libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
605libeti:		libcurses
606libexacct/demo:	libexacct libproject
607libfakekernel:	libumem libcryptoutil
608libfcoe:	libdladm
609libfru:		libfruutils
610libfsmgt:	libkstat
611libgrubmgmt:	libdevinfo libzfs libfstyp libefi
612$(INTEL_BLD)libgrubmgmt: libfdisk
613libidmap:	libavl libuutil
614libinetsvc:	libscf
615libinstzones:	libzonecfg libcontract
616libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb
617libipmp:	libinetutil
618libipsecutil:	libtecla libtsol
619libiscsit:	libstmf libuuid
620libkmf:		libcryptoutil pkcs11
621libkvm:		../cmd/sgs/libelf
622libldap5:	libsasl
623libmapid:	libresolv2 libscf
624libndmp:	libscf
625libnisdb:	libldap5
626libnwam:	libscf libbsm libdladm
627libpcp:		libumem libdevinfo
628libpctx:	libproc
629libpkg:		libwanboot libscf libadm
630libpool:	libscf libexacct
631libpp:		libast
632libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
633$(INTEL_BLD)libproc: libsaveargs
634libproject:	libpool libproc libsecdb
635libprtdiag:	libkstat
636libprtdiag_psr:	libprtdiag
637libraidcfg:	libdevinfo
638librdc:		libnsctl libunistat libdscfg
639librestart:	libuutil libscf libpool libproject libsecdb libsysevent
640libsasl:	libgss pkcs11
641libsaveargs:	libdisasm
642libscf:		libuutil libgen libsmbios
643libsec:		libavl libidmap
644libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
645libshell:	libast libcmd libdll libsecdb
646libsip:		libmd5
647libsldap:	libldap5 libscf
648libsmbfs:	libkrb5 libsec libidmap pkcs11
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
674lvm:		libadm libdevid libdevinfo libefi libgen libscf
675madv:		libgen
676mpapi:		libpthread libdevinfo libsysevent
677mpss:		libgen
678nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
679pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
680passwdutil:	libsldap
681pkcs11:		libcryptoutil libgen libuuid
682policykit:	libsecdb
683print:		libldap5 libmd5 libsendfile
684pylibbe: 	libbe libzfs
685pysolaris:	libsec libidmap
686pyzfs:		libzfs
687raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
688rpcsec_gss:	libgss
689sasl_plugins:	pkcs11 libgss libsasl
690scsi:		libfru libumem libdevid libdevinfo
691smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
692		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
693		libuuid libfakekernel libads libgss libldap5 krb5
694storage:	libdevice libdevinfo libdevid
695sun_fc:		libdevinfo libsysevent
696sun_sas:	libdevinfo libsysevent libkstat libdevid
697udapl:		libdevinfo libdladm
698
699#
700# The reason this rule checks for the existence of the
701# Makefile is that some of the directories do not exist
702# in certain situations (e.g., exportable source builds,
703# OpenSolaris).
704#
705$(SUBDIRS): FRC
706	@if [ -f $@/Makefile  ]; then \
707		cd $@; pwd; $(MAKE) $(TARGET); \
708	else \
709		true; \
710	fi
711
712$(SUBDIRS:%=%-nodepend):
713	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
714		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
715	else \
716		true; \
717	fi
718
719FRC:
720