xref: /titanic_52/usr/src/lib/Makefile (revision dce9588a00eb374231f56db53a208a90ea2dc82b)
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	libjedec	\
150	libkmf		\
151	libkrb5		\
152	libkstat	\
153	libkvm		\
154	libldap5	\
155	liblgrp		\
156	liblm		\
157	libm1		\
158	libmail		\
159	libmalloc	\
160	libmapid	\
161	libmapmalloc	\
162	libmd5		\
163	libmtmalloc	\
164	libmvec		\
165	libndmp		\
166	libnisdb	\
167	libnls		\
168	libnsctl	\
169	libnwam		\
170	libpam		\
171	libpcidb	\
172	libpctx		\
173	libpicl		\
174	libpicltree	\
175	libpkg		\
176	libpool		\
177	libpp		\
178	libproc		\
179	libproject	\
180	libpthread	\
181	libraidcfg	\
182	librcm		\
183	librdc		\
184	libreparse	\
185	libresolv	\
186	libresolv2	\
187	librestart	\
188	librpcsvc	\
189	librsm		\
190	librstp		\
191	librt		\
192	libsasl		\
193	libscf		\
194	libsched	\
195	libsctp		\
196	libsec		\
197	libsecdb	\
198	libsendfile	\
199	libsff		\
200	libshare	\
201	libshell	\
202	libsip		\
203	libsldap	\
204	libslp		\
205	libsmbfs	\
206	libsmbios	\
207	libsmedia	\
208	libsqlite	\
209	libsrpt		\
210	libstmf		\
211	libstmfproxy	\
212	libsum		\
213	libsun_ima	\
214	libsys		\
215	libsysevent	\
216	libtecla	\
217	libtermcap	\
218	libthread	\
219	libtnf		\
220	libtnfctl	\
221	libtnfprobe	\
222	libtsnet	\
223	libtsol		\
224	libumem		\
225	libunistat	\
226	libuuid		\
227	libuutil	\
228	libvolmgt	\
229	libvrrpadm	\
230	libvscan	\
231	libw		\
232	libwanboot	\
233	libwanbootutil	\
234	libwrap		\
235	libxcurses	\
236	libxcurses2	\
237	libxnet		\
238	libzfs		\
239	libzfs_core	\
240	libzfs_jni	\
241	libzonecfg	\
242	libzoneinfo	\
243	libzonestat	\
244	libzpool	\
245	madv		\
246	mpapi		\
247	mpss		\
248	nametoaddr	\
249	ncad_addr	\
250	nsswitch	\
251	pam_modules	\
252	passwdutil	\
253	pkcs11		\
254	policykit	\
255	print		\
256	pylibbe		\
257	pysolaris	\
258	pyzfs		\
259	raidcfg_plugins	\
260	rpcsec_gss	\
261	sasl_plugins	\
262	scsi		\
263	smbsrv		\
264	smhba		\
265	sun_fc		\
266	sun_sas		\
267	udapl		\
268	watchmalloc	\
269	$($(MACH)_SUBDIRS)
270
271i386_SUBDIRS=		\
272	libfdisk	\
273	libsaveargs
274
275sparc_SUBDIRS=		\
276	efcode		\
277	libds		\
278	libdscp		\
279	libprtdiag	\
280	libprtdiag_psr	\
281	libpri		\
282	librsc		\
283	storage		\
284	libpcp		\
285	libtsalarm	\
286	libv12n
287
288#
289# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
290# clean and clobber targets (for more information, see those targets, below).
291#
292NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
293
294DCSUBDIRS=
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	madv		\
352	mpss		\
353	pam_modules	\
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	libads		\
371	libast		\
372	libbrand	\
373	libbsm		\
374	libc		\
375	libcmd		\
376	libcmdutils	\
377	libcommputil	\
378	libcontract	\
379	libcpc		\
380	libcryptoutil	\
381	libctf		\
382	libcurses	\
383	libdevice	\
384	libdevid	\
385	libdevinfo	\
386	libdhcpagent	\
387	libdhcputil	\
388	libdisasm	\
389	libdiskmgt	\
390	libdladm	\
391	libdll		\
392	libdlpi		\
393	libdns_sd	\
394	libdscfg	\
395	libdtrace	\
396	libdtrace_jni	\
397	libelfsign	\
398	libeti		\
399	libfakekernel	\
400	libfcoe		\
401	libfru		\
402	libfstyp	\
403	libgen		\
404	libgrubmgmt	\
405	libidmap	\
406	libilb		\
407	libima		\
408	libinetsvc	\
409	libinetutil	\
410	libinstzones	\
411	libipadm	\
412	libipd		\
413	libipmi		\
414	libipmp		\
415	libipp		\
416	libipsecutil	\
417	libiscsit	\
418	libkrb5		\
419	libkstat	\
420	libkvm		\
421	libmail		\
422	libmapid	\
423	libmd		\
424	libmtmalloc	\
425	libndmp		\
426	libnsctl	\
427	libnsl		\
428	libnvpair	\
429	libnwam		\
430	libpam		\
431	libpcidb	\
432	libpctx		\
433	libpicl		\
434	libpicltree	\
435	libpool		\
436	libpp		\
437	libproc		\
438	libraidcfg	\
439	librcm		\
440	librdc		\
441	libreparse	\
442	librestart	\
443	librpcsvc	\
444	librsm		\
445	librstp		\
446	libsasl		\
447	libscf		\
448	libsec		\
449	libsff		\
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	mpapi		\
488	passwdutil	\
489	pkcs11		\
490	policykit	\
491	scsi		\
492	smbsrv		\
493	smhba		\
494	udapl		\
495	$($(MACH)_HDRSUBDIRS)
496
497i386_HDRSUBDIRS=	\
498	libfdisk	\
499	libsaveargs
500
501sparc_HDRSUBDIRS=	\
502	libds		\
503	libdscp		\
504	libpri		\
505	libv12n		\
506	storage
507
508all :=		TARGET= all
509check :=	TARGET= check
510clean :=	TARGET= clean
511clobber :=	TARGET= clobber
512install :=	TARGET= install
513install_h :=	TARGET= install_h
514lint :=		TARGET= lint
515_dc :=		TARGET= _dc
516_msg :=		TARGET= _msg
517
518.KEEP_STATE:
519
520#
521# For the all and install targets, we clearly must respect library
522# dependencies so that the libraries link correctly.  However, for
523# the remaining targets (check, clean, clobber, install_h, lint, _dc
524# and _msg), libraries do not have any dependencies on one another
525# and thus respecting dependencies just slows down the build.
526# As such, for these rules, we use pattern replacement to explicitly
527# avoid triggering the dependency information.  Note that for clean,
528# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
529# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
530#
531
532all:			$(SUBDIRS)
533
534install:		$(SUBDIRS) .WAIT install_extra
535
536# extra libraries kept in other source areas
537install_extra:
538	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
539	@pwd
540
541clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
542
543install_h check:	$(HDRSUBDIRS:%=%-nodepend)
544
545_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
546
547_dc:			$(DCSUBDIRS:%=%-nodepend)
548
549# Library interdependencies are called out explicitly here.
550../cmd/sgs/libconv: common
551../cmd/sgs/libdl: common
552libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
553
554libm:		libc
555libmd:		libc
556libmp:		libc
557libnsl:		libc libmd libmp
558libnvpair:	libc libnsl
559libsocket:	libc libnsl
560
561basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
562basedeps :=	TARGET=install
563
564# The following dependencies don't need to be listed below as they are built
565# before everything else:
566# libc libm libmd libmp libnsl libnvpair libsocket
567abi:		libctf libmapmalloc libproc
568auditd_plugins: libbsm libsecdb libgss libmtmalloc
569brand:		libzonecfg libmapmalloc
570cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
571fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
572		libcontract libsysevent ../cmd/sgs/libelf libdladm
573$(SPARC_BLD)fm:	libpri
574gss_mechs/mech_dh: libgss
575gss_mechs/mech_dummy: libgss
576gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
577gss_mechs/mech_spnego: gss_mechs/mech_krb5
578krb5:		gss_mechs/mech_krb5 libtecla libldap5
579libadt_jni:	libbsm
580libadutils: 	libldap5 libresolv2
581libbe: 		libzfs libinstzones libuuid libgen libdevinfo libefi
582libbsm:		libinetutil libscf libsecdb libtsol
583libcfgadm:	libdevinfo
584libcmd: 	libsum libast
585libcmdutils:	libavl
586libcpc:		libpctx
587libcrypt:	libgen
588libdevid:	libdevinfo
589libdevinfo:	libsec libgen
590libdhcpagent:	libdhcputil libuuid libdlpi libcontract
591libdhcputil:	libgen libinetutil libdlpi
592libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
593$(INTEL_BLD)libdiskmgt: libfdisk
594libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
595		libpool
596libdll: 	libast
597libdlpi:	libinetutil libdladm
598libds:		libsysevent
599libdscfg:	libnsctl libunistat libadm
600libdtrace:	libproc libgen libctf libmapmalloc
601libdtrace_jni:	libuutil libdtrace
602libefi:		libuuid
603libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
604libeti:		libcurses
605libexacct/demo:	libexacct libproject
606libfakekernel:	libumem libcryptoutil
607libfcoe:	libdladm
608libfru:		libfruutils
609libfsmgt:	libkstat
610libgrubmgmt:	libdevinfo libzfs libfstyp libefi
611$(INTEL_BLD)libgrubmgmt: libfdisk
612libidmap:	libavl libuutil
613libinetsvc:	libscf
614libinstzones:	libzonecfg libcontract
615libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb
616libipmp:	libinetutil
617libipsecutil:	libtecla libtsol
618libiscsit:	libstmf libuuid
619libkmf:		libcryptoutil pkcs11
620libkvm:		../cmd/sgs/libelf
621libldap5:	libsasl
622libmapid:	libresolv2 libscf
623libndmp:	libscf
624libnisdb:	libldap5
625libnwam:	libscf libbsm libdladm
626libpcp:		libumem libdevinfo
627libpctx:	libproc
628libpkg:		libwanboot libscf libadm
629libpool:	libscf libexacct
630libpp:		libast
631libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
632$(INTEL_BLD)libproc: libsaveargs
633libproject:	libpool libproc libsecdb
634libprtdiag:	libkstat
635libprtdiag_psr:	libprtdiag
636libraidcfg:	libdevinfo
637librdc:		libnsctl libunistat libdscfg
638librestart:	libuutil libscf libpool libproject libsecdb libsysevent
639libsasl:	libgss pkcs11
640libsaveargs:	libdisasm
641libscf:		libuutil libgen libsmbios
642libsec:		libavl libidmap
643libsff:		libnvpair
644libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
645libshell:	libast libcmd libdll libsecdb
646libsip:		libmd5
647libsldap:	libldap5 libscf
648libsmbfs:	libkrb5 libsec libidmap pkcs11
649libsmbios:	libdevinfo
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
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