xref: /titanic_44/usr/src/lib/Makefile (revision d09be409e3c488f06601aa8479b0e8cd66afb360)
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 2017 Nexenta Systems, Inc.
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	libcustr	\
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	pysolaris	\
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	libast		\
372	libbrand	\
373	libbsm		\
374	libc		\
375	libcmd		\
376	libcmdutils	\
377	libcommputil	\
378	libcontract	\
379	libcpc		\
380	libcryptoutil	\
381	libctf		\
382	libcurses	\
383	libcustr	\
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	libsff		\
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	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 are currently required by libdbus-1 and should
566# be used for anything linking against it.
567dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
568
569# The following dependencies don't need to be listed below as they are built
570# before everything else:
571# libc libm libmd libmp libnsl libnvpair libsocket
572abi:		libctf libmapmalloc libproc
573auditd_plugins: libbsm libsecdb libgss libmtmalloc
574brand:		libzonecfg libmapmalloc
575cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
576fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
577		libcontract libsysevent ../cmd/sgs/libelf libdladm
578$(SPARC_BLD)fm:	libpri
579gss_mechs/mech_dh: libgss
580gss_mechs/mech_dummy: libgss
581gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
582gss_mechs/mech_spnego: gss_mechs/mech_krb5
583hal:		dbusdeps
584krb5:		gss_mechs/mech_krb5 libtecla libldap5
585libadt_jni:	libbsm
586libadutils: 	libldap5 libresolv2
587libbe: 		libzfs libinstzones libuuid libgen libdevinfo libefi
588libbsm:		libinetutil libscf libsecdb libtsol
589libcfgadm:	libdevinfo
590libcmd: 	libsum libast
591libcmdutils:	libavl
592libcpc:		libpctx
593libcrypt:	libgen
594libdevid:	libdevinfo
595libdevinfo:	libsec libgen
596libdhcpagent:	libdhcputil libuuid libdlpi libcontract
597libdhcputil:	libgen libinetutil libdlpi
598libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
599$(INTEL_BLD)libdiskmgt: libfdisk
600libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
601		libpool
602libdll: 	libast
603libdlpi:	libinetutil libdladm
604libds:		libsysevent
605libdscfg:	libnsctl libunistat libadm
606libdtrace:	libproc libgen libctf libmapmalloc
607libdtrace_jni:	libuutil libdtrace
608libefi:		libuuid
609libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
610libeti:		libcurses
611libexacct/demo:	libexacct libproject
612libfakekernel:	libumem libcryptoutil
613libfcoe:	libdladm
614libfru:		libfruutils
615libfsmgt:	libkstat
616libgrubmgmt:	libdevinfo libzfs libfstyp libefi
617$(INTEL_BLD)libgrubmgmt: libfdisk
618libidmap:	libavl libuutil
619libinetsvc:	libscf
620libinstzones:	libzonecfg libcontract
621libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb
622libipmp:	libinetutil
623libipsecutil:	libtecla libtsol
624libiscsit:	libstmf libuuid
625libkmf:		libcryptoutil pkcs11
626libkvm:		../cmd/sgs/libelf
627libldap5:	libsasl
628libmapid:	libresolv2 libscf
629libndmp:	libscf
630libnisdb:	libldap5
631libnwam:	libscf libbsm libdladm
632libpcp:		libumem libdevinfo
633libpctx:	libproc
634libpkg:		libwanboot libscf libadm
635libpool:	libscf libexacct
636libpp:		libast
637libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
638$(INTEL_BLD)libproc: libsaveargs
639libproject:	libpool libproc libsecdb
640libprtdiag:	libkstat
641libprtdiag_psr:	libprtdiag
642libraidcfg:	libdevinfo
643librdc:		libnsctl libunistat libdscfg
644librestart:	libuutil libscf libpool libproject libsecdb libsysevent
645libsasl:	libgss pkcs11
646libsaveargs:	libdisasm
647libscf:		libuutil libgen libsmbios
648libsec:		libavl libidmap
649libsff:		libnvpair
650libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
651libshell:	libast libcmd libdll libsecdb
652libsip:		libmd5
653libsldap:	libldap5 libscf
654libsmbfs:	libkrb5 libsec libidmap pkcs11
655libsmbios:	libdevinfo
656libsrpt:	libstmf
657libstmf:	libscf
658libstmfproxy: 	libstmf libpthread
659libsum: 	libast
660libsun_ima:	libdevinfo libsysevent
661libsysevent:	libsecdb
662libtecla:	libcurses
663libtermcap:	libcurses
664libtnfctl:	../cmd/sgs/libelf
665libtsalarm:	libpcp
666libtsnet:	libtsol libsecdb
667libtsol:	libsecdb
668libuuid:	libdlpi
669libv12n:	libds libuuid
670libvolmgt:	libadm
671libvrrpadm:	libdladm libscf
672libvscan:	libscf libsecdb
673libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
674libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
675		libumem libtsol libzfs_core
676libzfs_jni:	libdiskmgt libzfs
677libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
678		libuutil libbsm libsecdb
679libzonestat:	libcmdutils libumem
680libzpool:	libavl libumem libcmdutils libsysevent
681madv:		libgen
682mpapi:		libpthread libdevinfo libsysevent
683mpss:		libgen
684nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
685pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
686passwdutil:	libsldap
687pkcs11:		libcryptoutil libgen libuuid
688policykit:	dbusdeps
689print:		libldap5 libmd5 libsendfile
690pylibbe: 	libbe libzfs
691pysolaris:	libsec libidmap
692pyzfs:		libzfs
693raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
694rpcsec_gss:	libgss
695sasl_plugins:	pkcs11 libgss libsasl
696scsi:		libfru libumem libdevid libdevinfo
697smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
698		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
699		libuuid libfakekernel libgss libldap5 krb5
700storage:	libdevice libdevinfo libdevid
701sun_fc:		libdevinfo libsysevent
702sun_sas:	libdevinfo libsysevent libkstat libdevid
703udapl:		libdevinfo libdladm
704
705#
706# The reason this rule checks for the existence of the
707# Makefile is that some of the directories do not exist
708# in certain situations (e.g., exportable source builds,
709# OpenSolaris).
710#
711$(SUBDIRS): FRC
712	@if [ -f $@/Makefile  ]; then \
713		cd $@; pwd; $(MAKE) $(TARGET); \
714	else \
715		true; \
716	fi
717
718$(SUBDIRS:%=%-nodepend):
719	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
720		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
721	else \
722		true; \
723	fi
724
725FRC:
726