xref: /titanic_50/usr/src/lib/Makefile (revision f3e7f55e73a39377d55a030f124cc86b3b66a9cc)
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 2015, Joyent, Inc.
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	crt			\
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	iconv_modules	\
83	krb5		\
84	libadm		\
85	libads		\
86	libadt_jni	\
87	libadutils	\
88	libaio		\
89	libast		\
90	libavl		\
91	libbe		\
92	libbrand	\
93	libbsdmalloc	\
94	libbsm		\
95	libc_db		\
96	libcfgadm	\
97	libcmd		\
98	libcmdutils	\
99	libcommputil	\
100	libcontract	\
101	libcpc		\
102	libcrypt	\
103	libcryptoutil	\
104	libctf		\
105	libcurses	\
106	libcustr	\
107	libdevice	\
108	libdevid	\
109	libdevinfo	\
110	libdhcpagent	\
111	libdhcputil	\
112	libdisasm	\
113	libdiskmgt	\
114	libdladm	\
115	libdll		\
116	libdlpi		\
117	libdns_sd	\
118	libdoor		\
119	libdscfg	\
120	libdtrace	\
121	libdtrace_jni	\
122	libdwarf	\
123	libefi		\
124	libelfsign	\
125	libeti		\
126	libexacct	\
127	libexacct/demo	\
128	libfakekernel	\
129	libfcoe		\
130	libfru		\
131	libfruutils	\
132	libfsmgt	\
133	libfstyp	\
134	libgen		\
135	libgrubmgmt	\
136	libgss		\
137	libhotplug	\
138	libidmap	\
139	libilb		\
140	libima		\
141	libinetsvc	\
142	libinetutil	\
143	libinstzones	\
144	libintl		\
145	libipadm	\
146	libipd		\
147	libipmi		\
148	libipmp		\
149	libipp		\
150	libipsecutil	\
151	libiscsit	\
152	libjedec	\
153	libkmf		\
154	libkrb5		\
155	libkstat	\
156	libkvm		\
157	libldap5	\
158	liblgrp		\
159	liblm		\
160	libm1		\
161	libmail		\
162	libmalloc	\
163	libmapid	\
164	libmapmalloc	\
165	libmd5		\
166	libmtmalloc	\
167	libmvec		\
168	libndmp		\
169	libnisdb	\
170	libnls		\
171	libnsctl	\
172	libnwam		\
173	libpam		\
174	libpcidb	\
175	libpctx		\
176	libpicl		\
177	libpicltree	\
178	libpkg		\
179	libpool		\
180	libpp		\
181	libproc		\
182	libproject	\
183	libpthread	\
184	libraidcfg	\
185	librcm		\
186	librdc		\
187	libreparse	\
188	libresolv	\
189	libresolv2	\
190	librestart	\
191	librpcsvc	\
192	librsm		\
193	librstp		\
194	librt		\
195	libsasl		\
196	libscf		\
197	libsched	\
198	libsctp		\
199	libsec		\
200	libsecdb	\
201	libsendfile	\
202	libsff		\
203	libshare	\
204	libshell	\
205	libsip		\
206	libsldap	\
207	libslp		\
208	libsmbfs	\
209	libsmbios	\
210	libsmedia	\
211	libsqlite	\
212	libsrpt		\
213	libstmf		\
214	libstmfproxy	\
215	libsum		\
216	libsun_ima	\
217	libsys		\
218	libsysevent	\
219	libtecla	\
220	libtermcap	\
221	libthread	\
222	libtnf		\
223	libtnfctl	\
224	libtnfprobe	\
225	libtsnet	\
226	libtsol		\
227	libumem		\
228	libunistat	\
229	libuuid		\
230	libuutil	\
231	libvolmgt	\
232	libvrrpadm	\
233	libvscan	\
234	libw		\
235	libwanboot	\
236	libwanbootutil	\
237	libwrap		\
238	libxcurses	\
239	libxcurses2	\
240	libxnet		\
241	libzfs		\
242	libzfs_core	\
243	libzfs_jni	\
244	libzonecfg	\
245	libzoneinfo	\
246	libzonestat	\
247	libzpool	\
248	madv		\
249	mpapi		\
250	mpss		\
251	nametoaddr	\
252	ncad_addr	\
253	nsswitch	\
254	pam_modules	\
255	passwdutil	\
256	pkcs11		\
257	policykit	\
258	print		\
259	pylibbe		\
260	pysolaris	\
261	pyzfs		\
262	raidcfg_plugins	\
263	rpcsec_gss	\
264	sasl_plugins	\
265	scsi		\
266	smbsrv		\
267	smhba		\
268	sun_fc		\
269	sun_sas		\
270	udapl		\
271	watchmalloc	\
272	$($(MACH)_SUBDIRS)
273
274i386_SUBDIRS=		\
275	libfdisk	\
276	libsaveargs
277
278sparc_SUBDIRS=		\
279	efcode		\
280	libds		\
281	libdscp		\
282	libprtdiag	\
283	libprtdiag_psr	\
284	libpri		\
285	librsc		\
286	storage		\
287	libpcp		\
288	libtsalarm	\
289	libv12n
290
291#
292# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
293# clean and clobber targets (for more information, see those targets, below).
294#
295NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
296
297DCSUBDIRS=
298
299MSGSUBDIRS=		\
300	abi		\
301	auditd_plugins	\
302	brand		\
303	cfgadm_plugins	\
304	gss_mechs/mech_dh	\
305	gss_mechs/mech_krb5	\
306	krb5		\
307	libast		\
308	libbsm		\
309	libc		\
310	libcfgadm	\
311	libcmd		\
312	libcontract	\
313	libcurses	\
314	libdhcputil	\
315	libdiskmgt	\
316	libdladm	\
317	libdll		\
318	libgrubmgmt	\
319	libgss		\
320	libidmap	\
321	libilb		\
322	libinetutil	\
323	libinstzones	\
324	libipadm	\
325	libipmp		\
326	libipsecutil	\
327	libldap5	\
328	libnsl		\
329	libnwam		\
330	libpam		\
331	libpicl		\
332	libpkg		\
333	libpool		\
334	libpp		\
335	libreparse	\
336	libsasl		\
337	libscf		\
338	libsecdb	\
339	libshare	\
340	libshell	\
341	libsldap	\
342	libslp		\
343	libsmbfs	\
344	libsmedia	\
345	libsum		\
346	libtsol		\
347	libuutil	\
348	libvrrpadm	\
349	libvscan	\
350	libwanboot	\
351	libwanbootutil	\
352	libzfs		\
353	libzonecfg	\
354	madv		\
355	mpss		\
356	pam_modules	\
357	pyzfs		\
358	rpcsec_gss	\
359	$($(MACH)_MSGSUBDIRS)
360
361sparc_MSGSUBDIRS=	\
362	libprtdiag	\
363	libprtdiag_psr
364
365i386_MSGSUBDIRS= libfdisk
366
367HDRSUBDIRS=				\
368	../cmd/sendmail/libmilter	\
369	auditd_plugins	\
370	fm		\
371	hal		\
372	hbaapi		\
373	libads		\
374	libast		\
375	libbrand	\
376	libbsm		\
377	libc		\
378	libcmd		\
379	libcmdutils	\
380	libcommputil	\
381	libcontract	\
382	libcpc		\
383	libcryptoutil	\
384	libctf		\
385	libcurses	\
386	libcustr	\
387	libdevice	\
388	libdevid	\
389	libdevinfo	\
390	libdhcpagent	\
391	libdhcputil	\
392	libdisasm	\
393	libdiskmgt	\
394	libdwarf	\
395	libdladm	\
396	libdll		\
397	libdlpi		\
398	libdns_sd	\
399	libdscfg	\
400	libdtrace	\
401	libdtrace_jni	\
402	libelfsign	\
403	libeti		\
404	libfakekernel	\
405	libfcoe		\
406	libfru		\
407	libfstyp	\
408	libgen		\
409	libgrubmgmt	\
410	libidmap	\
411	libilb		\
412	libima		\
413	libinetsvc	\
414	libinetutil	\
415	libinstzones	\
416	libipadm	\
417	libipd		\
418	libipmi		\
419	libipmp		\
420	libipp		\
421	libipsecutil	\
422	libiscsit	\
423	libkrb5		\
424	libkstat	\
425	libkvm		\
426	libmail		\
427	libmapid	\
428	libmd		\
429	libmtmalloc	\
430	libndmp		\
431	libnsctl	\
432	libnsl		\
433	libnvpair	\
434	libnwam		\
435	libpam		\
436	libpcidb	\
437	libpctx		\
438	libpicl		\
439	libpicltree	\
440	libpool		\
441	libpp		\
442	libproc		\
443	libraidcfg	\
444	librcm		\
445	librdc		\
446	libreparse	\
447	librestart	\
448	librpcsvc	\
449	librsm		\
450	librstp		\
451	libsasl		\
452	libscf		\
453	libsec		\
454	libsff		\
455	libshare	\
456	libshell	\
457	libsip		\
458	libslp		\
459	libsmbfs	\
460	libsmbios	\
461	libsmedia	\
462	libsocket	\
463	libsqlite	\
464	libsrpt		\
465	libstmf		\
466	libstmfproxy	\
467	libsum		\
468	libsun_ima	\
469	libsysevent	\
470	libtecla	\
471	libtermcap	\
472	libtnf		\
473	libtnfctl	\
474	libtnfprobe	\
475	libtsnet	\
476	libtsol		\
477	libumem		\
478	libunistat	\
479	libuutil	\
480	libvolmgt	\
481	libvrrpadm	\
482	libvscan	\
483	libwanboot	\
484	libwanbootutil	\
485	libwrap		\
486	libxcurses2	\
487	libzfs		\
488	libzfs_core	\
489	libzfs_jni	\
490	libzoneinfo	\
491	libzonestat	\
492	mpapi		\
493	passwdutil	\
494	pkcs11		\
495	policykit	\
496	scsi		\
497	smbsrv		\
498	smhba		\
499	udapl		\
500	$($(MACH)_HDRSUBDIRS)
501
502i386_HDRSUBDIRS=	\
503	libfdisk	\
504	libsaveargs
505
506sparc_HDRSUBDIRS=	\
507	libds		\
508	libdscp		\
509	libpri		\
510	libv12n		\
511	storage
512
513all :=		TARGET= all
514check :=	TARGET= check
515clean :=	TARGET= clean
516clobber :=	TARGET= clobber
517install :=	TARGET= install
518install_h :=	TARGET= install_h
519lint :=		TARGET= lint
520_dc :=		TARGET= _dc
521_msg :=		TARGET= _msg
522
523.KEEP_STATE:
524
525#
526# For the all and install targets, we clearly must respect library
527# dependencies so that the libraries link correctly.  However, for
528# the remaining targets (check, clean, clobber, install_h, lint, _dc
529# and _msg), libraries do not have any dependencies on one another
530# and thus respecting dependencies just slows down the build.
531# As such, for these rules, we use pattern replacement to explicitly
532# avoid triggering the dependency information.  Note that for clean,
533# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
534# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
535#
536
537all:			$(SUBDIRS)
538
539install:		$(SUBDIRS) .WAIT install_extra
540
541# extra libraries kept in other source areas
542install_extra:
543	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
544	@pwd
545
546clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
547
548install_h check:	$(HDRSUBDIRS:%=%-nodepend)
549
550_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
551
552_dc:			$(DCSUBDIRS:%=%-nodepend)
553
554# Library interdependencies are called out explicitly here.
555../cmd/sgs/libconv: crt
556../cmd/sgs/libdl: crt
557libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
558
559libm:		libc
560libmd:		libc
561libmp:		libc
562libnsl:		libc libmd libmp
563libnvpair:	libc libnsl
564libsocket:	libc libnsl
565
566basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
567basedeps :=	TARGET=install
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
583krb5:		gss_mechs/mech_krb5 libtecla libldap5
584libadt_jni:	libbsm
585libadutils: 	libldap5 libresolv2
586libbe: 		libzfs libinstzones libuuid libgen libdevinfo libefi
587libbsm:		libinetutil libscf libsecdb libtsol
588libcfgadm:	libdevinfo
589libcmd: 	libsum libast
590libcmdutils:	libavl
591libcpc:		libpctx
592libcrypt:	libgen
593libctf:		libdwarf
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:	libsecdb
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 libads 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