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