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