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