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