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