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