xref: /illumos-gate/usr/src/lib/Makefile (revision 4e93fb0f6383eaac21897dcdae56b87118131e4d)
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	librt			\
83	libadm			\
84	libctf			\
85	libdtrace		\
86	libdtrace_jni		\
87	libcurses		\
88	libgen			\
89	libgss			\
90	libpam			\
91	libuuid			\
92	libthread		\
93	libpthread	.WAIT	\
94	libslp		\
95	libbsdmalloc	\
96	libcmd		\
97	libdoor		\
98	libdevinfo	\
99	libdladm	\
100	libdlpi		\
101	libeti		\
102	libcrypt	\
103	libefi		\
104	libfstyp	\
105	libwanboot	\
106	libwanbootutil	\
107	libcryptoutil	\
108	libinetcfg	\
109	libinetutil	\
110	libipmp		\
111	libiscsitgt	\
112	libkmf		\
113	libkstat	\
114	libkvm		\
115        liblaadm        \
116	liblm		\
117	libmacadm	\
118	libmalloc	\
119	libmapmalloc	\
120	libmtmalloc	\
121	libnls		\
122	libsmbios	\
123	libtecla	\
124	libumem		\
125	libnvpair	.WAIT	\
126	libexacct	\
127	libplot		\
128	libldap4	\
129	libsasl		\
130	libldap5	\
131	libsldap	.WAIT	\
132	libbsm		\
133	libsys		\
134	libsysevent	\
135	libnisdb	\
136	libpool		\
137	libproc		\
138	libproject	\
139	libsendfile	\
140	nametoaddr	\
141	ncad_addr	\
142	gss_mechs/mech_krb5	.WAIT	\
143	libkrb5	.WAIT	\
144	krb5	.WAIT
145$(CLOSED_BUILD)SUBDIRS += \
146	$(CLOSED)/lib/smartcard
147SUBDIRS += \
148	passwdutil	\
149	pam_modules	\
150	crypt_modules	\
151	libadt_jni	\
152	abi		\
153	auditd_plugins	\
154	libvolmgt	\
155	libdevice	\
156	libdevid	\
157	libdhcpsvc	\
158	libc_db		\
159	libsec		\
160	libtnfprobe	\
161	libtnf		\
162	libtnfctl	\
163	libdhcpagent	\
164	libdhcpdu	\
165	libdhcputil	\
166	libipsecutil
167$(CLOSED_BUILD)SUBDIRS += \
168	$(CLOSED)/lib/libike
169SUBDIRS += \
170	nsswitch	\
171	print		\
172	libuutil	\
173	libscf		\
174	libinetsvc	\
175	librestart	\
176	libsched
177$(CLOSED_BUILD)SUBDIRS += \
178	$(CLOSED)/lib/libelfsign
179SUBDIRS += \
180	pkcs11		.WAIT	\
181	libpctx		.WAIT	\
182	libcpc		\
183	watchmalloc	\
184	extendedFILE	\
185	madv		\
186	mpss		\
187	libdisasm	\
188	libwladm	\
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	$($(MACH)_SUBDIRS)
233
234sparc_SUBDIRS= .WAIT	\
235	efcode		\
236	libc_psr	.WAIT	\
237	libdscp		\
238	libprtdiag	.WAIT	\
239	libprtdiag_psr	\
240	librsc		\
241	libfruutils	.WAIT	\
242	libfru		\
243	libwrsmconf	\
244	storage		\
245	wrsm		\
246	libpcp
247
248fm: libexacct
249
250#
251# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
252# clean and clobber targets (for more information, see those targets, below).
253#
254NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
255
256DCSUBDIRS =		\
257	lvm
258
259MSGSUBDIRS=		\
260	abi		\
261	auditd_plugins	\
262	brand		\
263	cfgadm_plugins	\
264	gss_mechs/mech_dh	\
265	gss_mechs/mech_krb5	\
266	krb5		\
267	libbsm		\
268	libc		\
269	libcfgadm	\
270	libcontract	\
271	libcurses	\
272	libdhcpsvc 	\
273	libdhcputil	\
274	libdladm	\
275	libgss		\
276	libinetcfg	\
277	libipmp		\
278	libnsl		\
279	libpam		\
280	libpicl		\
281	libpool		\
282	libscf		\
283	libsasl		\
284	libldap5	\
285	libsecdb	\
286	libshare	\
287	libsldap	\
288	libslp		\
289	libsmedia	\
290	libtsol		\
291	libuutil	\
292	libwanboot	\
293	libwanbootutil	\
294	libwladm	\
295	libzonecfg	\
296	lvm		\
297	madv		\
298	mpss		\
299	pam_modules	\
300	rpcsec_gss
301$(CLOSED_BUILD)MSGSUBDIRS += \
302	$(CLOSED)/lib/smartcard
303MSGSUBDIRS += \
304	$($(MACH)_MSGSUBDIRS)
305
306sparc_MSGSUBDIRS=	\
307	libprtdiag	\
308	libprtdiag_psr
309
310HDRSUBDIRS=		\
311	auditd_plugins	\
312	libbrand	\
313	libbsm		\
314	libc		\
315	libcmdutils	\
316	libcontract	\
317	libcpc		\
318	libctf		\
319	libcurses	\
320	libcryptoutil	\
321	libdevice	\
322	libdevid	\
323	libdevinfo	\
324	libdiskmgt	\
325	libdladm	\
326	libdlpi		\
327	libdhcpagent	\
328	libdhcpsvc	\
329	libdhcputil	\
330	libdisasm	\
331	libdtrace	\
332	libdtrace_jni	\
333	libeti		\
334	libfstyp	\
335	libgen		\
336	libwanboot	\
337	libwanbootutil	\
338	libipsecutil	\
339	libinetcfg	\
340	libinetsvc	\
341	libinetutil	\
342	libipmp		\
343	libipp		\
344	libiscsitgt	\
345	libkstat	\
346	libkvm		\
347        liblaadm        \
348	libmacadm	\
349	libmail		\
350	libmd		\
351	libmtmalloc	\
352	libnvpair	\
353	libnsl		\
354	libpam		\
355	libpctx		\
356	libpicl		\
357	libpicltree	\
358	libplot		\
359	libpool		\
360	libproc		\
361	librcm		\
362	libscf		\
363	libsip		\
364	libsmbios	\
365	librestart	\
366	librpcsvc	\
367	librsm		\
368	libsasl		\
369	libsec		\
370	libslp		\
371	libsmedia	\
372	libsysevent	\
373	libtecla	\
374	libtnf		\
375	libtnfctl	\
376	libtnfprobe	\
377	libtsnet	\
378	libtsol		\
379	libvolmgt	\
380	libumem		\
381	libuutil	\
382	libwladm	\
383	libwrap		\
384	libxcurses2	\
385	libzfs		\
386	libzfs_jni	\
387	libzoneinfo	\
388	hal		\
389	policykit	\
390	lvm		\
391	openssl		\
392	pkcs11		\
393	passwdutil	\
394	../cmd/sendmail/libmilter	\
395	fm		\
396	udapl		\
397	libmapid	\
398	libkrb5		\
399	libshare	\
400	$($(MACH)_HDRSUBDIRS)
401
402$(CLOSED_BUILD)HDRSUBDIRS += \
403	$(CLOSED)/lib/libc_i18n	\
404	$(CLOSED)/lib/libike	\
405	$(CLOSED)/lib/smartcard
406
407sparc_HDRSUBDIRS=	\
408	libdscp		\
409	libwrsmconf
410
411all :=		TARGET= all
412check :=	TARGET= check
413clean :=	TARGET= clean
414clobber :=	TARGET= clobber
415install :=	TARGET= install
416install_h :=	TARGET= install_h
417lint :=		TARGET= lint
418_dc :=		TARGET= _dc
419_msg :=		TARGET= _msg
420
421.KEEP_STATE:
422
423#
424# For the all and install targets, we clearly must respect library
425# dependencies so that the libraries link correctly.  However, for
426# the remaining targets (check, clean, clobber, install_h, lint, _dc
427# and _msg), libraries do not have any dependencies on one another
428# and thus respecting dependencies just slows down the build.
429# As such, for these rules, we use pattern replacement to explicitly
430# avoid triggering the dependency information.  Note that for clean,
431# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
432# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
433#
434
435all:			$(SUBDIRS)
436
437install:		$(SUBDIRS) .WAIT install_extra
438
439# extra libraries kept in other source areas
440install_extra:
441	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
442	@pwd
443
444clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
445
446install_h check:	$(HDRSUBDIRS:%=%-nodepend)
447
448_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
449
450_dc:			$(DCSUBDIRS:%=%-nodepend)
451
452# dependencies for pam_modules (see below)
453$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
454
455#
456# Library interdependencies are called out explicitly here
457#
458auditd_plugins: libbsm libnsl libsecdb
459gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
460libadt_jni:	libbsm
461$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
462libbsm:		libtsol
463libcmdutils:	libavl
464libcontract:	libnvpair
465libdevid:	libdevinfo
466libdevinfo:	libnvpair libsec
467libdhcpagent:	libsocket libdhcputil libuuid libdlpi
468libdhcpsvc:	libinetutil
469libdhcputil:	libnsl libgen libinetutil libdlpi
470libdladm:	libdlpi libdevinfo libwladm libinetutil
471libdtrace:	libproc libgen libctf
472libdtrace_jni:	libuutil libdtrace
473libefi:		libuuid
474libfstyp:	libnvpair
475$(CLOSED_BUILD)$(CLOSED)/lib/libelfsign: \
476			$(CLOSED)/lib/libike libcryptoutil pkcs11
477libinetcfg:	libnsl libsocket libdevinfo
478libkmf:		libcryptoutil pkcs11 openssl
479libnsl:		libmd5 libscf
480libmapid:	libresolv
481libmacadm:	libdevinfo
482libuuid:	libsocket
483libinetutil:	libsocket
484libsecdb:	libnsl
485libsasl:	libgss libsocket pkcs11 libmd
486sasl_plugins:	pkcs11 libgss libsocket libsasl
487libsctp:	libsocket
488libsip:		libmd5
489libsocket:	libnsl
490libldap5:	libsasl libsocket libnsl libmd
491libsldap:	libldap5 libtsol
492libpool:	libnvpair libexacct
493libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
494		libbrand libpool libscf
495libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
496libproject:	libpool libproc libsecdb
497libtsnet:	libnsl libtsol libsecdb
498libwrap:	libnsl libsocket
499libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
500		libdhcputil openssl
501libwanbootutil:	libnsl
502libwladm:	libdevinfo libsocket
503pam_modules:	libproject passwdutil $(SMARTCARD)
504libscf:		libuutil libmd
505libinetsvc:	libscf
506librestart:	libuutil libscf
507../cmd/sgs/libdl:	../cmd/sgs/libconv
508../cmd/sgs/libelf:	../cmd/sgs/libconv
509pkcs11:		libcryptoutil
510print:		libldap5
511udapl/udapl_tavor:	udapl/libdat
512libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt
513libzfs_jni:	libdiskmgt libnvpair libzfs
514libzpool:	libavl libumem libnvpair
515libsec:		libavl
516brand:		libc libsocket
517libshare:	libscf libzfs libuuid libfsmgt libsecdb
518
519#
520# The reason this rule checks for the existence of the
521# Makefile is that some of the directories do not exist
522# in certain situations (e.g., exportable source builds,
523# OpenSolaris).
524#
525$(SUBDIRS): FRC
526	@if [ -f $@/Makefile  ]; then \
527		cd $@; pwd; $(MAKE) $(TARGET); \
528	else \
529		true; \
530	fi
531
532$(SUBDIRS:%=%-nodepend):
533	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
534		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
535	else \
536		true; \
537	fi
538
539FRC:
540