xref: /illumos-gate/usr/src/lib/Makefile (revision fc80c0dfb0c877aee828d778ea32b77fcf7b1ef4)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
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
48#
49# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
50# but required due to the "dependencies" of using .WAIT to barrier the
51# parallel dmake builds.  once 4631488 has been fixed, they can be
52# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
53# shown in HDRSUBDIRS
54#
55SUBDIRS= \
56	common			.WAIT	\
57	../cmd/sgs/libconv		\
58	../cmd/sgs/libdl	.WAIT
59
60$(CLOSED_BUILD)SUBDIRS += \
61	$(CLOSED)/lib/libc_i18n
62
63SUBDIRS += \
64	libc			.WAIT	\
65	../cmd/sgs/libelf	.WAIT	\
66	libmd				\
67	libmd5				\
68	librsm				\
69	libmp			.WAIT	\
70	libnsl			\
71	libsecdb		.WAIT	\
72	librpcsvc			\
73	libsocket		.WAIT	\
74	libsctp			\
75	libsip			\
76	libresolv			\
77	libresolv2		.WAIT	\
78	libw			.WAIT	\
79	libintl			.WAIT	\
80	../cmd/sgs/librtld_db	\
81	libaio			\
82	libast			\
83	libdll			\
84	libcmd			\
85	libshell		\
86	librt			\
87	libadm			\
88	libctf			\
89	libdtrace		\
90	libdtrace_jni		\
91	libcurses		\
92	libgen			\
93	libgss			\
94	libpam			\
95	libuuid			\
96	libthread		\
97	libpthread	.WAIT	\
98	libslp		\
99	libbsdmalloc	\
100	libdoor		\
101	libdevinfo	\
102	libdladm	\
103	libdlpi		\
104	libeti		\
105	libcrypt	\
106	libdns_sd	\
107	libefi		\
108	libfstyp	\
109	libwanboot	\
110	libwanbootutil	\
111	libcryptoutil	\
112	libinetcfg	\
113	libinetutil	\
114	libipmp		\
115	libiscsitgt	\
116	libkmf		\
117	libkstat	\
118	libkvm		\
119	liblm		\
120	libmalloc	\
121	libmapmalloc	\
122	libmtmalloc	\
123	libnls		\
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	gss_mechs/mech_krb5	.WAIT	\
146	libkrb5	.WAIT	\
147	krb5	.WAIT
148$(CLOSED_BUILD)SUBDIRS += \
149	$(CLOSED)/lib/smartcard
150SUBDIRS += \
151	passwdutil	\
152	pam_modules	\
153	crypt_modules	\
154	libadt_jni	\
155	abi		\
156	auditd_plugins	\
157	libvolmgt	\
158	libdevice	\
159	libdevid	\
160	libdhcpsvc	\
161	libc_db		\
162	libsec		\
163	libtnfprobe	\
164	libtnf		\
165	libtnfctl	\
166	libdhcpagent	\
167	libdhcpdu	\
168	libdhcputil	\
169	libipsecutil
170$(CLOSED_BUILD)SUBDIRS += \
171	$(CLOSED)/lib/libike
172SUBDIRS += \
173	nsswitch	\
174	print		\
175	libuutil	\
176	libscf		\
177	libinetsvc	\
178	librestart	\
179	libsched	\
180	libelfsign	\
181	pkcs11		.WAIT	\
182	libpctx		.WAIT	\
183	libcpc		\
184	watchmalloc	\
185	extendedFILE	\
186	madv		\
187	mpss		\
188	libdisasm	\
189	libwrap		\
190	libxcurses	\
191	libxcurses2	\
192	libxnet		\
193	libbrand	.WAIT   \
194	libzonecfg	\
195	libzoneinfo	\
196	libtsnet	\
197	libtsol		\
198	gss_mechs/mech_spnego	\
199	gss_mechs/mech_dummy	\
200	gss_mechs/mech_dh	\
201	rpcsec_gss	\
202	libraidcfg	.WAIT	\
203	librcm		.WAIT	\
204	libcfgadm	.WAIT	\
205	libpicl		.WAIT	\
206	libpicltree	.WAIT \
207	raidcfg_plugins	\
208	cfgadm_plugins	\
209	libmail		\
210	lvm		\
211	libsmedia	\
212	libipp		\
213	openssl		\
214	libdiskmgt	\
215	liblgrp		\
216	libfsmgt	\
217	fm		\
218	libavl		\
219	libcmdutils	\
220	libcontract	\
221	../cmd/sendmail/libmilter	\
222	sasl_plugins	\
223	udapl		\
224	libzpool	\
225	libzfs		\
226	libzfs_jni	\
227	libmapid	\
228	brand		\
229	policykit	\
230	hal		\
231	libshare	\
232	libsqlite	\
233	libidmap	\
234	libipmi		\
235	libexacct/demo	\
236	$($(MACH)_SUBDIRS)
237
238sparc_SUBDIRS= .WAIT	\
239	efcode		\
240	libc_psr	.WAIT	\
241	libdscp		\
242	libprtdiag	.WAIT	\
243	libprtdiag_psr	\
244	libpri		\
245	librsc		\
246	libfruutils	.WAIT	\
247	libfru		\
248	storage		\
249	libpcp		\
250	libtsalarm
251
252FM_sparc_DEPLIBS= libpri
253
254fm: libexacct $(FM_$(MACH)_DEPLIBS)
255
256#
257# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
258# clean and clobber targets (for more information, see those targets, below).
259#
260NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
261
262DCSUBDIRS =		\
263	lvm
264
265MSGSUBDIRS=		\
266	abi		\
267	auditd_plugins	\
268	brand		\
269	cfgadm_plugins	\
270	gss_mechs/mech_dh	\
271	gss_mechs/mech_krb5	\
272	krb5		\
273	libast		\
274	libbsm		\
275	libc		\
276	libcfgadm	\
277	libcmd		\
278	libcontract	\
279	libcurses	\
280	libdhcpsvc 	\
281	libdhcputil	\
282	libipsecutil	\
283	libdiskmgt	\
284	libdladm	\
285	libdll		\
286	libgss		\
287	libidmap	\
288	libinetcfg	\
289	libipmp		\
290	libnsl		\
291	libpam		\
292	libpicl		\
293	libpool		\
294	libpp		\
295	libscf		\
296	libsasl		\
297	libldap5	\
298	libsecdb	\
299	libshare	\
300	libshell	\
301	libsldap	\
302	libslp		\
303	libsmedia	\
304	libtsol		\
305	libuutil	\
306	libwanboot	\
307	libwanbootutil	\
308	libzfs		\
309	libzonecfg	\
310	lvm		\
311	madv		\
312	mpss		\
313	pam_modules	\
314	rpcsec_gss
315$(CLOSED_BUILD)MSGSUBDIRS += \
316	$(CLOSED)/lib/smartcard
317MSGSUBDIRS += \
318	$($(MACH)_MSGSUBDIRS)
319
320sparc_MSGSUBDIRS=	\
321	libprtdiag	\
322	libprtdiag_psr
323
324HDRSUBDIRS=		\
325	auditd_plugins	\
326	libast		\
327	libbrand	\
328	libbsm		\
329	libc		\
330	libcmd		\
331	libcmdutils	\
332	libcontract	\
333	libcpc		\
334	libctf		\
335	libcurses	\
336	libcryptoutil	\
337	libdevice	\
338	libdevid	\
339	libdevinfo	\
340	libdiskmgt	\
341	libdladm	\
342	libdll		\
343	libdlpi		\
344	libdhcpagent	\
345	libdhcpsvc	\
346	libdhcputil	\
347	libdisasm	\
348	libdns_sd	\
349	libdtrace	\
350	libdtrace_jni	\
351	libelfsign	\
352	libeti		\
353	libfstyp	\
354	libgen		\
355	libwanboot	\
356	libwanbootutil	\
357	libipsecutil	\
358	libinetcfg	\
359	libinetsvc	\
360	libinetutil	\
361	libipmi		\
362	libipmp		\
363	libipp		\
364	libiscsitgt	\
365	libkstat	\
366	libkvm		\
367	libmail		\
368	libmd		\
369	libmtmalloc	\
370	libnvpair	\
371	libnsl		\
372	libpam		\
373	libpctx		\
374	libpicl		\
375	libpicltree	\
376	libplot		\
377	libpool		\
378	libpp		\
379	libproc		\
380	libraidcfg	\
381	librcm		\
382	libscf		\
383	libsip		\
384	libsmbios	\
385	librestart	\
386	librpcsvc	\
387	librsm		\
388	libsasl		\
389	libsec		\
390	libshell	\
391	libslp		\
392	libsmedia	\
393	libsqlite	\
394	libsysevent	\
395	libtecla	\
396	libtnf		\
397	libtnfctl	\
398	libtnfprobe	\
399	libtsnet	\
400	libtsol		\
401	libvolmgt	\
402	libumem		\
403	libuutil	\
404	libwrap		\
405	libxcurses2	\
406	libzfs		\
407	libzfs_jni	\
408	libzoneinfo	\
409	hal		\
410	policykit	\
411	lvm		\
412	openssl		\
413	pkcs11		\
414	passwdutil	\
415	../cmd/sendmail/libmilter	\
416	fm		\
417	udapl		\
418	libmapid	\
419	libkrb5		\
420	libshare	\
421	libidmap	\
422	$($(MACH)_HDRSUBDIRS)
423
424$(CLOSED_BUILD)HDRSUBDIRS += \
425	$(CLOSED)/lib/libc_i18n	\
426	$(CLOSED)/lib/libike	\
427	$(CLOSED)/lib/smartcard
428
429sparc_HDRSUBDIRS=	\
430	libdscp		\
431	libpri
432
433all :=		TARGET= all
434check :=	TARGET= check
435clean :=	TARGET= clean
436clobber :=	TARGET= clobber
437install :=	TARGET= install
438install_h :=	TARGET= install_h
439lint :=		TARGET= lint
440_dc :=		TARGET= _dc
441_msg :=		TARGET= _msg
442
443.KEEP_STATE:
444
445#
446# For the all and install targets, we clearly must respect library
447# dependencies so that the libraries link correctly.  However, for
448# the remaining targets (check, clean, clobber, install_h, lint, _dc
449# and _msg), libraries do not have any dependencies on one another
450# and thus respecting dependencies just slows down the build.
451# As such, for these rules, we use pattern replacement to explicitly
452# avoid triggering the dependency information.  Note that for clean,
453# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
454# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
455#
456
457all:			$(SUBDIRS)
458
459install:		$(SUBDIRS) .WAIT install_extra
460
461# extra libraries kept in other source areas
462install_extra:
463	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
464	@pwd
465
466clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
467
468install_h check:	$(HDRSUBDIRS:%=%-nodepend)
469
470_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
471
472_dc:			$(DCSUBDIRS:%=%-nodepend)
473
474# dependencies for pam_modules (see below)
475$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
476
477#
478# Library interdependencies are called out explicitly here
479#
480auditd_plugins: libbsm libnsl libsecdb
481gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
482libadt_jni:	libbsm
483$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
484libast: 	libsocket
485libbsm:		libtsol
486libcmd: 	libast libsocket libnsl
487libcmdutils:	libavl
488libcontract:	libnvpair
489libdevid:	libdevinfo
490libdevinfo:	libnvpair libsec
491libdhcpagent:	libsocket libdhcputil libuuid libdlpi
492libdhcpsvc:	libinetutil
493libdhcputil:	libnsl libgen libinetutil libdlpi
494libdladm:	libdlpi libdevinfo libinetutil libsocket
495libdll: 	libast
496libdlpi:	libinetutil
497libdtrace:	libproc libgen libctf
498libdtrace_jni:	libuutil libdtrace
499libefi:		libuuid
500libfstyp:	libnvpair
501libelfsign:	libcryptoutil libkmf
502libidmap:	libnsl
503libinetcfg:	libnsl libsocket libdevinfo
504libkmf:		libcryptoutil pkcs11 openssl
505libnsl:		libmd5 libscf
506libmapid:	libresolv
507libuuid:	libdlpi libdladm
508libinetutil:	libsocket
509libsecdb:	libnsl
510libsasl:	libgss libsocket pkcs11 libmd
511sasl_plugins:	pkcs11 libgss libsocket libsasl
512libsctp:	libsocket
513libshell:	libast libcmd libdll libsocket libsecdb
514libsip:		libmd5
515libsocket:	libnsl
516libldap5:	libsasl libsocket libnsl libmd
517libsldap:	libldap5 libtsol
518libpool:	libnvpair libexacct
519libpp:		libast
520libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
521		libbrand libpool libscf
522libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
523libproject:	libpool libproc libsecdb
524libtsnet:	libnsl libtsol libsecdb
525libwrap:	libnsl libsocket
526libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
527		libdhcputil openssl
528libwanbootutil:	libnsl
529pam_modules:	libproject passwdutil $(SMARTCARD)
530libscf:		libuutil libmd libgen
531libinetsvc:	libscf
532librestart:	libuutil libscf
533../cmd/sgs/libdl:	../cmd/sgs/libconv
534../cmd/sgs/libelf:	../cmd/sgs/libconv
535pkcs11:		libcryptoutil
536print:		libldap5
537udapl/udapl_tavor:	udapl/libdat
538libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
539libzfs_jni:	libdiskmgt libnvpair libzfs
540libzpool:	libavl libumem libnvpair
541libsec:		libavl
542brand:		libc libsocket
543libshare:	libscf libzfs libuuid libfsmgt libsecdb
544libexacct/demo:	libexacct libproject libsocket libnsl
545libtsalarm:	libpcp
546
547#
548# The reason this rule checks for the existence of the
549# Makefile is that some of the directories do not exist
550# in certain situations (e.g., exportable source builds,
551# OpenSolaris).
552#
553$(SUBDIRS): FRC
554	@if [ -f $@/Makefile  ]; then \
555		cd $@; pwd; $(MAKE) $(TARGET); \
556	else \
557		true; \
558	fi
559
560$(SUBDIRS:%=%-nodepend):
561	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
562		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
563	else \
564		true; \
565	fi
566
567FRC:
568