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