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