xref: /titanic_51/usr/src/lib/Makefile (revision f4a94ada79e5d2be49a574fa7fba9364c57b05d9)
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	libdiskmgt	\
228	liblgrp		\
229	libfsmgt	\
230	fm		\
231	libavl		\
232	libcmdutils	\
233	libcontract	\
234	../cmd/sendmail/libmilter	\
235	sasl_plugins	\
236	udapl		\
237	libzpool	\
238	libzfs		\
239	libzfs_jni	\
240	pyzfs		\
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
261i386_SUBDIRS=		\
262	libntfs		\
263	libparted
264
265sparc_SUBDIRS= .WAIT	\
266	efcode		\
267	libc_psr	.WAIT	\
268	libds		\
269	libdscp		\
270	libprtdiag	.WAIT	\
271	libprtdiag_psr	\
272	libpri		\
273	librsc		\
274	libfruutils	.WAIT	\
275	libfru		\
276	storage		\
277	libpcp		\
278	libtsalarm
279
280FM_sparc_DEPLIBS= libpri
281
282fm:			\
283	libexacct	\
284	libipmi		\
285	libzfs		\
286	scsi		\
287	$(FM_$(MACH)_DEPLIBS)
288
289#
290# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
291# clean and clobber targets (for more information, see those targets, below).
292#
293NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
294
295DCSUBDIRS =		\
296	lvm
297
298MSGSUBDIRS=		\
299	abi		\
300	auditd_plugins	\
301	brand		\
302	cfgadm_plugins	\
303	gss_mechs/mech_dh	\
304	gss_mechs/mech_krb5	\
305	krb5		\
306	libast		\
307	libbsm		\
308	libc		\
309	libcfgadm	\
310	libcmd		\
311	libcontract	\
312	libcurses	\
313	libdhcpsvc 	\
314	libdhcputil	\
315	libipsecutil	\
316	libdiskmgt	\
317	libdladm	\
318	libdll		\
319	libgrubmgmt	\
320	libgss		\
321	libidmap	\
322	libinetcfg	\
323	libipmp		\
324	libinetutil	\
325	libnsl		\
326	libpam		\
327	libpicl		\
328	libpool		\
329	libpp		\
330	libscf		\
331	libsasl		\
332	libldap5	\
333	libsecdb	\
334	libshare	\
335	libshell	\
336	libsldap	\
337	libslp		\
338	libsmbfs	\
339	libsmedia	\
340	libsum		\
341	libtsol		\
342	libuutil	\
343	libvscan	\
344	libwanboot	\
345	libwanbootutil	\
346	libzfs		\
347	libzonecfg	\
348	lvm		\
349	madv		\
350	mms		\
351	mpss		\
352	pam_modules	\
353	pyzfs		\
354	rpcsec_gss
355$(CLOSED_BUILD)MSGSUBDIRS += \
356	$(CLOSED)/lib/smartcard
357MSGSUBDIRS += \
358	$($(MACH)_MSGSUBDIRS)
359
360sparc_MSGSUBDIRS=	\
361	libprtdiag	\
362	libprtdiag_psr
363
364HDRSUBDIRS=		\
365	auditd_plugins	\
366	libast		\
367	libbrand	\
368	libbsm		\
369	libc		\
370	libcmd		\
371	libcmdutils	\
372	libcontract	\
373	libcpc		\
374	libctf		\
375	libcurses	\
376	libcryptoutil	\
377	libdevice	\
378	libdevid	\
379	libdevinfo	\
380	libdiskmgt	\
381	libdladm	\
382	libdll		\
383	libdlpi		\
384	libdhcpagent	\
385	libdhcpsvc	\
386	libdhcputil	\
387	libdisasm	\
388	libdns_sd	\
389	libdscfg	\
390	libdtrace	\
391	libdtrace_jni	\
392	libelfsign	\
393	libeti		\
394	libfstyp	\
395	libgen		\
396	libwanboot	\
397	libwanbootutil	\
398	libipsecutil	\
399	libinetcfg	\
400	libinetsvc	\
401	libinetutil	\
402	libipmi		\
403	libipmp		\
404	libipp		\
405	libiscsit	\
406	libiscsitgt	\
407	libkstat	\
408	libkvm		\
409	libmail		\
410	libmd		\
411	libmtmalloc	\
412	libndmp		\
413	libnvpair	\
414	libnsctl	\
415	libnsl		\
416	libnwam		\
417	libpam		\
418	libpctx		\
419	libpicl		\
420	libpicltree	\
421	libplot		\
422	libpool		\
423	libpp		\
424	libproc		\
425	libraidcfg	\
426	librcm		\
427	librdc		\
428	libscf		\
429	libsip		\
430	libcommputil	\
431	libsmbios	\
432	librestart	\
433	librpcsvc	\
434	librsm		\
435	libsasl		\
436	libsec		\
437	libshell	\
438	libslp		\
439	libsmedia	\
440	libsqlite	\
441	libfcoe		\
442	libstmf		\
443	libsum		\
444	libsysevent	\
445	libtecla	\
446	libtnf		\
447	libtnfctl	\
448	libtnfprobe	\
449	libtsnet	\
450	libtsol		\
451	libvolmgt	\
452	libumem		\
453	libunistat	\
454	libuutil	\
455	libwrap		\
456	libxcurses2	\
457	libzfs		\
458	libzfs_jni	\
459	libzoneinfo	\
460	hal		\
461	policykit	\
462	lvm		\
463	pkcs11		\
464	passwdutil	\
465	../cmd/sendmail/libmilter	\
466	fm		\
467	udapl		\
468	libmapid	\
469	libkrb5		\
470	libshare	\
471	libidmap	\
472	libvscan	\
473	libgrubmgmt	\
474	smbsrv		\
475	scsi		\
476	hbaapi		\
477	libima		\
478	libsun_ima	\
479	mpapi		\
480	mms		\
481	$($(MACH)_HDRSUBDIRS)
482
483$(CLOSED_BUILD)HDRSUBDIRS += \
484	$(CLOSED)/lib/libc_i18n	\
485	$(CLOSED)/lib/libike	\
486	$(CLOSED)/lib/smartcard
487
488sparc_HDRSUBDIRS=	\
489	libds		\
490	libdscp		\
491	libpri		\
492	storage
493
494all :=		TARGET= all
495check :=	TARGET= check
496clean :=	TARGET= clean
497clobber :=	TARGET= clobber
498install :=	TARGET= install
499install_h :=	TARGET= install_h
500lint :=		TARGET= lint
501_dc :=		TARGET= _dc
502_msg :=		TARGET= _msg
503
504.KEEP_STATE:
505
506#
507# For the all and install targets, we clearly must respect library
508# dependencies so that the libraries link correctly.  However, for
509# the remaining targets (check, clean, clobber, install_h, lint, _dc
510# and _msg), libraries do not have any dependencies on one another
511# and thus respecting dependencies just slows down the build.
512# As such, for these rules, we use pattern replacement to explicitly
513# avoid triggering the dependency information.  Note that for clean,
514# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
515# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
516#
517
518all:			$(SUBDIRS)
519
520install:		$(SUBDIRS) .WAIT install_extra
521
522# extra libraries kept in other source areas
523install_extra:
524	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
525	@pwd
526
527clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
528
529install_h check:	$(HDRSUBDIRS:%=%-nodepend)
530
531_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
532
533_dc:			$(DCSUBDIRS:%=%-nodepend)
534
535# dependencies for pam_modules (see below)
536$(CLOSED_BUILD)SMARTCARD=	$(CLOSED)/lib/smartcard
537
538#
539# Library interdependencies are called out explicitly here
540#
541auditd_plugins: libbsm libnsl libsecdb
542gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
543libadt_jni:	libbsm
544$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
545libast: 	libsocket
546libadutils: 	libldap5 libresolv libsocket libnsl
547nsswitch:	libadutils libidmap
548libbsm:		libtsol
549libcmd: 	libsum libast libsocket libnsl
550libcmdutils:	libavl
551libcontract:	libnvpair
552libdevid:	libdevinfo
553libdevinfo:	libnvpair libsec
554libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
555libdhcpsvc:	libinetutil
556libdhcputil:	libnsl libgen libinetutil libdlpi
557libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
558		libexacct libnsl libkstat libcurses
559libdll: 	libast
560libdlpi:	libinetutil libdladm
561libdscfg:	libnsctl libunistat libsocket libnsl
562libdtrace:	libproc libgen libctf
563libdtrace_jni:	libuutil libdtrace
564libefi:		libuuid
565libfstyp:	libnvpair
566libelfsign:	libcryptoutil libkmf
567libidmap:	libadutils libldap5 libavl libsldap
568libinetcfg:	libnsl libsocket libdlpi
569libiscsit:	libc libnvpair libstmf libuuid libnsl
570libkmf:		libcryptoutil pkcs11
571libnsl:		libmd5 libscf
572libmapid:	libresolv
573libnwam:	libdoor
574librdc:		libsocket libnsl libnsctl libunistat libdscfg
575libuuid:	libdlpi
576libinetutil:	libsocket
577libsecdb:	libnsl
578libsasl:	libgss libsocket pkcs11 libmd
579sasl_plugins:	pkcs11 libgss libsocket libsasl
580libsctp:	libsocket
581libshell:	libast libcmd libdll libsocket libsecdb
582libsip:		libmd5
583libsmbfs:	libsocket libnsl libkrb5
584libsocket:	libnsl
585libsum: 	libast
586libldap5:	libsasl libsocket libnsl libmd
587libsldap:	libldap5 libtsol libnsl libc libscf libresolv
588libpool:	libnvpair libexacct
589libpp:		libast
590libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
591		libbrand libpool libscf
592libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
593libproject:	libpool libproc libsecdb
594libtsnet:	libnsl libtsol libsecdb
595libwrap:	libnsl libsocket
596libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
597		libdhcputil
598libwanbootutil:	libnsl
599pam_modules:	libproject passwdutil $(SMARTCARD) smbsrv
600libscf:		libuutil libmd libgen libsmbios
601libinetsvc:	libscf
602librestart:	libuutil libscf
603../cmd/sgs/libdl:	../cmd/sgs/libconv
604../cmd/sgs/libelf:	../cmd/sgs/libconv
605pkcs11:		libcryptoutil
606print:		libldap5
607udapl/udapl_tavor:	udapl/libdat
608libzfs:		libdevinfo libdevid libgen libnvpair libuutil libiscsitgt \
609		libavl libefi libidmap libsec
610libzfs_jni:	libdiskmgt libnvpair libzfs
611libzpool:	libavl libumem libnvpair
612libsec:		libavl libidmap
613brand:		libc libsocket
614libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
615libexacct/demo:	libexacct libproject libsocket libnsl
616libtsalarm:	libpcp
617smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
618		libshare libidmap pkcs11 libsqlite
619libvscan:	libscf
620scsi:		libnvpair
621mpapi:		libpthread libdevinfo libsysevent libnvpair
622libgrubmgmt:	libdevinfo libzfs libfstyp
623pyzfs:		libnvpair libsec libidmap libzfs
624
625#
626# The reason this rule checks for the existence of the
627# Makefile is that some of the directories do not exist
628# in certain situations (e.g., exportable source builds,
629# OpenSolaris).
630#
631$(SUBDIRS): FRC
632	@if [ -f $@/Makefile  ]; then \
633		cd $@; pwd; $(MAKE) $(TARGET); \
634	else \
635		true; \
636	fi
637
638$(SUBDIRS:%=%-nodepend):
639	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
640		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
641	else \
642		true; \
643	fi
644
645FRC:
646