xref: /illumos-gate/usr/src/lib/Makefile (revision faac71c002f7c7a98741f991b25937b24f309df0)
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# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
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
28include ../Makefile.master
29
30#	Note that libcurses installs commands along with its library.
31#	This is a minor bug which probably should be fixed.
32#	Note also that a few extra libraries are kept in cmd source.
33#
34# Certain libraries are linked with, hence depend on, other libraries.
35#
36# Although we have historically used .WAIT to express dependencies, it
37# reduces the amount of parallelism and thus lengthens the time it
38# takes to build the libraries.  Thus, we now require that any new
39# libraries explicitly call out their dependencies.  Eventually, all
40# the library dependencies will be called out explicitly.  See
41# "Library interdependencies" near the end of this file.
42#
43# Aside from explicit dependencies (and legacy .WAITs), all libraries
44# are built in parallel.
45#
46.PARALLEL:
47
48SUBDIRS= \
49	common			.WAIT	\
50	../cmd/sgs/libconv		\
51	../cmd/sgs/libdl	.WAIT
52
53SUBDIRS += \
54	libc			.WAIT	\
55	../cmd/sgs/libelf	.WAIT	\
56	c_synonyms			\
57	libmd				\
58	libmd5				\
59	librsm				\
60	libmp			.WAIT	\
61	libnsl			\
62	libsecdb		.WAIT	\
63	librpcsvc			\
64	libsocket		.WAIT	\
65	libsctp			\
66	libsip			\
67	libcommputil		\
68	libresolv			\
69	libresolv2		.WAIT	\
70	libw			.WAIT	\
71	libintl			.WAIT	\
72	../cmd/sgs/librtld_db	\
73	libaio			\
74	libast			\
75	libdll			\
76	libcmd			\
77	libshell		\
78	libsum			\
79	librt			\
80	libadm			\
81	libctf			\
82	libdtrace		\
83	libdtrace_jni		\
84	libcurses		\
85	libtermcap		\
86	libgen			\
87	libgss			\
88	libpam			\
89	libuuid			\
90	libthread		\
91	libpthread	.WAIT	\
92	libslp		\
93	libbsdmalloc	\
94	libdoor		\
95	libdevinfo	\
96	libdladm	\
97	libdlpi		\
98	libeti		\
99	libcrypt	\
100	libdns_sd	\
101	libefi		\
102	libfstyp	\
103	libwanboot	\
104	libwanbootutil	\
105	libcryptoutil	\
106	libinetutil	\
107	libipadm	\
108	libipd		\
109	libipmp		\
110	libiscsit	\
111	libkmf		\
112	libkstat	\
113	libkvm		\
114	liblm		\
115	libmalloc	\
116	libmapmalloc	\
117	libmtmalloc	\
118	libnls		\
119	libnwam		\
120	libsmbios	\
121	libtecla	\
122	libumem		\
123	libnvpair	.WAIT	\
124	libexacct	\
125	libsasl		\
126	libldap5	\
127	libsldap	.WAIT	\
128	libbsm		\
129	libsys		\
130	libsysevent	\
131	libnisdb	\
132	libpool		\
133	libpp		\
134	libproc		\
135	libproject	\
136	libsendfile	\
137	nametoaddr	\
138	ncad_addr	\
139	hbaapi		\
140	smhba		\
141	sun_fc		\
142	sun_sas		\
143	gss_mechs/mech_krb5	.WAIT	\
144	libkrb5	.WAIT	\
145	krb5	.WAIT	\
146	libsmbfs	\
147	libfcoe		\
148	libsrpt		\
149	libstmf		\
150	libstmfproxy	\
151	libnsctl	\
152	libunistat	\
153	libdscfg	\
154	librdc		\
155	libinstzones	\
156	libpkg		\
157	libpcidb
158
159SUBDIRS += \
160	passwdutil	\
161	pam_modules	\
162	crypt_modules	\
163	libadt_jni	\
164	abi		\
165	auditd_plugins	\
166	libvolmgt	\
167	libdevice	\
168	libdevid	\
169	libdhcpsvc	\
170	libc_db		\
171	libndmp		\
172	libsec		\
173	libtnfprobe	\
174	libtnf		\
175	libtnfctl	\
176	libdhcpagent	\
177	libdhcpdu	\
178	libdhcputil	\
179	libxnet		\
180	libipsecutil	\
181	nsswitch	\
182	print		\
183	libuutil	\
184	libscf		\
185	libinetsvc	\
186	librestart	\
187	libsched	\
188	libelfsign	\
189	pkcs11		.WAIT	\
190	libpctx		.WAIT	\
191	libcpc		\
192	getloginx	\
193	watchmalloc	\
194	extendedFILE	\
195	madv		\
196	mpss		\
197	libdisasm	\
198	libwrap		\
199	libxcurses	\
200	libxcurses2	\
201	libbrand	.WAIT   \
202	libzonecfg	\
203	libzoneinfo	\
204	libzonestat	\
205	libtsnet	\
206	libtsol		\
207	gss_mechs/mech_spnego	\
208	gss_mechs/mech_dummy	\
209	gss_mechs/mech_dh	\
210	rpcsec_gss	\
211	libraidcfg	.WAIT	\
212	librcm		.WAIT	\
213	libcfgadm	.WAIT	\
214	libpicl		.WAIT	\
215	libpicltree	.WAIT \
216	raidcfg_plugins	\
217	cfgadm_plugins	\
218	libmail		\
219	lvm		\
220	libsmedia	\
221	libipp		\
222	libdiskmgt	\
223	liblgrp		\
224	libfsmgt	\
225	fm		\
226	libavl		\
227	libcmdutils	\
228	libcontract	\
229	../cmd/sendmail/libmilter	\
230	sasl_plugins	\
231	udapl		\
232	libzpool	\
233	libzfs_core	\
234	libzfs		\
235	libbe		\
236	pylibbe		\
237	libzfs_jni	\
238	pyzfs		\
239	pysolaris	\
240	libmapid	\
241	brand		\
242	policykit	\
243	hal		\
244	libshare	\
245	libsqlite	\
246	libidmap	\
247	libadutils	\
248	libipmi		\
249	libexacct/demo	\
250	libvrrpadm	\
251	libvscan	\
252	libgrubmgmt	\
253	smbsrv		\
254	libilb		\
255	scsi		\
256	libima		\
257	libsun_ima	\
258	mpapi		\
259	librstp		\
260	libreparse	\
261	libhotplug	\
262	libfruutils	.WAIT	\
263	libfru		\
264	$($(MACH)_SUBDIRS)
265
266i386_SUBDIRS=		\
267	libntfs		\
268	libparted	\
269	libfdisk	\
270	libsaveargs
271
272sparc_SUBDIRS= .WAIT	\
273	efcode		\
274	libds		\
275	libdscp		\
276	libprtdiag	.WAIT	\
277	libprtdiag_psr	\
278	libpri		\
279	librsc		\
280	storage		\
281	libpcp		\
282	libtsalarm	\
283	libv12n
284
285FM_sparc_DEPLIBS= libpri
286
287fm:			\
288	libexacct	\
289	libipmi		\
290	libzfs		\
291	scsi		\
292	$(FM_$(MACH)_DEPLIBS)
293
294#
295# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
296# clean and clobber targets (for more information, see those targets, below).
297#
298NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
299
300DCSUBDIRS =		\
301	lvm
302
303MSGSUBDIRS=		\
304	abi		\
305	auditd_plugins	\
306	brand		\
307	cfgadm_plugins	\
308	gss_mechs/mech_dh	\
309	gss_mechs/mech_krb5	\
310	krb5		\
311	libast		\
312	libbsm		\
313	libc		\
314	libcfgadm	\
315	libcmd		\
316	libcontract	\
317	libcurses	\
318	libdhcpsvc 	\
319	libdhcputil	\
320	libipsecutil	\
321	libdiskmgt	\
322	libdladm	\
323	libdll		\
324	libgrubmgmt	\
325	libgss		\
326	libidmap	\
327	libipmp		\
328	libilb		\
329	libinetutil	\
330	libinstzones	\
331	libipadm	\
332	libnsl		\
333	libnwam		\
334	libpam		\
335	libpicl		\
336	libpool		\
337	libpkg		\
338	libpp		\
339	libscf		\
340	libsasl		\
341	libldap5	\
342	libsecdb	\
343	libshare	\
344	libshell	\
345	libsldap	\
346	libslp		\
347	libsmbfs	\
348	libsmedia	\
349	libsum		\
350	libtsol		\
351	libuutil	\
352	libvrrpadm	\
353	libvscan	\
354	libwanboot	\
355	libwanbootutil	\
356	libzfs		\
357	libzonecfg	\
358	lvm		\
359	madv		\
360	mpss		\
361	pam_modules	\
362	pyzfs		\
363	pysolaris	\
364	rpcsec_gss	\
365	libreparse
366MSGSUBDIRS += \
367	$($(MACH)_MSGSUBDIRS)
368
369sparc_MSGSUBDIRS=	\
370	libprtdiag	\
371	libprtdiag_psr
372
373i386_MSGSUBDIRS= libfdisk
374
375HDRSUBDIRS=		\
376	auditd_plugins	\
377	libast		\
378	libbrand	\
379	libbsm		\
380	libc		\
381	libcmd		\
382	libcmdutils	\
383	libcommputil	\
384	libcontract	\
385	libcpc		\
386	libctf		\
387	libcurses	\
388	libtermcap	\
389	libcryptoutil	\
390	libdevice	\
391	libdevid	\
392	libdevinfo	\
393	libdiskmgt	\
394	libdladm	\
395	libdll		\
396	libdlpi		\
397	libdhcpagent	\
398	libdhcpsvc	\
399	libdhcputil	\
400	libdisasm	\
401	libdns_sd	\
402	libdscfg	\
403	libdtrace	\
404	libdtrace_jni	\
405	libelfsign	\
406	libeti		\
407	libfru		\
408	libfstyp	\
409	libgen		\
410	libipadm	\
411	libipd		\
412	libipsecutil	\
413	libinetsvc	\
414	libinetutil	\
415	libinstzones	\
416	libipmi		\
417	libipmp		\
418	libipp		\
419	libiscsit	\
420	libkstat	\
421	libkvm		\
422	libmail		\
423	libmd		\
424	libmtmalloc	\
425	libndmp		\
426	libnvpair	\
427	libnsctl	\
428	libnsl		\
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	libscf		\
442	libsip		\
443	libsmbios	\
444	librestart	\
445	librpcsvc	\
446	librsm		\
447	librstp		\
448	libsasl		\
449	libsec		\
450	libshell	\
451	libslp		\
452	libsmedia	\
453	libsocket	\
454	libsqlite	\
455	libfcoe		\
456	libsrpt		\
457	libstmf		\
458	libstmfproxy	\
459	libsum		\
460	libsysevent	\
461	libtecla	\
462	libtnf		\
463	libtnfctl	\
464	libtnfprobe	\
465	libtsnet	\
466	libtsol		\
467	libvrrpadm	\
468	libvolmgt	\
469	libumem		\
470	libunistat	\
471	libuutil	\
472	libwanboot	\
473	libwanbootutil	\
474	libwrap		\
475	libxcurses2	\
476	libzfs		\
477	libzfs_core	\
478	libzfs_jni	\
479	libzoneinfo	\
480	libzonestat	\
481	hal		\
482	policykit	\
483	lvm		\
484	pkcs11		\
485	passwdutil	\
486	../cmd/sendmail/libmilter	\
487	fm		\
488	udapl		\
489	libmapid	\
490	libkrb5		\
491	libsmbfs	\
492	libshare	\
493	libidmap	\
494	libvscan	\
495	libgrubmgmt	\
496	smbsrv		\
497	libilb		\
498	scsi		\
499	hbaapi		\
500	smhba		\
501	libima		\
502	libsun_ima	\
503	mpapi		\
504	libreparse	\
505	$($(MACH)_HDRSUBDIRS)
506
507i386_HDRSUBDIRS=	\
508	libparted	\
509	libfdisk	\
510	libsaveargs
511
512sparc_HDRSUBDIRS=	\
513	libds		\
514	libdscp		\
515	libpri		\
516	libv12n		\
517	storage
518
519all :=		TARGET= all
520check :=	TARGET= check
521clean :=	TARGET= clean
522clobber :=	TARGET= clobber
523install :=	TARGET= install
524install_h :=	TARGET= install_h
525lint :=		TARGET= lint
526_dc :=		TARGET= _dc
527_msg :=		TARGET= _msg
528
529.KEEP_STATE:
530
531#
532# For the all and install targets, we clearly must respect library
533# dependencies so that the libraries link correctly.  However, for
534# the remaining targets (check, clean, clobber, install_h, lint, _dc
535# and _msg), libraries do not have any dependencies on one another
536# and thus respecting dependencies just slows down the build.
537# As such, for these rules, we use pattern replacement to explicitly
538# avoid triggering the dependency information.  Note that for clean,
539# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
540# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
541#
542
543all:			$(SUBDIRS)
544
545install:		$(SUBDIRS) .WAIT install_extra
546
547# extra libraries kept in other source areas
548install_extra:
549	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
550	@pwd
551
552clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
553
554install_h check:	$(HDRSUBDIRS:%=%-nodepend)
555
556_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
557
558_dc:			$(DCSUBDIRS:%=%-nodepend)
559
560#
561# Library interdependencies are called out explicitly here
562#
563auditd_plugins: libbsm libnsl libsecdb
564gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
565libadt_jni:	libbsm
566libast: 	libsocket
567libadutils: 	libldap5 libresolv libsocket libnsl
568nsswitch:	libadutils libidmap
569libbe: 		libzfs
570libbsm:		libtsol
571libcmd: 	libsum libast libsocket libnsl
572libcmdutils:	libavl
573libcontract:	libnvpair
574libdevid:	libdevinfo
575libdevinfo:	libnvpair libsec
576libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
577libdhcpsvc:	libinetutil
578libdhcputil:	libnsl libgen libinetutil libdlpi
579libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
580		libexacct libnsl libkstat libcurses
581libdll: 	libast
582libdlpi:	libinetutil libdladm
583libds:		libsysevent
584libdscfg:	libnsctl libunistat libsocket libnsl
585libdtrace:	libproc libgen libctf
586libdtrace_jni:	libuutil libdtrace
587libefi:		libuuid
588libfstyp:	libnvpair
589libelfsign:	libcryptoutil libkmf
590libidmap:	libadutils libldap5 libavl libsldap libuutil
591libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
592		libdladm libsecdb
593libiscsit:	libc libnvpair libstmf libuuid libnsl
594libkmf:		libcryptoutil pkcs11
595libnsl:		libmd5
596libmapid:	libresolv
597librdc:		libsocket libnsl libnsctl libunistat libdscfg
598libuuid:	libdlpi
599libinetutil:	libsocket
600libipsecutil:	libtecla libsocket
601libinstzones:	libzonecfg libcontract
602libpkg:		libwanboot libscf libadm
603libnwam:	libscf
604libsecdb:	libnsl
605libsasl:	libgss libsocket pkcs11 libmd
606sasl_plugins:	pkcs11 libgss libsocket libsasl
607libsctp:	libsocket
608libshell:	libast libcmd libdll libsocket libsecdb
609libsip:		libmd5
610libsmbfs:	libcmdutils libsocket libnsl libkrb5
611libsocket:	libnsl
612libstmfproxy: 	libstmf libsocket libnsl libpthread
613libsum: 	libast
614libsysevent:	libsecdb
615libldap5:	libsasl libsocket libnsl libmd
616libsldap:	libldap5 libtsol libnsl libc libscf libresolv
617libpool:	libnvpair libexacct
618libpp:		libast
619libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
620		libbrand libpool libscf
621libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
622libproject:	libpool libproc libsecdb
623libtermcap:	libcurses
624libtsnet:	libnsl libtsol libsecdb
625libwrap:	libnsl libsocket
626libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
627		libdhcputil
628libwanbootutil:	libnsl
629pam_modules:	libproject passwdutil smbsrv
630libscf:		libuutil libmd libgen libsmbios libnsl
631libinetsvc:	libscf
632librestart:	libuutil libscf
633libsaveargs:	libdisasm
634../cmd/sgs/libdl:	../cmd/sgs/libconv
635../cmd/sgs/libelf:	../cmd/sgs/libconv
636pkcs11:		libcryptoutil
637print:		libldap5
638udapl/udapl_tavor:	udapl/libdat
639libzfs:		libdevid libgen libnvpair libuutil \
640		libadm libavl libefi libidmap libmd libzfs_core
641libzfs_core:	libnvpair
642libzfs_jni:	libdiskmgt libnvpair libzfs
643libzpool:	libavl libumem libnvpair libcmdutils
644libsec:		libavl libidmap
645brand:		libc libsocket
646libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
647libexacct/demo:	libexacct libproject libsocket libnsl
648libtsalarm:	libpcp
649smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
650		libshare libidmap pkcs11 libsqlite libcryptoutil \
651		libreparse libcmdutils
652libv12n:	libds libuuid
653libvrrpadm:	libsocket libdladm libscf
654libvscan:	libscf
655libfru:		libfruutils
656scsi:		libnvpair libfru
657mpapi:		libpthread libdevinfo libsysevent libnvpair
658sun_fc:		libdevinfo libsysevent libnvpair
659libsun_ima:	libdevinfo libsysevent libnsl
660sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
661libgrubmgmt:	libdevinfo libzfs libfstyp
662pylibbe: 	libbe libzfs
663pyzfs:		libnvpair libzfs
664pysolaris:	libsec libidmap
665libreparse:	libnvpair
666libhotplug:	libnvpair
667cfgadm_plugins:	libhotplug
668libilb:		libsocket
669$(INTEL_BUILD)libdiskmgt:libfdisk
670
671#
672# The reason this rule checks for the existence of the
673# Makefile is that some of the directories do not exist
674# in certain situations (e.g., exportable source builds,
675# OpenSolaris).
676#
677$(SUBDIRS): FRC
678	@if [ -f $@/Makefile  ]; then \
679		cd $@; pwd; $(MAKE) $(TARGET); \
680	else \
681		true; \
682	fi
683
684$(SUBDIRS:%=%-nodepend):
685	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
686		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
687	else \
688		true; \
689	fi
690
691FRC:
692