xref: /illumos-gate/usr/src/lib/Makefile (revision 1cb875ae88fb9463b368e725c2444776595895cb)
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
26include ../Makefile.master
27
28#	Note that libcurses installs commands along with its library.
29#	This is a minor bug which probably should be fixed.
30#	Note also that a few extra libraries are kept in cmd source.
31#
32# Certain libraries are linked with, hence depend on, other libraries.
33#
34# Although we have historically used .WAIT to express dependencies, it
35# reduces the amount of parallelism and thus lengthens the time it
36# takes to build the libraries.  Thus, we now require that any new
37# libraries explicitly call out their dependencies.  Eventually, all
38# the library dependencies will be called out explicitly.  See
39# "Library interdependencies" near the end of this file.
40#
41# Aside from explicit dependencies (and legacy .WAITs), all libraries
42# are built in parallel.
43#
44.PARALLEL:
45
46#
47# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
48# but required due to the "dependencies" of using .WAIT to barrier the
49# parallel dmake builds.  once 4631488 has been fixed, they can be
50# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
51# shown in HDRSUBDIRS
52#
53SUBDIRS= \
54	common			.WAIT	\
55	../cmd/sgs/libconv		\
56	../cmd/sgs/libdl	.WAIT
57
58$(CLOSED_BUILD)SUBDIRS += \
59	$(CLOSED)/lib/libc_i18n
60
61SUBDIRS += \
62	libc			.WAIT	\
63	../cmd/sgs/libelf	.WAIT	\
64	c_synonyms			\
65	libmd				\
66	libmd5				\
67	librsm				\
68	libmp			.WAIT	\
69	libnsl			\
70	libsecdb		.WAIT	\
71	librpcsvc			\
72	libsocket		.WAIT	\
73	libsctp			\
74	libsip			\
75	libcommputil		\
76	libresolv			\
77	libresolv2		.WAIT	\
78	libw			.WAIT	\
79	libintl			.WAIT	\
80	../cmd/sgs/librtld_db	\
81	libaio			\
82	libast			\
83	libdll			\
84	libcmd			\
85	libshell		\
86	libsum			\
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	smhba		\
150	sun_fc		\
151	sun_sas		\
152	gss_mechs/mech_krb5	.WAIT	\
153	libkrb5	.WAIT	\
154	krb5	.WAIT	\
155	libsmbfs	\
156	libfcoe		\
157	libstmf		\
158	libstmfproxy	\
159	libnsctl	\
160	libunistat	\
161	libdscfg	\
162	librdc		\
163	libinstzones	\
164	libpkg
165
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	libvrrpadm	\
255	libvscan	\
256	libgrubmgmt	\
257	smbsrv		\
258	libilb		\
259	scsi		\
260	mms		\
261	libima		\
262	libsun_ima	\
263	mpapi		\
264	librstp		\
265	libreparse	\
266	libhotplug	\
267	libfruutils	.WAIT	\
268	libfru		\
269	$($(MACH)_SUBDIRS)
270
271i386_SUBDIRS=		\
272	libntfs		\
273	libparted	\
274	libfdisk
275
276sparc_SUBDIRS= .WAIT	\
277	efcode		\
278	libc_psr	.WAIT	\
279	libds		\
280	libdscp		\
281	libprtdiag	.WAIT	\
282	libprtdiag_psr	\
283	libpri		\
284	librsc		\
285	storage		\
286	libpcp		\
287	libtsalarm
288
289FM_sparc_DEPLIBS= libpri
290
291fm:			\
292	libexacct	\
293	libipmi		\
294	libzfs		\
295	scsi		\
296	$(FM_$(MACH)_DEPLIBS)
297
298#
299# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
300# clean and clobber targets (for more information, see those targets, below).
301#
302NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
303
304DCSUBDIRS =		\
305	lvm
306
307MSGSUBDIRS=		\
308	abi		\
309	auditd_plugins	\
310	brand		\
311	cfgadm_plugins	\
312	gss_mechs/mech_dh	\
313	gss_mechs/mech_krb5	\
314	krb5		\
315	libast		\
316	libbsm		\
317	libc		\
318	libcfgadm	\
319	libcmd		\
320	libcontract	\
321	libcurses	\
322	libdhcpsvc 	\
323	libdhcputil	\
324	libipsecutil	\
325	libdiskmgt	\
326	libdladm	\
327	libdll		\
328	libgrubmgmt	\
329	libgss		\
330	libidmap	\
331	libinetcfg	\
332	libipmp		\
333	libilb		\
334	libinetutil	\
335	libinstzones	\
336	libnsl		\
337	libpam		\
338	libpicl		\
339	libpool		\
340	libpkg		\
341	libpp		\
342	libscf		\
343	libsasl		\
344	libldap5	\
345	libsecdb	\
346	libshare	\
347	libshell	\
348	libsldap	\
349	libslp		\
350	libsmbfs	\
351	libsmedia	\
352	libsum		\
353	libtsol		\
354	libuutil	\
355	libvrrpadm	\
356	libvscan	\
357	libwanboot	\
358	libwanbootutil	\
359	libzfs		\
360	libzonecfg	\
361	lvm		\
362	madv		\
363	mms		\
364	mpss		\
365	pam_modules	\
366	pyzfs		\
367	rpcsec_gss	\
368	libreparse
369MSGSUBDIRS += \
370	$($(MACH)_MSGSUBDIRS)
371
372sparc_MSGSUBDIRS=	\
373	libprtdiag	\
374	libprtdiag_psr
375
376i386_MSGSUBDIRS= libfdisk
377
378HDRSUBDIRS=		\
379	auditd_plugins	\
380	libast		\
381	libbrand	\
382	libbsm		\
383	libc		\
384	libcmd		\
385	libcmdutils	\
386	libcontract	\
387	libcpc		\
388	libctf		\
389	libcurses	\
390	libcryptoutil	\
391	libdevice	\
392	libdevid	\
393	libdevinfo	\
394	libdiskmgt	\
395	libdladm	\
396	libdll		\
397	libdlpi		\
398	libdhcpagent	\
399	libdhcpsvc	\
400	libdhcputil	\
401	libdisasm	\
402	libdns_sd	\
403	libdscfg	\
404	libdtrace	\
405	libdtrace_jni	\
406	libelfsign	\
407	libeti		\
408	libfstyp	\
409	libgen		\
410	libwanboot	\
411	libwanbootutil	\
412	libipsecutil	\
413	libinetcfg	\
414	libinetsvc	\
415	libinetutil	\
416	libinstzones	\
417	libipmi		\
418	libipmp		\
419	libipp		\
420	libiscsit	\
421	libiscsitgt	\
422	libkstat	\
423	libkvm		\
424	libmail		\
425	libmd		\
426	libmtmalloc	\
427	libndmp		\
428	libnvpair	\
429	libnsctl	\
430	libnsl		\
431	libnwam		\
432	libpam		\
433	libpctx		\
434	libpicl		\
435	libpicltree	\
436	libplot		\
437	libpool		\
438	libpp		\
439	libproc		\
440	libraidcfg	\
441	librcm		\
442	librdc		\
443	libscf		\
444	libsip		\
445	libcommputil	\
446	libsmbios	\
447	librestart	\
448	librpcsvc	\
449	librsm		\
450	librstp		\
451	libsasl		\
452	libsec		\
453	libshell	\
454	libslp		\
455	libsmedia	\
456	libsqlite	\
457	libfcoe		\
458	libstmf		\
459	libstmfproxy	\
460	libsum		\
461	libsysevent	\
462	libtecla	\
463	libtnf		\
464	libtnfctl	\
465	libtnfprobe	\
466	libtsnet	\
467	libtsol		\
468	libvrrpadm	\
469	libvolmgt	\
470	libumem		\
471	libunistat	\
472	libuutil	\
473	libwrap		\
474	libxcurses2	\
475	libzfs		\
476	libzfs_jni	\
477	libzoneinfo	\
478	hal		\
479	policykit	\
480	lvm		\
481	pkcs11		\
482	passwdutil	\
483	../cmd/sendmail/libmilter	\
484	fm		\
485	udapl		\
486	libmapid	\
487	libkrb5		\
488	libsmbfs	\
489	libshare	\
490	libidmap	\
491	libvscan	\
492	libgrubmgmt	\
493	smbsrv		\
494	libilb		\
495	scsi		\
496	hbaapi		\
497	smhba		\
498	libima		\
499	libsun_ima	\
500	mpapi		\
501	mms		\
502	libreparse	\
503	$($(MACH)_HDRSUBDIRS)
504
505$(CLOSED_BUILD)HDRSUBDIRS += \
506	$(CLOSED)/lib/libc_i18n	\
507	$(CLOSED)/lib/libike
508
509i386_HDRSUBDIRS=	\
510	libparted	\
511	libfdisk
512
513sparc_HDRSUBDIRS=	\
514	libds		\
515	libdscp		\
516	libpri		\
517	storage
518
519all :=		TARGET= all
520check :=	TARGET= check
521clean :=	TARGET= clean
522clobber :=	TARGET= clobber
523install :=	TARGET= install
524install_h :=	TARGET= install_h
525lint :=		TARGET= lint
526_dc :=		TARGET= _dc
527_msg :=		TARGET= _msg
528
529.KEEP_STATE:
530
531#
532# For the all and install targets, we clearly must respect library
533# dependencies so that the libraries link correctly.  However, for
534# the remaining targets (check, clean, clobber, install_h, lint, _dc
535# and _msg), libraries do not have any dependencies on one another
536# and thus respecting dependencies just slows down the build.
537# As such, for these rules, we use pattern replacement to explicitly
538# avoid triggering the dependency information.  Note that for clean,
539# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
540# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
541#
542
543all:			$(SUBDIRS)
544
545install:		$(SUBDIRS) .WAIT install_extra
546
547# extra libraries kept in other source areas
548install_extra:
549	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
550	@pwd
551
552clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
553
554install_h check:	$(HDRSUBDIRS:%=%-nodepend)
555
556_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
557
558_dc:			$(DCSUBDIRS:%=%-nodepend)
559
560#
561# Library interdependencies are called out explicitly here
562#
563auditd_plugins: libbsm libnsl libsecdb
564gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
565libadt_jni:	libbsm
566$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
567libast: 	libsocket
568libadutils: 	libldap5 libresolv libsocket libnsl
569nsswitch:	libadutils libidmap
570libbsm:		libtsol
571libcmd: 	libsum libast libsocket libnsl
572libcmdutils:	libavl
573libcontract:	libnvpair
574libdevid:	libdevinfo
575libdevinfo:	libnvpair libsec
576libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
577libdhcpsvc:	libinetutil
578libdhcputil:	libnsl libgen libinetutil libdlpi
579libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
580		libexacct libnsl libkstat libcurses
581libdll: 	libast
582libdlpi:	libinetutil libdladm
583libdscfg:	libnsctl libunistat libsocket libnsl
584libdtrace:	libproc libgen libctf
585libdtrace_jni:	libuutil libdtrace
586libefi:		libuuid
587libfstyp:	libnvpair
588libelfsign:	libcryptoutil libkmf
589libidmap:	libadutils libldap5 libavl libsldap
590libinetcfg:	libnsl libsocket libdlpi
591libiscsit:	libc libnvpair libstmf libuuid libnsl
592libkmf:		libcryptoutil pkcs11
593libnsl:		libmd5 libscf
594libmapid:	libresolv
595libnwam:	libdoor
596librdc:		libsocket libnsl libnsctl libunistat libdscfg
597libuuid:	libdlpi
598libinetutil:	libsocket
599libinstzones:	libzonecfg libcontract
600libpkg:		libwanboot libscf libadm
601libsecdb:	libnsl
602libsasl:	libgss libsocket pkcs11 libmd
603sasl_plugins:	pkcs11 libgss libsocket libsasl
604libsctp:	libsocket
605libshell:	libast libcmd libdll libsocket libsecdb
606libsip:		libmd5
607libsmbfs:	libsocket libnsl libkrb5
608libsocket:	libnsl
609libstmfproxy: 	libstmf libsocket libnsl libpthread
610libsum: 	libast
611libldap5:	libsasl libsocket libnsl libmd
612libsldap:	libldap5 libtsol libnsl libc libscf libresolv
613libpool:	libnvpair libexacct
614libpp:		libast
615libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
616		libbrand libpool libscf
617libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
618libproject:	libpool libproc libsecdb
619libtsnet:	libnsl libtsol libsecdb
620libwrap:	libnsl libsocket
621libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
622		libdhcputil
623libwanbootutil:	libnsl
624pam_modules:	libproject passwdutil smbsrv
625libscf:		libuutil libmd libgen libsmbios
626libinetsvc:	libscf
627librestart:	libuutil libscf
628../cmd/sgs/libdl:	../cmd/sgs/libconv
629../cmd/sgs/libelf:	../cmd/sgs/libconv
630pkcs11:		libcryptoutil
631print:		libldap5
632udapl/udapl_tavor:	udapl/libdat
633libzfs:		libdevid libgen libnvpair libuutil libiscsitgt \
634		libadm libavl libefi libidmap
635libzfs_jni:	libdiskmgt libnvpair libzfs
636libzpool:	libavl libumem libnvpair
637libsec:		libavl libidmap
638brand:		libc libsocket
639libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
640libexacct/demo:	libexacct libproject libsocket libnsl
641libtsalarm:	libpcp
642smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
643		libshare libidmap pkcs11 libsqlite
644libvrrpadm:	libsocket libdladm
645libvscan:	libscf
646scsi:		libnvpair
647mpapi:		libpthread libdevinfo libsysevent libnvpair
648libgrubmgmt:	libdevinfo libzfs libfstyp
649pyzfs:		libnvpair libsec libidmap libzfs
650libreparse:	libnvpair
651libhotplug:	libnvpair
652cfgadm_plugins:	libhotplug
653libilb:		libsocket
654
655#
656# The reason this rule checks for the existence of the
657# Makefile is that some of the directories do not exist
658# in certain situations (e.g., exportable source builds,
659# OpenSolaris).
660#
661$(SUBDIRS): FRC
662	@if [ -f $@/Makefile  ]; then \
663		cd $@; pwd; $(MAKE) $(TARGET); \
664	else \
665		true; \
666	fi
667
668$(SUBDIRS:%=%-nodepend):
669	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
670		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
671	else \
672		true; \
673	fi
674
675FRC:
676