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