xref: /titanic_51/usr/src/lib/Makefile (revision dc32d872cbeb56532bcea030255db9cd79bac7da)
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	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	libads		\
373	libast		\
374	libbrand	\
375	libbsm		\
376	libc		\
377	libcmd		\
378	libcmdutils	\
379	libcommputil	\
380	libcontract	\
381	libcpc		\
382	libcryptoutil	\
383	libctf		\
384	libcurses	\
385	libdevice	\
386	libdevid	\
387	libdevinfo	\
388	libdhcpagent	\
389	libdhcputil	\
390	libdisasm	\
391	libdiskmgt	\
392	libdladm	\
393	libdll		\
394	libdlpi		\
395	libdns_sd	\
396	libdscfg	\
397	libdtrace	\
398	libdtrace_jni	\
399	libelfsign	\
400	libeti		\
401	libfakekernel	\
402	libfcoe		\
403	libfru		\
404	libfstyp	\
405	libgen		\
406	libgrubmgmt	\
407	libidmap	\
408	libilb		\
409	libima		\
410	libinetsvc	\
411	libinetutil	\
412	libinstzones	\
413	libipadm	\
414	libipd		\
415	libipmi		\
416	libipmp		\
417	libipp		\
418	libipsecutil	\
419	libiscsit	\
420	libkrb5		\
421	libkstat	\
422	libkvm		\
423	libmail		\
424	libmapid	\
425	libmd		\
426	libmtmalloc	\
427	libndmp		\
428	libnsctl	\
429	libnsl		\
430	libnvpair	\
431	libnwam		\
432	libpam		\
433	libpcidb	\
434	libpctx		\
435	libpicl		\
436	libpicltree	\
437	libpool		\
438	libpp		\
439	libproc		\
440	libraidcfg	\
441	librcm		\
442	librdc		\
443	libreparse	\
444	librestart	\
445	librpcsvc	\
446	librsm		\
447	librstp		\
448	libsasl		\
449	libscf		\
450	libsec		\
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
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
645libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
646libshell:	libast libcmd libdll libsecdb
647libsip:		libmd5
648libsldap:	libldap5 libscf
649libsmbfs:	libkrb5 libsec libidmap pkcs11
650libsrpt:	libstmf
651libstmf:	libscf
652libstmfproxy: 	libstmf libpthread
653libsum: 	libast
654libsun_ima:	libdevinfo libsysevent
655libsysevent:	libsecdb
656libtecla:	libcurses
657libtermcap:	libcurses
658libtnfctl:	../cmd/sgs/libelf
659libtsalarm:	libpcp
660libtsnet:	libtsol libsecdb
661libtsol:	libsecdb
662libuuid:	libdlpi
663libv12n:	libds libuuid
664libvolmgt:	libadm
665libvrrpadm:	libdladm libscf
666libvscan:	libscf libsecdb
667libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
668libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
669		libumem libtsol libzfs_core
670libzfs_jni:	libdiskmgt libzfs
671libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
672		libuutil libbsm libsecdb
673libzonestat:	libcmdutils libumem
674libzpool:	libavl libumem libcmdutils libsysevent
675lvm:		libadm libdevid libdevinfo libefi libgen libscf
676madv:		libgen
677mpapi:		libpthread libdevinfo libsysevent
678mpss:		libgen
679nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
680pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
681passwdutil:	libsldap
682pkcs11:		libcryptoutil libgen libuuid
683policykit:	libsecdb
684print:		libldap5 libmd5 libsendfile
685pylibbe: 	libbe libzfs
686pysolaris:	libsec libidmap
687pyzfs:		libzfs
688raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
689rpcsec_gss:	libgss
690sasl_plugins:	pkcs11 libgss libsasl
691scsi:		libfru libumem libdevid libdevinfo
692smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
693		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
694		libuuid libfakekernel libads libgss libldap5 krb5
695storage:	libdevice libdevinfo libdevid
696sun_fc:		libdevinfo libsysevent
697sun_sas:	libdevinfo libsysevent libkstat libdevid
698udapl:		libdevinfo libdladm
699
700#
701# The reason this rule checks for the existence of the
702# Makefile is that some of the directories do not exist
703# in certain situations (e.g., exportable source builds,
704# OpenSolaris).
705#
706$(SUBDIRS): FRC
707	@if [ -f $@/Makefile  ]; then \
708		cd $@; pwd; $(MAKE) $(TARGET); \
709	else \
710		true; \
711	fi
712
713$(SUBDIRS:%=%-nodepend):
714	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
715		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
716	else \
717		true; \
718	fi
719
720FRC:
721