xref: /illumos-gate/usr/src/lib/Makefile (revision f06dce2c)
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#
23# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright (c) 2012 by Delphix. All rights reserved.
25# Copyright (c) 2012, Joyent, Inc. All rights reserved.
26# Copyright (c) 2013 Gary Mills
27# Copyright 2014 Garrett D'Amore <garrett@damore.org>
28# Copyright (c) 2015 Gary Mills
29# Copyright 2016 Toomas Soome <tsoome@me.com>
30# Copyright 2017 Nexenta Systems, Inc.
31# Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
32# Copyright 2017 RackTop Systems.
33#
34
35include ../Makefile.master
36
37#	Note that libcurses installs commands along with its library.
38#	This is a minor bug which probably should be fixed.
39#	Note also that a few extra libraries are kept in cmd source.
40#
41# Certain libraries are linked with, hence depend on, other libraries.
42# Library dependencies are called out explicitly, see "Library
43# interdependencies" below.
44.PARALLEL:
45
46# Build libc and its dependencies
47SUBDIRS=			\
48	crt			\
49	../cmd/sgs/libconv	\
50	../cmd/sgs/libdl	\
51	libc			\
52	.WAIT
53
54# Build libraries with lots of dependents
55SUBDIRS +=		\
56	libm		\
57	libmd		\
58	libmp		\
59	libnsl		\
60	libnvpair	\
61	libsocket	\
62	.WAIT
63
64# Build everything else. Aside from explicit dependencies, all libraries
65# are built in parallel.
66SUBDIRS +=				\
67	../cmd/sendmail/libmilter	\
68	../cmd/sgs/libelf	\
69	../cmd/sgs/librtld_db	\
70	abi		\
71	auditd_plugins	\
72	brand		\
73	c_synonyms	\
74	cfgadm_plugins	\
75	crypt_modules	\
76	extendedFILE	\
77	fm		\
78	getloginx	\
79	gss_mechs/mech_dh	\
80	gss_mechs/mech_dummy	\
81	gss_mechs/mech_krb5	\
82	gss_mechs/mech_spnego	\
83	hal		\
84	hbaapi		\
85	krb5		\
86	libadm		\
87	libads		\
88	libadt_jni	\
89	libadutils	\
90	libaio		\
91	libast		\
92	libavl		\
93	libbe		\
94	libbrand	\
95	libbsdmalloc	\
96	libbsm		\
97	libc_db		\
98	libcfgadm	\
99	libcmd		\
100	libcmdutils	\
101	libcommputil	\
102	libcontract	\
103	libcpc		\
104	libcrypt	\
105	libcryptoutil	\
106	libctf		\
107	libcurses	\
108	libdevice	\
109	libdevid	\
110	libdevinfo	\
111	libdhcpagent	\
112	libdhcputil	\
113	libdisasm	\
114	libdiskmgt	\
115	libdladm	\
116	libdll		\
117	libdlpi		\
118	libdns_sd	\
119	libdoor		\
120	libdscfg	\
121	libdtrace	\
122	libdtrace_jni	\
123	libefi		\
124	libelfsign	\
125	libeti		\
126	libexacct	\
127	libexacct/demo	\
128	libfakekernel	\
129	libfcoe		\
130	libficl		\
131	libfru		\
132	libfruutils	\
133	libfsmgt	\
134	libfstyp	\
135	libgen		\
136	libgrubmgmt	\
137	libgss		\
138	libhotplug	\
139	libidmap	\
140	libilb		\
141	libima		\
142	libinetsvc	\
143	libinetutil	\
144	libinstzones	\
145	libintl		\
146	libipadm	\
147	libipd		\
148	libipmi		\
149	libipmp		\
150	libipp		\
151	libipsecutil	\
152	libiscsit	\
153	libkmf		\
154	libkrb5		\
155	libkstat	\
156	libkvm		\
157	libldap5	\
158	liblgrp		\
159	liblm		\
160	libm1		\
161	libmail		\
162	libmalloc	\
163	libmapid	\
164	libmapmalloc	\
165	libmd5		\
166	libmtmalloc	\
167	libmvec		\
168	libndmp		\
169	libnisdb	\
170	libnls		\
171	libnsctl	\
172	libnwam		\
173	libofmt		\
174	libpam		\
175	libpcidb	\
176	libpctx		\
177	libpicl		\
178	libpicltree	\
179	libpkg		\
180	libpool		\
181	libpp		\
182	libproc		\
183	libproject	\
184	libpthread	\
185	libraidcfg	\
186	librcm		\
187	librdc		\
188	libreparse	\
189	libresolv	\
190	libresolv2	\
191	librestart	\
192	librpcsvc	\
193	librsm		\
194	librstp		\
195	librt		\
196	libsasl		\
197	libscf		\
198	libsched	\
199	libsctp		\
200	libsec		\
201	libsecdb	\
202	libsendfile	\
203	libsff		\
204	libshare	\
205	libshell	\
206	libsip		\
207	libsldap	\
208	libslp		\
209	libsmbfs	\
210	libsmbios	\
211	libsmedia	\
212	libsqlite	\
213	libsrpt		\
214	libstmf		\
215	libstmfproxy	\
216	libsum		\
217	libsun_ima	\
218	libsys		\
219	libsysevent	\
220	libtecla	\
221	libtermcap	\
222	libthread	\
223	libtnf		\
224	libtnfctl	\
225	libtnfprobe	\
226	libtsnet	\
227	libtsol		\
228	libumem		\
229	libunistat	\
230	libuuid		\
231	libuutil	\
232	libvolmgt	\
233	libvrrpadm	\
234	libvscan	\
235	libw		\
236	libwanboot	\
237	libwanbootutil	\
238	libwrap		\
239	libxcurses	\
240	libxcurses2	\
241	libxnet		\
242	libzfs		\
243	libzfs_core	\
244	libzfs_jni	\
245	libzonecfg	\
246	libzoneinfo	\
247	libzonestat	\
248	libzpool	\
249	madv		\
250	mpapi		\
251	mpss		\
252	nametoaddr	\
253	ncad_addr	\
254	nsswitch	\
255	pam_modules	\
256	passwdutil	\
257	pkcs11		\
258	policykit	\
259	print		\
260	pylibbe		\
261	pysolaris	\
262	pyzfs		\
263	raidcfg_plugins	\
264	rpcsec_gss	\
265	sasl_plugins	\
266	scsi		\
267	smbsrv		\
268	smhba		\
269	sun_fc		\
270	sun_sas		\
271	udapl		\
272	watchmalloc	\
273	$($(MACH)_SUBDIRS)
274
275i386_SUBDIRS=		\
276	libfdisk	\
277	libsaveargs
278
279sparc_SUBDIRS=		\
280	efcode		\
281	libds		\
282	libdscp		\
283	libprtdiag	\
284	libprtdiag_psr	\
285	libpri		\
286	librsc		\
287	storage		\
288	libpcp		\
289	libtsalarm	\
290	libv12n
291
292#
293# Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
294# clean and clobber targets (for more information, see those targets, below).
295#
296NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
297
298DCSUBDIRS=
299
300MSGSUBDIRS=		\
301	abi		\
302	auditd_plugins	\
303	brand		\
304	cfgadm_plugins	\
305	gss_mechs/mech_dh	\
306	gss_mechs/mech_krb5	\
307	krb5		\
308	libast		\
309	libbsm		\
310	libc		\
311	libcfgadm	\
312	libcmd		\
313	libcontract	\
314	libcurses	\
315	libdhcputil	\
316	libdiskmgt	\
317	libdladm	\
318	libdll		\
319	libgrubmgmt	\
320	libgss		\
321	libidmap	\
322	libilb		\
323	libinstzones	\
324	libipadm	\
325	libipmp		\
326	libipsecutil	\
327	libldap5	\
328	libnsl		\
329	libnwam		\
330	libofmt		\
331	libpam		\
332	libpicl		\
333	libpkg		\
334	libpool		\
335	libpp		\
336	libreparse	\
337	libsasl		\
338	libscf		\
339	libsecdb	\
340	libshare	\
341	libshell	\
342	libsldap	\
343	libslp		\
344	libsmbfs	\
345	libsmedia	\
346	libsum		\
347	libtsol		\
348	libuutil	\
349	libvrrpadm	\
350	libvscan	\
351	libwanboot	\
352	libwanbootutil	\
353	libzfs		\
354	libzonecfg	\
355	madv		\
356	mpss		\
357	pam_modules	\
358	pyzfs		\
359	rpcsec_gss	\
360	$($(MACH)_MSGSUBDIRS)
361
362sparc_MSGSUBDIRS=	\
363	libprtdiag	\
364	libprtdiag_psr
365
366i386_MSGSUBDIRS= libfdisk
367
368HDRSUBDIRS=				\
369	../cmd/sendmail/libmilter	\
370	auditd_plugins	\
371	fm		\
372	hal		\
373	hbaapi		\
374	libads		\
375	libast		\
376	libbrand	\
377	libbsm		\
378	libc		\
379	libcmd		\
380	libcmdutils	\
381	libcommputil	\
382	libcontract	\
383	libcpc		\
384	libcryptoutil	\
385	libctf		\
386	libcurses	\
387	libdevice	\
388	libdevid	\
389	libdevinfo	\
390	libdhcpagent	\
391	libdhcputil	\
392	libdisasm	\
393	libdiskmgt	\
394	libdladm	\
395	libdll		\
396	libdlpi		\
397	libdns_sd	\
398	libdscfg	\
399	libdtrace	\
400	libdtrace_jni	\
401	libelfsign	\
402	libeti		\
403	libfakekernel	\
404	libfcoe		\
405	libfru		\
406	libfstyp	\
407	libgen		\
408	libgrubmgmt	\
409	libidmap	\
410	libilb		\
411	libima		\
412	libinetsvc	\
413	libinetutil	\
414	libinstzones	\
415	libipadm	\
416	libipd		\
417	libipmi		\
418	libipmp		\
419	libipp		\
420	libipsecutil	\
421	libiscsit	\
422	libkrb5		\
423	libkstat	\
424	libkvm		\
425	libmail		\
426	libmapid	\
427	libmd		\
428	libmtmalloc	\
429	libndmp		\
430	libnsctl	\
431	libnsl		\
432	libnvpair	\
433	libnwam		\
434	libofmt		\
435	libpam		\
436	libpcidb	\
437	libpctx		\
438	libpicl		\
439	libpicltree	\
440	libpool		\
441	libpp		\
442	libproc		\
443	libraidcfg	\
444	librcm		\
445	librdc		\
446	libreparse	\
447	librestart	\
448	librpcsvc	\
449	librsm		\
450	librstp		\
451	libsasl		\
452	libscf		\
453	libsec		\
454	libsff		\
455	libshare	\
456	libshell	\
457	libsip		\
458	libslp		\
459	libsmbfs	\
460	libsmbios	\
461	libsmedia	\
462	libsocket	\
463	libsqlite	\
464	libsrpt		\
465	libstmf		\
466	libstmfproxy	\
467	libsum		\
468	libsun_ima	\
469	libsysevent	\
470	libtecla	\
471	libtermcap	\
472	libtnf		\
473	libtnfctl	\
474	libtnfprobe	\
475	libtsnet	\
476	libtsol		\
477	libumem		\
478	libunistat	\
479	libuutil	\
480	libvolmgt	\
481	libvrrpadm	\
482	libvscan	\
483	libwanboot	\
484	libwanbootutil	\
485	libwrap		\
486	libxcurses2	\
487	libzfs		\
488	libzfs_core	\
489	libzfs_jni	\
490	libzoneinfo	\
491	libzonestat	\
492	mpapi		\
493	passwdutil	\
494	pkcs11		\
495	policykit	\
496	scsi		\
497	smbsrv		\
498	smhba		\
499	udapl		\
500	$($(MACH)_HDRSUBDIRS)
501
502i386_HDRSUBDIRS=	\
503	libfdisk	\
504	libsaveargs
505
506sparc_HDRSUBDIRS=	\
507	libds		\
508	libdscp		\
509	libpri		\
510	libv12n		\
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# Library interdependencies are called out explicitly here.
555../cmd/sgs/libconv: crt
556../cmd/sgs/libdl: crt
557libc:		../cmd/sgs/libconv ../cmd/sgs/libdl
558
559libm:		libc
560libmd:		libc
561libmp:		libc
562libnsl:		libc libmd libmp
563libnvpair:	libc libnsl
564libsocket:	libc libnsl
565
566basedeps:	libc libm libmd libmp libnsl libnvpair libsocket
567basedeps :=	TARGET=install
568
569# The following dependencies are currently required by libdbus-1 and should
570# be used for anything linking against it.
571dbusdeps:	libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
572
573# The following dependencies don't need to be listed below as they are built
574# before everything else:
575# libc libm libmd libmp libnsl libnvpair libsocket
576abi:		libctf libmapmalloc libproc
577auditd_plugins: libbsm libsecdb libgss libmtmalloc
578brand:		libzonecfg libmapmalloc
579cfgadm_plugins:	libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
580fm:		libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
581		libcontract libsysevent ../cmd/sgs/libelf libdladm
582$(SPARC_BLD)fm:	libpri
583gss_mechs/mech_dh: libgss
584gss_mechs/mech_dummy: libgss
585gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
586gss_mechs/mech_spnego: gss_mechs/mech_krb5
587hal:		dbusdeps
588krb5:		gss_mechs/mech_krb5 libtecla libldap5
589libadt_jni:	libbsm
590libadutils:	libldap5 libresolv2
591libbe:		libzfs libinstzones libuuid libgen libdevinfo libefi libficl
592libbsm:		libinetutil libscf libsecdb libtsol
593libcfgadm:	libdevinfo
594libcmd:		libsum libast
595libcmdutils:	libavl
596libcpc:		libpctx
597libcrypt:	libgen
598libdevid:	libdevinfo
599libdevinfo:	libsec libgen
600libdhcpagent:	libdhcputil libuuid libdlpi libcontract
601libdhcputil:	libgen libinetutil libdlpi
602libdiskmgt:	libdevid libdevinfo libadm libefi libkstat libsysevent
603$(INTEL_BLD)libdiskmgt: libfdisk
604libdladm:	libdevinfo libinetutil libscf librcm libexacct libkstat \
605		libpool
606libdll: 	libast
607libdlpi:	libinetutil libdladm
608libds:		libsysevent
609libdscfg:	libnsctl libunistat libadm
610libdtrace:	libproc libgen libctf libmapmalloc
611libdtrace_jni:	libuutil libdtrace
612libefi:		libuuid
613libelfsign:	libcryptoutil libkmf ../cmd/sgs/libelf
614libeti:		libcurses
615libexacct/demo:	libexacct libproject
616libfakekernel:	libumem libcryptoutil
617libfcoe:	libdladm
618libficl:	libuuid libumem
619libfru:		libfruutils
620libfsmgt:	libkstat
621libgrubmgmt:	libdevinfo libzfs libfstyp libefi
622$(INTEL_BLD)libgrubmgmt: libfdisk
623libidmap:	libavl libuutil
624libinetsvc:	libscf
625libinstzones:	libzonecfg libcontract
626libipadm:	libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
627libipmp:	libinetutil
628libipsecutil:	libtecla libtsol
629libiscsit:	libstmf libuuid
630libkmf:		libcryptoutil pkcs11
631libkvm:		../cmd/sgs/libelf
632libldap5:	libsasl
633libmapid:	libresolv2 libscf
634libndmp:	libscf
635libnisdb:	libldap5
636libnwam:	libscf libbsm libdladm libipadm
637libpcp:		libumem libdevinfo
638libpctx:	libproc
639libpkg:		libwanboot libscf libadm
640libpool:	libscf libexacct
641libpp:		libast
642libproc:	../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
643$(INTEL_BLD)libproc: libsaveargs
644libproject:	libpool libproc libsecdb
645libprtdiag:	libkstat
646libprtdiag_psr:	libprtdiag
647libraidcfg:	libdevinfo
648librdc:		libnsctl libunistat libdscfg
649librestart:	libuutil libscf libpool libproject libsecdb libsysevent
650libsasl:	libgss pkcs11
651libsaveargs:	libdisasm
652libscf:		libuutil libgen libsmbios
653libsec:		libavl libidmap
654libsff:		libnvpair
655libshare:	libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
656libshell:	libast libcmd libdll libsecdb
657libsip:		libmd5
658libsldap:	libldap5 libscf
659libsmbfs:	libkrb5 libsec libidmap pkcs11
660libsmbios:	libdevinfo
661libsrpt:	libstmf
662libstmf:	libscf
663libstmfproxy: 	libstmf libpthread
664libsum: 	libast
665libsun_ima:	libdevinfo libsysevent
666libsysevent:	libsecdb
667libtecla:	libcurses
668libtermcap:	libcurses
669libtnfctl:	../cmd/sgs/libelf
670libtsalarm:	libpcp
671libtsnet:	libtsol libsecdb
672libtsol:	libsecdb
673libuuid:	libdlpi
674libv12n:	libds libuuid
675libvolmgt:	libadm
676libvrrpadm:	libdladm libscf
677libvscan:	libscf libsecdb
678libwanboot:	libresolv2 libdevinfo libinetutil libdhcputil
679libzfs:		libdevid libgen libuutil libadm libavl libefi libidmap \
680		libumem libtsol libzfs_core
681libzfs_jni:	libdiskmgt libzfs
682libzonecfg:	libuuid libsysevent libsec libbrand libpool libscf libproc \
683		libuutil libbsm libsecdb
684libzonestat:	libcmdutils libumem
685libzpool:	libavl libumem libcmdutils libsysevent libfakekernel
686madv:		libgen
687mpapi:		libpthread libdevinfo libsysevent
688mpss:		libgen
689nsswitch:	libadutils libidmap libdns_sd libscf libldap5 libsldap
690pam_modules:	libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
691passwdutil:	libsldap
692pkcs11:		libcryptoutil libgen libuuid
693policykit:	dbusdeps
694print:		libldap5 libmd5 libsendfile
695pylibbe: 	libbe libzfs
696pysolaris:	libsec libidmap
697pyzfs:		libzfs
698raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
699rpcsec_gss:	libgss
700sasl_plugins:	pkcs11 libgss libsasl
701scsi:		libfru libumem libdevid libdevinfo
702smbsrv:		libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
703		libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
704		libuuid libfakekernel libads libgss libldap5 krb5
705storage:	libdevice libdevinfo libdevid
706sun_fc:		libdevinfo libsysevent
707sun_sas:	libdevinfo libsysevent libkstat libdevid
708udapl:		libdevinfo libdladm
709
710#
711# The reason this rule checks for the existence of the
712# Makefile is that some of the directories do not exist
713# in certain situations (e.g., exportable source builds,
714# OpenSolaris).
715#
716$(SUBDIRS): FRC
717	@if [ -f $@/Makefile  ]; then \
718		cd $@; pwd; $(MAKE) $(TARGET); \
719	else \
720		true; \
721	fi
722
723$(SUBDIRS:%=%-nodepend):
724	@if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
725		cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
726	else \
727		true; \
728	fi
729
730FRC:
731