Merge commit '0b2e8253986c5c761129b58cfdac46d204903de1'
[unleashed.git] / usr / src / lib / Makefile
blob51e4bc9e154a6477550bf953ac8aeab3f3baf109
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2012 by Delphix. All rights reserved.
25 # Copyright 2015, Joyent, Inc.
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 2018 Nexenta Systems, Inc.
31 # Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
34 include ../Makefile.master
36 # Note that libcurses installs commands along with its library.
37 # This is a minor bug which probably should be fixed.
38 # Note also that a few extra libraries are kept in cmd source.
40 # Certain libraries are linked with, hence depend on, other libraries.
41 # Library dependencies are called out explicitly, see "Library
42 # interdependencies" below.
43 .PARALLEL:
45 # Build libc and its dependencies
46 SUBDIRS= \
47 crt \
48 ../cmd/sgs/libconv \
49 ../cmd/sgs/libdl \
50 libc \
51 .WAIT
53 # Build libraries with lots of dependents
54 SUBDIRS += \
55 libm \
56 libmd \
57 libmp \
58 libnsl \
59 libnvpair \
60 .WAIT
62 # Build everything else. Aside from explicit dependencies, all libraries
63 # are built in parallel.
64 SUBDIRS += \
65 ../cmd/sgs/libelf \
66 ../cmd/sgs/librtld_db \
67 abi \
68 auditd_plugins \
69 brand \
70 cfgadm_plugins \
71 crypt_modules \
72 extendedFILE \
73 fm \
74 getloginx \
75 gss_mechs/mech_dh \
76 gss_mechs/mech_dummy \
77 gss_mechs/mech_krb5 \
78 gss_mechs/mech_spnego \
79 hal \
80 hbaapi \
81 krb5 \
82 libadm \
83 libads \
84 libadutils \
85 libaio \
86 libast \
87 libavl \
88 libbe \
89 libbrand \
90 libbsdmalloc \
91 libbsm \
92 libc_db \
93 libcfgadm \
94 libcmd \
95 libcmdutils \
96 libcommputil \
97 libcontract \
98 libcpc \
99 libcrypt \
100 libcryptoutil \
101 libctf \
102 libdevice \
103 libdevid \
104 libdevinfo \
105 libdhcpagent \
106 libdhcputil \
107 libdisasm \
108 libdiskmgt \
109 libdladm \
110 libdll \
111 libdlpi \
112 libdns_sd \
113 libdoor \
114 libdtrace \
115 libdwarf \
116 libefi \
117 libelfsign \
118 libeti \
119 libexacct \
120 libexacct/demo \
121 libfcoe \
122 libficl \
123 libfru \
124 libfruutils \
125 libfsmgt \
126 libfstyp \
127 libgen \
128 libgss \
129 libhotplug \
130 libidmap \
131 libilb \
132 libima \
133 libinetsvc \
134 libinetutil \
135 libintl \
136 libipadm \
137 libipd \
138 libipmi \
139 libipmp \
140 libipp \
141 libipsecutil \
142 libiscsit \
143 libkmf \
144 libkrb5 \
145 libkstat \
146 libkvm \
147 libldap5 \
148 liblgrp \
149 liblm \
150 libmail \
151 libmalloc \
152 libmapid \
153 libmapmalloc \
154 libmd5 \
155 libmlrpc \
156 libmtmalloc \
157 libmvec \
158 libndmp \
159 libnisdb \
160 libnls \
161 libnwam \
162 libofmt \
163 libpam \
164 libpcidb \
165 libpctx \
166 libpicl \
167 libpicltree \
168 libpool \
169 libpp \
170 libproc \
171 libproject \
172 libpthread \
173 libraidcfg \
174 librcm \
175 librdc \
176 libreparse \
177 libresolv \
178 libresolv2 \
179 librestart \
180 librpcsvc \
181 librsm \
182 librstp \
183 librt \
184 libsasl \
185 libscf \
186 libsched \
187 libsctp \
188 libsec \
189 libsecdb \
190 libsendfile \
191 libsff \
192 libshare \
193 libshell \
194 libsip \
195 libsldap \
196 libsmbfs \
197 libsmbios \
198 libsmedia \
199 libsqlite \
200 libsrpt \
201 libstmf \
202 libsum \
203 libsun_ima \
204 libsys \
205 libsysevent \
206 libtecla \
207 libthread \
208 libumem \
209 libuuid \
210 libuutil \
211 libvolmgt \
212 libvrrpadm \
213 libvscan \
214 libw \
215 libwrap \
216 libzfs \
217 libzfs_core \
218 libzonecfg \
219 libzonestat \
220 libzpool \
221 madv \
222 mpapi \
223 mpss \
224 nametoaddr \
225 ncad_addr \
226 nsswitch \
227 pam_modules \
228 passwdutil \
229 pkcs11 \
230 policykit \
231 pylibbe \
232 pysolaris \
233 pyzfs \
234 raidcfg_plugins \
235 rpcsec_gss \
236 sasl_plugins \
237 scsi \
238 smbsrv \
239 smhba \
240 sun_fc \
241 sun_sas \
242 udapl \
243 watchmalloc \
244 $($(MACH)_SUBDIRS)
246 i386_SUBDIRS= \
247 libfdisk \
248 libsaveargs
250 sparc_SUBDIRS= \
251 efcode \
252 libds \
253 libdscp \
254 libprtdiag \
255 libprtdiag_psr \
256 libpri \
257 librsc \
258 storage \
259 libpcp \
260 libtsalarm \
261 libv12n
264 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
265 # clean and clobber targets (for more information, see those targets, below).
267 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
269 DCSUBDIRS=
271 MSGSUBDIRS= \
272 abi \
273 auditd_plugins \
274 brand \
275 cfgadm_plugins \
276 gss_mechs/mech_dh \
277 gss_mechs/mech_krb5 \
278 krb5 \
279 libast \
280 libbsm \
281 libc \
282 libcfgadm \
283 libcmd \
284 libcontract \
285 libdhcputil \
286 libdiskmgt \
287 libdladm \
288 libdll \
289 libgss \
290 libidmap \
291 libilb \
292 libipadm \
293 libipmp \
294 libipsecutil \
295 libldap5 \
296 libnwam \
297 libofmt \
298 libpam \
299 libpicl \
300 libpool \
301 libpp \
302 libreparse \
303 libsasl \
304 libscf \
305 libsecdb \
306 libshare \
307 libshell \
308 libsldap \
309 libsmbfs \
310 libsmedia \
311 libsum \
312 libuutil \
313 libvrrpadm \
314 libvscan \
315 libzfs \
316 libzonecfg \
317 madv \
318 mpss \
319 pam_modules \
320 rpcsec_gss \
321 $($(MACH)_MSGSUBDIRS)
323 sparc_MSGSUBDIRS= \
324 libprtdiag \
325 libprtdiag_psr
327 i386_MSGSUBDIRS= libfdisk
329 HDRSUBDIRS= \
330 auditd_plugins \
331 fm \
332 hal \
333 hbaapi \
334 libads \
335 libast \
336 libbrand \
337 libbsm \
338 libc \
339 libcmd \
340 libcmdutils \
341 libcommputil \
342 libcontract \
343 libcpc \
344 libcryptoutil \
345 libctf \
346 libdevice \
347 libdevid \
348 libdevinfo \
349 libdhcpagent \
350 libdhcputil \
351 libdisasm \
352 libdiskmgt \
353 libdwarf \
354 libdladm \
355 libdll \
356 libdlpi \
357 libdns_sd \
358 libdtrace \
359 libelfsign \
360 libeti \
361 libfcoe \
362 libfru \
363 libfstyp \
364 libgen \
365 libidmap \
366 libilb \
367 libima \
368 libinetsvc \
369 libinetutil \
370 libipadm \
371 libipd \
372 libipmi \
373 libipmp \
374 libipp \
375 libipsecutil \
376 libiscsit \
377 libkrb5 \
378 libkstat \
379 libkvm \
380 libmail \
381 libmapid \
382 libmd \
383 libmlrpc \
384 libmtmalloc \
385 libndmp \
386 libnvpair \
387 libnwam \
388 libofmt \
389 libpam \
390 libpcidb \
391 libpctx \
392 libpicl \
393 libpicltree \
394 libpool \
395 libpp \
396 libproc \
397 libraidcfg \
398 librcm \
399 librdc \
400 libreparse \
401 librestart \
402 librpcsvc \
403 librsm \
404 librstp \
405 libsasl \
406 libscf \
407 libsec \
408 libsff \
409 libshare \
410 libshell \
411 libsip \
412 libsmbfs \
413 libsmbios \
414 libsmedia \
415 libsqlite \
416 libsrpt \
417 libstmf \
418 libsum \
419 libsun_ima \
420 libsysevent \
421 libtecla \
422 libumem \
423 libuutil \
424 libvolmgt \
425 libvrrpadm \
426 libvscan \
427 libwrap \
428 libzfs \
429 libzfs_core \
430 libzonestat \
431 mpapi \
432 passwdutil \
433 pkcs11 \
434 policykit \
435 scsi \
436 smbsrv \
437 smhba \
438 udapl \
439 $($(MACH)_HDRSUBDIRS)
441 i386_HDRSUBDIRS= \
442 libfdisk \
443 libsaveargs
445 sparc_HDRSUBDIRS= \
446 libds \
447 libdscp \
448 libpri \
449 libv12n \
450 storage
452 all := TARGET= all
453 check := TARGET= check
454 clean := TARGET= clean
455 clobber := TARGET= clobber
456 install := TARGET= install
457 install_h := TARGET= install_h
458 _dc := TARGET= _dc
459 _msg := TARGET= _msg
461 .KEEP_STATE:
464 # For the all and install targets, we clearly must respect library
465 # dependencies so that the libraries link correctly. However, for
466 # the remaining targets (check, clean, clobber, install_h, _dc, and
467 # _msg), libraries do not have any dependencies on one another and
468 # thus respecting dependencies just slows down the build. As such,
469 # for these rules, we use pattern replacement to explicitly avoid
470 # triggering the dependency information. Note that for clean and
471 # clobber, we must use $(NOWAIT_SUBDIRS) rather than $(SUBDIRS),
472 # to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
475 all: $(SUBDIRS)
477 install: $(SUBDIRS) .WAIT install_extra
479 # extra libraries kept in other source areas
480 install_extra:
481 @cd ../cmd/sgs; pwd; $(MAKE) install_lib
482 @pwd
484 clean clobber: $(NOWAIT_SUBDIRS:%=%-nodepend)
486 install_h check: $(HDRSUBDIRS:%=%-nodepend)
488 _msg: $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
490 _dc: $(DCSUBDIRS:%=%-nodepend)
492 # Library interdependencies are called out explicitly here.
493 ../cmd/sgs/libconv: crt
494 ../cmd/sgs/libdl: crt
495 libc: ../cmd/sgs/libconv ../cmd/sgs/libdl
497 libm: libc
498 libmd: libc
499 libmp: libc
500 libnsl: libc libmd libmp
501 libnvpair: libc libnsl
503 basedeps: libc libm libmd libmp libnsl libnvpair
504 basedeps := TARGET=install
506 # The following dependencies are currently required by libdbus-1 and should
507 # be used for anything linking against it.
508 dbusdeps: libsecdb libinetutil libscf libuutil libgen libsmbios
510 # The following dependencies don't need to be listed below as they are built
511 # before everything else:
512 # libc libm libmd libmp libnsl libnvpair
513 abi: libctf libmapmalloc libproc
514 auditd_plugins: libbsm libsecdb libgss libmtmalloc
515 brand: libzonecfg libmapmalloc
516 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
517 fm: libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
518 libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
519 libpcidb
520 hal: libbsm
521 $(SPARC_BLD)fm: libpri
522 gss_mechs/mech_dh: libgss
523 gss_mechs/mech_dummy: libgss
524 gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
525 gss_mechs/mech_spnego: gss_mechs/mech_krb5
526 hal: dbusdeps
527 krb5: gss_mechs/mech_krb5 libtecla libldap5
528 libadutils: libldap5 libresolv2
529 libbe: libzfs libzonecfg libuuid libgen libdevinfo libefi libficl
530 libbsm: libinetutil libscf libsecdb
531 libcfgadm: libdevinfo
532 libcmd: libsum libast
533 libcmdutils: libavl
534 libcpc: libpctx
535 libcrypt: libgen
536 libctf: libdwarf
537 libdevid: libdevinfo
538 libdevinfo: libsec libgen
539 libdhcpagent: libdhcputil libuuid libdlpi libcontract
540 libdhcputil: libgen libinetutil libdlpi
541 libdiskmgt: libdevid libdevinfo libadm libefi libkstat libsysevent
542 $(INTEL_BLD)libdiskmgt: libfdisk
543 libdladm: libdevinfo libinetutil libscf librcm libexacct libkstat \
544 libpool
545 libdll: libast
546 libdlpi: libinetutil libdladm
547 libds: libsysevent
548 libdtrace: libproc libgen libctf libmapmalloc
549 libefi: libuuid
550 libelfsign: libcryptoutil libkmf ../cmd/sgs/libelf
551 libexacct/demo: libexacct libproject
552 libfcoe: libdladm
553 libficl: libuuid libumem
554 libfru: libfruutils
555 libfsmgt: libkstat
556 libidmap: libavl libuutil
557 libinetsvc: libscf
558 libipadm: libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
559 libipmp: libinetutil
560 libipsecutil: libtecla
561 libiscsit: libstmf libuuid
562 libkmf: libcryptoutil pkcs11
563 libkvm: ../cmd/sgs/libelf
564 libldap5: libsasl
565 libmapid: libresolv2 libscf
566 libmlrpc: libsmbfs libuuid
567 libndmp: libscf
568 libnisdb: libldap5
569 libnwam: libscf libbsm libdladm libipadm
570 libpcp: libumem libdevinfo
571 libpctx: libproc
572 libpool: libscf libexacct
573 libpp: libast
574 libproc: ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
575 $(INTEL_BLD)libproc: libsaveargs
576 libproject: libpool libproc libsecdb
577 libprtdiag: libkstat
578 libprtdiag_psr: libprtdiag
579 libraidcfg: libdevinfo
580 librestart: libuutil libscf libpool libproject libsecdb libsysevent
581 libsasl: libgss pkcs11
582 libsaveargs: libdisasm
583 libscf: libuutil libgen libsmbios
584 libsec: libavl libidmap
585 libsff: libnvpair
586 libshare: libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
587 libshell: libast libcmd libdll libsecdb
588 libsip: libmd5
589 libsldap: libldap5 libscf
590 libsmbfs: libkrb5 libsec libidmap pkcs11
591 libsmbios: libdevinfo
592 libsrpt: libstmf
593 libstmf: libscf
594 libsum: libast
595 libsun_ima: libdevinfo libsysevent
596 libsysevent: libsecdb
597 libtsalarm: libpcp
598 libuuid: libdlpi
599 libv12n: libds libuuid
600 libvolmgt: libadm
601 libvrrpadm: libdladm libscf
602 libvscan: libscf libsecdb
603 libzfs: libdevid libgen libuutil libadm libavl libefi libidmap \
604 libumem libzfs_core
605 libzonecfg: libuuid libsysevent libsec libbrand libpool libscf libproc \
606 libuutil libbsm libsecdb
607 libzonestat: libcmdutils libumem
608 libzpool: libavl libumem libcmdutils libsysevent
609 madv: libgen
610 mpapi: libpthread libdevinfo libsysevent
611 mpss: libgen
612 nsswitch: libadutils libidmap libdns_sd libscf libldap5 libsldap
613 pam_modules: libproject passwdutil smbsrv libpam libbsm libsecdb
614 passwdutil: libsldap
615 pkcs11: libcryptoutil libgen libuuid
616 policykit: dbusdeps
617 pylibbe: libbe libzfs
618 pysolaris: libsec libidmap
619 pyzfs: libzfs
620 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
621 rpcsec_gss: libgss
622 sasl_plugins: pkcs11 libgss libsasl
623 scsi: libfru libumem libdevid libdevinfo
624 smbsrv: libpthread librt libshare libidmap pkcs11 libsqlite \
625 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
626 libuuid libads libgss libldap5 krb5 libmlrpc
627 storage: libdevice libdevinfo libdevid
628 sun_fc: libdevinfo libsysevent
629 sun_sas: libdevinfo libsysevent libkstat libdevid
630 udapl: libdevinfo libdladm
633 # The reason this rule checks for the existence of the
634 # Makefile is that some of the directories do not exist
635 # in certain situations (e.g., exportable source builds,
636 # OpenSolaris).
638 $(SUBDIRS): FRC
639 @if [ -f $@/Makefile ]; then \
640 cd $@; pwd; $(MAKE) $(TARGET); \
641 else \
642 true; \
645 $(SUBDIRS:%=%-nodepend):
646 @if [ -f $(@:%-nodepend=%)/Makefile ]; then \
647 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
648 else \
649 true; \
652 FRC: