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