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