xref: /illumos-gate/usr/src/lib/Makefile (revision c3a558e7c77127215b010652905be7916ec5a080)
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 (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24
25include ../Makefile.master
26
27#	Note that libcurses installs commands along with its library.
28#	This is a minor bug which probably should be fixed.
29#	Note also that a few extra libraries are kept in cmd source.
30#
31# Certain libraries are linked with, hence depend on, other libraries.
32#
33# Although we have historically used .WAIT to express dependencies, it
34# reduces the amount of parallelism and thus lengthens the time it
35# takes to build the libraries.  Thus, we now require that any new
36# libraries explicitly call out their dependencies.  Eventually, all
37# the library dependencies will be called out explicitly.  See
38# "Library interdependencies" near the end of this file.
39#
40# Aside from explicit dependencies (and legacy .WAITs), all libraries
41# are built in parallel.
42#
43.PARALLEL:
44
45#
46# The $(CLOSED_BUILD) additions to SUBDIRS & MSGSUBDIRS are unfortunate,
47# but required due to the "dependencies" of using .WAIT to barrier the
48# parallel dmake builds.  once 4631488 has been fixed, they can be
49# consolidated into one $(CLOSED_BUILD)SUBDIRS += (all closed libs) as
50# shown in HDRSUBDIRS
51#
52SUBDIRS= \
53	common			.WAIT	\
54	../cmd/sgs/libconv		\
55	../cmd/sgs/libdl	.WAIT
56
57$(CLOSED_BUILD)SUBDIRS += \
58	$(CLOSED)/lib/libc_i18n
59
60SUBDIRS += \
61	libc			.WAIT	\
62	../cmd/sgs/libelf	.WAIT	\
63	c_synonyms			\
64	libmd				\
65	libmd5				\
66	librsm				\
67	libmp			.WAIT	\
68	libnsl			\
69	libsecdb		.WAIT	\
70	librpcsvc			\
71	libsocket		.WAIT	\
72	libsctp			\
73	libsip			\
74	libcommputil		\
75	libresolv			\
76	libresolv2		.WAIT	\
77	libw			.WAIT	\
78	libintl			.WAIT	\
79	../cmd/sgs/librtld_db	\
80	libaio			\
81	libast			\
82	libdll			\
83	libcmd			\
84	libshell		\
85	libsum			\
86	librt			\
87	libadm			\
88	libctf			\
89	libdtrace		\
90	libdtrace_jni		\
91	libcurses		\
92	libgen			\
93	libgss			\
94	libpam			\
95	libuuid			\
96	libthread		\
97	libpthread	.WAIT	\
98	libslp		\
99	libbsdmalloc	\
100	libdoor		\
101	libdevinfo	\
102	libdladm	\
103	libdlpi		\
104	libeti		\
105	libcrypt	\
106	libdns_sd	\
107	libefi		\
108	libfstyp	\
109	libwanboot	\
110	libwanbootutil	\
111	libcryptoutil	\
112	libinetcfg	\
113	libinetutil	\
114	libipadm	\
115	libipmp		\
116	libiscsit	\
117	libkmf		\
118	libkstat	\
119	libkvm		\
120	liblm		\
121	libmalloc	\
122	libmapmalloc	\
123	libmtmalloc	\
124	libnls		\
125	libnwam		\
126	libsmbios	\
127	libtecla	\
128	libumem		\
129	libnvpair	.WAIT	\
130	libexacct	\
131	libplot		\
132	libldap4	\
133	libsasl		\
134	libldap5	\
135	libsldap	.WAIT	\
136	libbsm		\
137	libsys		\
138	libsysevent	\
139	libnisdb	\
140	libpool		\
141	libpp		\
142	libproc		\
143	libproject	\
144	libsendfile	\
145	nametoaddr	\
146	ncad_addr	\
147	hbaapi		\
148	smhba		\
149	sun_fc		\
150	sun_sas		\
151	gss_mechs/mech_krb5	.WAIT	\
152	libkrb5	.WAIT	\
153	krb5	.WAIT	\
154	libsmbfs	\
155	libfcoe		\
156	libsrpt		\
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	libipadm	\
339	libnsl		\
340	libnwam		\
341	libpam		\
342	libpicl		\
343	libpool		\
344	libpkg		\
345	libpp		\
346	libscf		\
347	libsasl		\
348	libldap5	\
349	libsecdb	\
350	libshare	\
351	libshell	\
352	libsldap	\
353	libslp		\
354	libsmbfs	\
355	libsmedia	\
356	libsum		\
357	libtsol		\
358	libuutil	\
359	libvrrpadm	\
360	libvscan	\
361	libwanboot	\
362	libwanbootutil	\
363	libzfs		\
364	libzonecfg	\
365	lvm		\
366	madv		\
367	mms		\
368	mpss		\
369	pam_modules	\
370	pyzfs		\
371	pysolaris	\
372	rpcsec_gss	\
373	libreparse
374MSGSUBDIRS += \
375	$($(MACH)_MSGSUBDIRS)
376
377sparc_MSGSUBDIRS=	\
378	libprtdiag	\
379	libprtdiag_psr
380
381i386_MSGSUBDIRS= libfdisk
382
383HDRSUBDIRS=		\
384	auditd_plugins	\
385	libast		\
386	libbrand	\
387	libbsm		\
388	libc		\
389	libcmd		\
390	libcmdutils	\
391	libcommputil	\
392	libcontract	\
393	libcpc		\
394	libctf		\
395	libcurses	\
396	libcryptoutil	\
397	libdevice	\
398	libdevid	\
399	libdevinfo	\
400	libdiskmgt	\
401	libdladm	\
402	libdll		\
403	libdlpi		\
404	libdhcpagent	\
405	libdhcpsvc	\
406	libdhcputil	\
407	libdisasm	\
408	libdns_sd	\
409	libdscfg	\
410	libdtrace	\
411	libdtrace_jni	\
412	libelfsign	\
413	libeti		\
414	libfru		\
415	libfstyp	\
416	libgen		\
417	libipadm	\
418	libipsecutil	\
419	libinetcfg	\
420	libinetsvc	\
421	libinetutil	\
422	libinstzones	\
423	libipmi		\
424	libipmp		\
425	libipp		\
426	libiscsit	\
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	libsmbios	\
451	librestart	\
452	librpcsvc	\
453	librsm		\
454	librstp		\
455	libsasl		\
456	libsec		\
457	libshell	\
458	libslp		\
459	libsmedia	\
460	libsocket	\
461	libsqlite	\
462	libfcoe		\
463	libsrpt		\
464	libstmf		\
465	libstmfproxy	\
466	libsum		\
467	libsysevent	\
468	libtecla	\
469	libtnf		\
470	libtnfctl	\
471	libtnfprobe	\
472	libtsnet	\
473	libtsol		\
474	libvrrpadm	\
475	libvolmgt	\
476	libumem		\
477	libunistat	\
478	libuutil	\
479	libwanboot	\
480	libwanbootutil	\
481	libwrap		\
482	libxcurses2	\
483	libzfs		\
484	libzfs_jni	\
485	libzoneinfo	\
486	hal		\
487	policykit	\
488	lvm		\
489	pkcs11		\
490	passwdutil	\
491	../cmd/sendmail/libmilter	\
492	fm		\
493	udapl		\
494	libmapid	\
495	libkrb5		\
496	libsmbfs	\
497	libshare	\
498	libidmap	\
499	libvscan	\
500	libgrubmgmt	\
501	smbsrv		\
502	libilb		\
503	scsi		\
504	hbaapi		\
505	smhba		\
506	libima		\
507	libsun_ima	\
508	mpapi		\
509	mms		\
510	libreparse	\
511	$($(MACH)_HDRSUBDIRS)
512
513$(CLOSED_BUILD)HDRSUBDIRS += \
514	$(CLOSED)/lib/libc_i18n	\
515	$(CLOSED)/lib/libike
516
517i386_HDRSUBDIRS=	\
518	libparted	\
519	libfdisk
520
521sparc_HDRSUBDIRS=	\
522	libds		\
523	libdscp		\
524	libpri		\
525	libv12n		\
526	storage
527
528all :=		TARGET= all
529check :=	TARGET= check
530clean :=	TARGET= clean
531clobber :=	TARGET= clobber
532install :=	TARGET= install
533install_h :=	TARGET= install_h
534lint :=		TARGET= lint
535_dc :=		TARGET= _dc
536_msg :=		TARGET= _msg
537
538.KEEP_STATE:
539
540#
541# For the all and install targets, we clearly must respect library
542# dependencies so that the libraries link correctly.  However, for
543# the remaining targets (check, clean, clobber, install_h, lint, _dc
544# and _msg), libraries do not have any dependencies on one another
545# and thus respecting dependencies just slows down the build.
546# As such, for these rules, we use pattern replacement to explicitly
547# avoid triggering the dependency information.  Note that for clean,
548# clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
549# $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
550#
551
552all:			$(SUBDIRS)
553
554install:		$(SUBDIRS) .WAIT install_extra
555
556# extra libraries kept in other source areas
557install_extra:
558	@cd ../cmd/sgs; pwd; $(MAKE) install_lib
559	@pwd
560
561clean clobber lint:	$(NOWAIT_SUBDIRS:%=%-nodepend)
562
563install_h check:	$(HDRSUBDIRS:%=%-nodepend)
564
565_msg:			$(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
566
567_dc:			$(DCSUBDIRS:%=%-nodepend)
568
569#
570# Library interdependencies are called out explicitly here
571#
572auditd_plugins: libbsm libnsl libsecdb
573gss_mechs/mech_krb5:	libgss libnsl libsocket libresolv pkcs11
574libadt_jni:	libbsm
575$(CLOSED_BUILD)libc:		$(CLOSED)/lib/libc_i18n
576libast: 	libsocket
577libadutils: 	libldap5 libresolv libsocket libnsl
578nsswitch:	libadutils libidmap
579libbsm:		libtsol
580libcmd: 	libsum libast libsocket libnsl
581libcmdutils:	libavl
582libcontract:	libnvpair
583libdevid:	libdevinfo
584libdevinfo:	libnvpair libsec
585libdhcpagent:	libsocket libdhcputil libuuid libdlpi libcontract
586libdhcpsvc:	libinetutil
587libdhcputil:	libnsl libgen libinetutil libdlpi
588libdladm:	libdevinfo libinetutil libsocket libscf librcm libnvpair \
589		libexacct libnsl libkstat libcurses
590libdll: 	libast
591libdlpi:	libinetutil libdladm
592libds:		libsysevent
593libdscfg:	libnsctl libunistat libsocket libnsl
594libdtrace:	libproc libgen libctf
595libdtrace_jni:	libuutil libdtrace
596libefi:		libuuid
597libfstyp:	libnvpair
598libelfsign:	libcryptoutil libkmf
599libidmap:	libadutils libldap5 libavl libsldap
600libinetcfg:	libnsl libsocket libdlpi libinetutil
601libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
602		libdladm libsecdb
603libiscsit:	libc libnvpair libstmf libuuid libnsl
604libkmf:		libcryptoutil pkcs11
605libnsl:		libmd5 libscf
606libmapid:	libresolv
607librdc:		libsocket libnsl libnsctl libunistat libdscfg
608libuuid:	libdlpi
609$(CLOSED_BUILD)libike:	libipsecutil libxnet libcryptoutil
610libinetutil:	libsocket
611libipsecutil:	libtecla libsocket
612libinstzones:	libzonecfg libcontract
613libpkg:		libwanboot libscf libadm
614libnwam:	libscf
615libsecdb:	libnsl
616libsasl:	libgss libsocket pkcs11 libmd
617sasl_plugins:	pkcs11 libgss libsocket libsasl
618libsctp:	libsocket
619libshell:	libast libcmd libdll libsocket libsecdb
620libsip:		libmd5
621libsmbfs:	libsocket libnsl libkrb5
622libsocket:	libnsl
623libstmfproxy: 	libstmf libsocket libnsl libpthread
624libsum: 	libast
625libsysevent:	libsecdb
626libldap5:	libsasl libsocket libnsl libmd
627libsldap:	libldap5 libtsol libnsl libc libscf libresolv
628libpool:	libnvpair libexacct
629libpp:		libast
630libzonecfg:	libc libsocket libnsl libuuid libnvpair libsysevent libsec \
631		libbrand libpool libscf
632libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
633libproject:	libpool libproc libsecdb
634libtsnet:	libnsl libtsol libsecdb
635libwrap:	libnsl libsocket
636libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
637		libdhcputil
638libwanbootutil:	libnsl
639pam_modules:	libproject passwdutil smbsrv
640libscf:		libuutil libmd libgen libsmbios
641libinetsvc:	libscf
642librestart:	libuutil libscf
643../cmd/sgs/libdl:	../cmd/sgs/libconv
644../cmd/sgs/libelf:	../cmd/sgs/libconv
645pkcs11:		libcryptoutil
646print:		libldap5
647udapl/udapl_tavor:	udapl/libdat
648libzfs:		libdevid libgen libnvpair libuutil \
649		libadm libavl libefi libidmap libmd
650libzfs_jni:	libdiskmgt libnvpair libzfs
651libzpool:	libavl libumem libnvpair
652libsec:		libavl libidmap
653brand:		libc libsocket
654libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
655libexacct/demo:	libexacct libproject libsocket libnsl
656libtsalarm:	libpcp
657smbsrv:		libsocket libnsl libmd libxnet libpthread librt \
658		libshare libidmap pkcs11 libsqlite libcryptoutil libreparse
659libv12n:	libds libuuid
660libvrrpadm:	libsocket libdladm libscf
661libvscan:	libscf
662scsi:		libnvpair
663mpapi:		libpthread libdevinfo libsysevent libnvpair
664sun_fc:		libdevinfo libsysevent libnvpair
665libsun_ima:	libdevinfo libsysevent libnsl
666sun_sas:	libdevinfo libsysevent libnvpair libkstat libdevid
667libgrubmgmt:	libdevinfo libzfs libfstyp
668pyzfs:		libnvpair libzfs
669pysolaris:	libsec libidmap
670libreparse:	libnvpair
671libhotplug:	libnvpair
672cfgadm_plugins:	libhotplug
673libilb:		libsocket
674$(INTEL_BUILD)libdiskmgt:libfdisk
675
676#
677# The reason this rule checks for the existence of the
678# Makefile is that some of the directories do not exist
679# in certain situations (e.g., exportable source builds,
680# OpenSolaris).
681#
682$(SUBDIRS): FRC
683	@if [ -f $@/Makefile  ]; then \
684		cd $@; pwd; $(MAKE) $(TARGET); \
685	else \
686		true; \
687	fi
688
689$(SUBDIRS:%=%-nodepend):
690	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
691		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
692	else \
693		true; \
694	fi
695
696FRC:
697