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