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