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