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