xref: /illumos-gate/usr/src/lib/Makefile (revision d0fccfcda73f8b52d101bd2b0f7885a766f7e354)
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
25include ../Makefile.master
26
27#	Note that libcurses installs commands along with its library.
28#	This is a minor bug which probably should be fixed.
29#	Note also that a few extra libraries are kept in cmd source.
30#
31# Certain libraries are linked with, hence depend on, other libraries.
32#
33# Although we have historically used .WAIT to express dependencies, it
34# reduces the amount of parallelism and thus lengthens the time it
35# takes to build the libraries.  Thus, we now require that any new
36# libraries explicitly call out their dependencies.  Eventually, all
37# the library dependencies will be called out explicitly.  See
38# "Library interdependencies" near the end of this file.
39#
40# Aside from explicit dependencies (and legacy .WAITs), all libraries
41# are built in parallel.
42#
43.PARALLEL:
44
45#
46# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
47# but required due to the "dependencies" of using .WAIT to barrier the
48# parallel dmake builds.  once 4631488 has been fixed, they can be
49# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
50# shown in HDRSUBDIRS
51#
52SUBDIRS= \
53	common			.WAIT	\
54	../cmd/sgs/libconv		\
55	../cmd/sgs/libdl	.WAIT
56
57SUBDIRS += \
58	libc			.WAIT	\
59	../cmd/sgs/libelf	.WAIT	\
60	c_synonyms			\
61	libmd				\
62	libmd5				\
63	librsm				\
64	libmp			.WAIT	\
65	libnsl			\
66	libsecdb		.WAIT	\
67	librpcsvc			\
68	libsocket		.WAIT	\
69	libsctp			\
70	libsip			\
71	libcommputil		\
72	libresolv			\
73	libresolv2		.WAIT	\
74	libw			.WAIT	\
75	libintl			.WAIT	\
76	../cmd/sgs/librtld_db	\
77	libaio			\
78	libast			\
79	libdll			\
80	libcmd			\
81	libshell		\
82	libsum			\
83	librt			\
84	libadm			\
85	libctf			\
86	libdtrace		\
87	libdtrace_jni		\
88	libcurses		\
89	libtermcap		\
90	libgen			\
91	libgss			\
92	libpam			\
93	libuuid			\
94	libthread		\
95	libpthread	.WAIT	\
96	libslp		\
97	libbsdmalloc	\
98	libdoor		\
99	libdevinfo	\
100	libdladm	\
101	libdlpi		\
102	libeti		\
103	libcrypt	\
104	libdns_sd	\
105	libefi		\
106	libfstyp	\
107	libwanboot	\
108	libwanbootutil	\
109	libcryptoutil	\
110	libinetutil	\
111	libipadm	\
112	libipmp		\
113	libiscsit	\
114	libkmf		\
115	libkmsagent	\
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	libldap4	\
130	libsasl		\
131	libldap5	\
132	libsldap	.WAIT	\
133	libbsm		\
134	libsys		\
135	libsysevent	\
136	libnisdb	\
137	libpool		\
138	libpp		\
139	libproc		\
140	libproject	\
141	libsendfile	\
142	nametoaddr	\
143	ncad_addr	\
144	hbaapi		\
145	smhba		\
146	sun_fc		\
147	sun_sas		\
148	gss_mechs/mech_krb5	.WAIT	\
149	libkrb5	.WAIT	\
150	krb5	.WAIT	\
151	libsmbfs	\
152	libfcoe		\
153	libsrpt		\
154	libstmf		\
155	libstmfproxy	\
156	libnsctl	\
157	libunistat	\
158	libdscfg	\
159	librdc		\
160	libinstzones	\
161	libpkg
162
163SUBDIRS += \
164	passwdutil	\
165	pam_modules	\
166	crypt_modules	\
167	libadt_jni	\
168	abi		\
169	auditd_plugins	\
170	libvolmgt	\
171	libdevice	\
172	libdevid	\
173	libdhcpsvc	\
174	libc_db		\
175	libndmp		\
176	libsec		\
177	libtnfprobe	\
178	libtnf		\
179	libtnfctl	\
180	libdhcpagent	\
181	libdhcpdu	\
182	libdhcputil	\
183	libxnet		\
184	libipsecutil
185$(CLOSED_BUILD)SUBDIRS += \
186	$(CLOSED)/lib/libike
187SUBDIRS += \
188	nsswitch	\
189	print		\
190	libuutil	\
191	libscf		\
192	libinetsvc	\
193	librestart	\
194	libsched	\
195	libelfsign	\
196	pkcs11		.WAIT	\
197	libpctx		.WAIT	\
198	libcpc		\
199	watchmalloc	\
200	extendedFILE	\
201	madv		\
202	mpss		\
203	libdisasm	\
204	libwrap		\
205	libxcurses	\
206	libxcurses2	\
207	libbrand	.WAIT   \
208	libzonecfg	\
209	libzoneinfo	\
210	libzonestat	\
211	libtsnet	\
212	libtsol		\
213	gss_mechs/mech_spnego	\
214	gss_mechs/mech_dummy	\
215	gss_mechs/mech_dh	\
216	rpcsec_gss	\
217	libraidcfg	.WAIT	\
218	librcm		.WAIT	\
219	libcfgadm	.WAIT	\
220	libpicl		.WAIT	\
221	libpicltree	.WAIT \
222	raidcfg_plugins	\
223	cfgadm_plugins	\
224	libmail		\
225	lvm		\
226	libsmedia	\
227	libipp		\
228	libdiskmgt	\
229	liblgrp		\
230	libfsmgt	\
231	fm		\
232	libavl		\
233	libcmdutils	\
234	libcontract	\
235	../cmd/sendmail/libmilter	\
236	sasl_plugins	\
237	udapl		\
238	libzpool	\
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_jni	\
480	libzoneinfo	\
481	libzonestat	\
482	hal		\
483	policykit	\
484	lvm		\
485	pkcs11		\
486	passwdutil	\
487	../cmd/sendmail/libmilter	\
488	fm		\
489	udapl		\
490	libmapid	\
491	libkrb5		\
492	libsmbfs	\
493	libshare	\
494	libidmap	\
495	libvscan	\
496	libgrubmgmt	\
497	smbsrv		\
498	libilb		\
499	scsi		\
500	hbaapi		\
501	smhba		\
502	libima		\
503	libsun_ima	\
504	mpapi		\
505	libreparse	\
506	$($(MACH)_HDRSUBDIRS)
507
508$(CLOSED_BUILD)HDRSUBDIRS += \
509	$(CLOSED)/lib/libike
510
511i386_HDRSUBDIRS=	\
512	libparted	\
513	libfdisk
514
515sparc_HDRSUBDIRS=	\
516	libds		\
517	libdscp		\
518	libpri		\
519	libv12n		\
520	storage
521
522all :=		TARGET= all
523check :=	TARGET= check
524clean :=	TARGET= clean
525clobber :=	TARGET= clobber
526install :=	TARGET= install
527install_h :=	TARGET= install_h
528lint :=		TARGET= lint
529_dc :=		TARGET= _dc
530_msg :=		TARGET= _msg
531
532.KEEP_STATE:
533
534#
535# For the all and install targets, we clearly must respect library
536# dependencies so that the libraries link correctly.  However, for
537# the remaining targets (check, clean, clobber, install_h, lint, _dc
538# and _msg), libraries do not have any dependencies on one another
539# and thus respecting dependencies just slows down the build.
540# As such, for these rules, we use pattern replacement to explicitly
541# avoid triggering the dependency information.  Note that for clean,
542# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
543# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
544#
545
546all:			$(SUBDIRS)
547
548install:		$(SUBDIRS) .WAIT install_extra
549
550# extra libraries kept in other source areas
551install_extra:
552	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
553	@pwd
554
555clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
556
557install_h check:	$(HDRSUBDIRS:%=%-nodepend)
558
559_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
560
561_dc:			$(DCSUBDIRS:%=%-nodepend)
562
563#
564# Library interdependencies are called out explicitly here
565#
566auditd_plugins: libbsm libnsl libsecdb
567gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
568libadt_jni:	libbsm
569libast: 	libsocket
570libadutils: 	libldap5 libresolv libsocket libnsl
571nsswitch:	libadutils libidmap
572libbe: 		libzfs
573libbsm:		libtsol
574libcmd: 	libsum libast libsocket libnsl
575libcmdutils:	libavl
576libcontract:	libnvpair
577libdevid:	libdevinfo
578libdevinfo:	libnvpair libsec
579libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
580libdhcpsvc:	libinetutil
581libdhcputil:	libnsl libgen libinetutil libdlpi
582libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
583		libexacct libnsl libkstat libcurses
584libdll: 	libast
585libdlpi:	libinetutil libdladm
586libds:		libsysevent
587libdscfg:	libnsctl libunistat libsocket libnsl
588libdtrace:	libproc libgen libctf
589libdtrace_jni:	libuutil libdtrace
590libefi:		libuuid
591libfstyp:	libnvpair
592libelfsign:	libcryptoutil libkmf
593libidmap:	libadutils libldap5 libavl libsldap libuutil
594libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
595		libdladm libsecdb
596libiscsit:	libc libnvpair libstmf libuuid libnsl
597libkmf:		libcryptoutil pkcs11
598libnsl:		libmd5
599libmapid:	libresolv
600librdc:		libsocket libnsl libnsctl libunistat libdscfg
601libuuid:	libdlpi
602$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
603libinetutil:	libsocket
604libipsecutil:	libtecla libsocket
605libinstzones:	libzonecfg libcontract
606libpkg:		libwanboot libscf libadm
607libnwam:	libscf
608libsecdb:	libnsl
609libsasl:	libgss libsocket pkcs11 libmd
610sasl_plugins:	pkcs11 libgss libsocket libsasl
611libsctp:	libsocket
612libshell:	libast libcmd libdll libsocket libsecdb
613libsip:		libmd5
614libsmbfs:	libcmdutils libsocket libnsl libkrb5
615libsocket:	libnsl
616libstmfproxy: 	libstmf libsocket libnsl libpthread
617libsum: 	libast
618libsysevent:	libsecdb
619libldap5:	libsasl libsocket libnsl libmd
620libsldap:	libldap5 libtsol libnsl libc libscf libresolv
621libpool:	libnvpair libexacct
622libpp:		libast
623libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
624		libbrand libpool libscf
625libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
626libproject:	libpool libproc libsecdb
627libtermcap:	libcurses
628libtsnet:	libnsl libtsol libsecdb
629libwrap:	libnsl libsocket
630libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
631		libdhcputil
632libwanbootutil:	libnsl
633pam_modules:	libproject passwdutil smbsrv
634libscf:		libuutil libmd libgen libsmbios libnsl
635libinetsvc:	libscf
636librestart:	libuutil libscf
637../cmd/sgs/libdl:	../cmd/sgs/libconv
638../cmd/sgs/libelf:	../cmd/sgs/libconv
639pkcs11:		libcryptoutil libkmsagent
640print:		libldap5
641udapl/udapl_tavor:	udapl/libdat
642libzfs:		libdevid libgen libnvpair libuutil \
643		libadm libavl libefi libidmap libmd
644libzfs_jni:	libdiskmgt libnvpair libzfs
645libzpool:	libavl libumem libnvpair libcmdutils
646libsec:		libavl libidmap
647brand:		libc libsocket
648libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
649libexacct/demo:	libexacct libproject libsocket libnsl
650libtsalarm:	libpcp
651smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
652		libshare libidmap pkcs11 libsqlite libcryptoutil \
653		libreparse libcmdutils
654libv12n:	libds libuuid
655libvrrpadm:	libsocket libdladm libscf
656libvscan:	libscf
657libfru:		libfruutils
658scsi:		libnvpair libfru
659mpapi:		libpthread libdevinfo libsysevent libnvpair
660sun_fc:		libdevinfo libsysevent libnvpair
661libsun_ima:	libdevinfo libsysevent libnsl
662sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
663libgrubmgmt:	libdevinfo libzfs libfstyp
664pylibbe: 	libbe libzfs
665pyzfs:		libnvpair libzfs
666pysolaris:	libsec libidmap
667libreparse:	libnvpair
668libhotplug:	libnvpair
669cfgadm_plugins:	libhotplug
670libilb:		libsocket
671$(INTEL_BUILD)libdiskmgt:libfdisk
672
673#
674# The reason this rule checks for the existence of the
675# Makefile is that some of the directories do not exist
676# in certain situations (e.g., exportable source builds,
677# OpenSolaris).
678#
679$(SUBDIRS): FRC
680	@if [ -f $@/Makefile  ]; then \
681		cd $@; pwd; $(MAKE) $(TARGET); \
682	else \
683		true; \
684	fi
685
686$(SUBDIRS:%=%-nodepend):
687	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
688		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
689	else \
690		true; \
691	fi
692
693FRC:
694