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