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