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