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