Merge commit 'cc543d0f9e35a75cc302a4cb152756d233299564'
[unleashed.git] / usr / src / lib / Makefile
blobcc495c4585bb869ea02f6d93bcafb2cde2769cf5
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 brand \
69 cfgadm_plugins \
70 crypt_modules \
71 extendedFILE \
72 fm \
73 getloginx \
74 gss_mechs/mech_dh \
75 gss_mechs/mech_dummy \
76 gss_mechs/mech_krb5 \
77 gss_mechs/mech_spnego \
78 hal \
79 hbaapi \
80 krb5 \
81 libadm \
82 libads \
83 libadutils \
84 libaio \
85 libast \
86 libavl \
87 libbe \
88 libbrand \
89 libbsdmalloc \
90 libc_db \
91 libcfgadm \
92 libcmd \
93 libcmdutils \
94 libcommputil \
95 libcontract \
96 libcpc \
97 libcrypt \
98 libcryptoutil \
99 libctf \
100 libcustr \
101 libdevice \
102 libdevid \
103 libdevinfo \
104 libdhcpagent \
105 libdhcputil \
106 libdisasm \
107 libdiskmgt \
108 libdladm \
109 libdll \
110 libdlpi \
111 libdns_sd \
112 libdoor \
113 libdtrace \
114 libdwarf \
115 libefi \
116 libelfsign \
117 libeti \
118 libexacct \
119 libexacct/demo \
120 libfcoe \
121 libficl \
122 libfsmgt \
123 libfstyp \
124 libgen \
125 libgss \
126 libhotplug \
127 libidmap \
128 libilb \
129 libima \
130 libinetsvc \
131 libinetutil \
132 libintl \
133 libipadm \
134 libipd \
135 libipmi \
136 libipmp \
137 libipp \
138 libipsecutil \
139 libiscsit \
140 libkmf \
141 libkrb5 \
142 libkstat \
143 libkvm \
144 libldap5 \
145 liblgrp \
146 liblm \
147 libmail \
148 libmalloc \
149 libmapid \
150 libmapmalloc \
151 libmd5 \
152 libmlrpc \
153 libmtmalloc \
154 libmvec \
155 libndmp \
156 libnisdb \
157 libnls \
158 libnwam \
159 libofmt \
160 libpam \
161 libpcidb \
162 libpctx \
163 libpool \
164 libpp \
165 libproc \
166 libproject \
167 libpthread \
168 libraidcfg \
169 librcm \
170 libreparse \
171 libresolv \
172 libresolv2 \
173 librestart \
174 librpcsvc \
175 librsm \
176 librstp \
177 librt \
178 libsasl \
179 libscf \
180 libsched \
181 libsctp \
182 libsec \
183 libsecdb \
184 libsendfile \
185 libsff \
186 libshare \
187 libshell \
188 libsip \
189 libsldap \
190 libsmbfs \
191 libsmbios \
192 libsmedia \
193 libsqlite \
194 libsrpt \
195 libstmf \
196 libsum \
197 libsun_ima \
198 libsys \
199 libsysevent \
200 libtecla \
201 libthread \
202 libumem \
203 libuuid \
204 libvolmgt \
205 libvrrpadm \
206 libvscan \
207 libw \
208 libwrap \
209 libzfs \
210 libzfs_core \
211 libzonecfg \
212 libzonestat \
213 libzpool \
214 madv \
215 mpapi \
216 mpss \
217 nametoaddr \
218 ncad_addr \
219 nsswitch \
220 pam_modules \
221 passwdutil \
222 pkcs11 \
223 policykit \
224 pylibbe \
225 rpcsec_gss \
226 sasl_plugins \
227 scsi \
228 smbsrv \
229 smhba \
230 sun_fc \
231 sun_sas \
232 udapl \
233 watchmalloc \
234 $($(MACH)_SUBDIRS)
236 i386_SUBDIRS= \
237 libfdisk \
238 libsaveargs
241 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
242 # clean and clobber targets (for more information, see those targets, below).
244 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
246 DCSUBDIRS=
248 MSGSUBDIRS= \
249 abi \
250 brand \
251 cfgadm_plugins \
252 gss_mechs/mech_dh \
253 gss_mechs/mech_krb5 \
254 krb5 \
255 libast \
256 libc \
257 libcfgadm \
258 libcmd \
259 libcontract \
260 libdhcputil \
261 libdiskmgt \
262 libdladm \
263 libdll \
264 libgss \
265 libidmap \
266 libilb \
267 libipadm \
268 libipmp \
269 libipsecutil \
270 libldap5 \
271 libnwam \
272 libofmt \
273 libpam \
274 libpool \
275 libpp \
276 libreparse \
277 libsasl \
278 libscf \
279 libsecdb \
280 libshare \
281 libshell \
282 libsldap \
283 libsmbfs \
284 libsmedia \
285 libsum \
286 libvrrpadm \
287 libvscan \
288 libzfs \
289 libzonecfg \
290 madv \
291 mpss \
292 pam_modules \
293 rpcsec_gss \
294 $($(MACH)_MSGSUBDIRS)
296 i386_MSGSUBDIRS= libfdisk
298 HDRSUBDIRS= \
299 fm \
300 hal \
301 hbaapi \
302 libads \
303 libast \
304 libbrand \
305 libc \
306 libcmd \
307 libcmdutils \
308 libcommputil \
309 libcontract \
310 libcpc \
311 libcryptoutil \
312 libctf \
313 libcustr \
314 libdevice \
315 libdevid \
316 libdevinfo \
317 libdhcpagent \
318 libdhcputil \
319 libdisasm \
320 libdiskmgt \
321 libdwarf \
322 libdladm \
323 libdll \
324 libdlpi \
325 libdns_sd \
326 libdtrace \
327 libelfsign \
328 libeti \
329 libfcoe \
330 libfstyp \
331 libgen \
332 libidmap \
333 libilb \
334 libima \
335 libinetsvc \
336 libinetutil \
337 libipadm \
338 libipd \
339 libipmi \
340 libipmp \
341 libipp \
342 libipsecutil \
343 libiscsit \
344 libkrb5 \
345 libkstat \
346 libkvm \
347 libmail \
348 libmapid \
349 libmd \
350 libmlrpc \
351 libmtmalloc \
352 libndmp \
353 libnvpair \
354 libnwam \
355 libofmt \
356 libpam \
357 libpcidb \
358 libpctx \
359 libpool \
360 libpp \
361 libproc \
362 libraidcfg \
363 librcm \
364 libreparse \
365 librestart \
366 librpcsvc \
367 librsm \
368 librstp \
369 libsasl \
370 libscf \
371 libsec \
372 libsff \
373 libshare \
374 libshell \
375 libsip \
376 libsmbfs \
377 libsmbios \
378 libsmedia \
379 libsqlite \
380 libsrpt \
381 libstmf \
382 libsum \
383 libsun_ima \
384 libsysevent \
385 libtecla \
386 libumem \
387 libvolmgt \
388 libvrrpadm \
389 libvscan \
390 libwrap \
391 libzfs \
392 libzfs_core \
393 libzonestat \
394 mpapi \
395 passwdutil \
396 pkcs11 \
397 policykit \
398 scsi \
399 smbsrv \
400 smhba \
401 udapl \
402 $($(MACH)_HDRSUBDIRS)
404 i386_HDRSUBDIRS= \
405 libfdisk \
406 libsaveargs
408 all := TARGET= all
409 check := TARGET= check
410 clean := TARGET= clean
411 clobber := TARGET= clobber
412 install := TARGET= install
413 install_h := TARGET= install_h
414 _dc := TARGET= _dc
415 _msg := TARGET= _msg
417 .KEEP_STATE:
420 # For the all and install targets, we clearly must respect library
421 # dependencies so that the libraries link correctly. However, for
422 # the remaining targets (check, clean, clobber, install_h, _dc, and
423 # _msg), libraries do not have any dependencies on one another and
424 # thus respecting dependencies just slows down the build. As such,
425 # for these rules, we use pattern replacement to explicitly avoid
426 # triggering the dependency information. Note that for clean and
427 # clobber, we must use $(NOWAIT_SUBDIRS) rather than $(SUBDIRS),
428 # to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
431 all: $(SUBDIRS)
433 install: $(SUBDIRS) .WAIT install_extra
435 # extra libraries kept in other source areas
436 install_extra:
437 @cd ../cmd/sgs; pwd; $(MAKE) install_lib
438 @pwd
440 clean clobber: $(NOWAIT_SUBDIRS:%=%-nodepend)
442 install_h check: $(HDRSUBDIRS:%=%-nodepend)
444 _msg: $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
446 _dc: $(DCSUBDIRS:%=%-nodepend)
448 # Library interdependencies are called out explicitly here.
449 ../cmd/sgs/libconv: crt
450 ../cmd/sgs/libdl: crt
451 libc: ../cmd/sgs/libconv ../cmd/sgs/libdl
453 libm: libc
454 libmd: libc
455 libmp: libc
456 libnsl: libc libmd libmp
457 libnvpair: libc libnsl
459 basedeps: libc libm libmd libmp libnsl libnvpair
460 basedeps := TARGET=install
462 # The following dependencies are currently required by libdbus-1 and should
463 # be used for anything linking against it.
464 dbusdeps: libsecdb libinetutil libscf libgen libsmbios
466 # The following dependencies don't need to be listed below as they are built
467 # before everything else:
468 # libc libm libmd libmp libnsl libnvpair
469 abi: libctf libmapmalloc libproc
470 brand: libzonecfg libmapmalloc
471 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
472 fm: libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
473 libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
474 libpcidb
475 gss_mechs/mech_dh: libgss
476 gss_mechs/mech_dummy: libgss
477 gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
478 gss_mechs/mech_spnego: gss_mechs/mech_krb5
479 hal: dbusdeps
480 krb5: gss_mechs/mech_krb5 libtecla libldap5
481 libadutils: libldap5 libresolv2
482 libbe: libzfs libzonecfg libuuid libgen libdevinfo libefi libficl
483 libcfgadm: libdevinfo
484 libcmd: libsum libast
485 libcmdutils: libavl
486 libcpc: libpctx
487 libcrypt: libgen
488 libctf: libdwarf
489 libdevid: libdevinfo
490 libdevinfo: libsec libgen
491 libdhcpagent: libdhcputil libuuid libdlpi libcontract
492 libdhcputil: libgen libinetutil libdlpi
493 libdiskmgt: libdevid libdevinfo libadm libefi libkstat libsysevent
494 $(INTEL_BLD)libdiskmgt: libfdisk
495 libdladm: libdevinfo libinetutil libscf librcm libexacct libkstat \
496 libpool
497 libdll: libast
498 libdlpi: libinetutil libdladm
499 libdtrace: libproc libgen libctf libmapmalloc
500 libefi: libuuid libsmbios
501 libelfsign: libcryptoutil libkmf ../cmd/sgs/libelf
502 libexacct/demo: libexacct libproject
503 libfcoe: libdladm
504 libficl: libuuid libumem
505 libfsmgt: libkstat
506 libidmap: libavl
507 libinetsvc: libscf
508 libipadm: libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
509 libipmp: libinetutil
510 libipsecutil: libtecla libkmf
511 libiscsit: libstmf libuuid
512 libkmf: libcryptoutil pkcs11 libcustr
513 libkvm: ../cmd/sgs/libelf
514 libldap5: libsasl
515 libmapid: libresolv2 libscf
516 libmlrpc: libsmbfs libuuid
517 libndmp: libscf
518 libnisdb: libldap5
519 libnwam: libscf libdladm libipadm
520 libpctx: libproc
521 libpool: libscf libexacct
522 libpp: libast
523 libproc: ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
524 $(INTEL_BLD)libproc: libsaveargs
525 libproject: libpool libproc libsecdb
526 libraidcfg: libdevinfo
527 librestart: libscf libpool libproject libsecdb libsysevent
528 libsasl: libgss pkcs11
529 libsaveargs: libdisasm
530 libscf: libgen libsmbios
531 libsec: libavl libidmap
532 libsff: libnvpair
533 libshare: libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
534 libshell: libast libcmd libdll libsecdb
535 libsip: libmd5
536 libsldap: libldap5 libscf
537 libsmbfs: libkrb5 libsec libidmap pkcs11
538 libsmbios: libdevinfo
539 libsrpt: libstmf
540 libstmf: libscf
541 libsum: libast
542 libsun_ima: libdevinfo libsysevent
543 libsysevent: libsecdb
544 libuuid: libdlpi
545 libvolmgt: libadm
546 libvrrpadm: libdladm libscf
547 libvscan: libscf libsecdb
548 libzfs: libdevid libgen libadm libavl libefi libidmap \
549 libumem libzfs_core
550 libzonecfg: libuuid libsysevent libsec libbrand libpool libscf libproc \
551 libsecdb
552 libzonestat: libcmdutils libumem
553 libzpool: libavl libumem libcmdutils libsysevent
554 madv: libgen
555 mpapi: libpthread libdevinfo libsysevent
556 mpss: libgen
557 nsswitch: libadutils libidmap libdns_sd libscf libldap5 libsldap
558 pam_modules: libproject passwdutil smbsrv libpam libsecdb
559 passwdutil: libsldap
560 pkcs11: libcryptoutil libgen libuuid
561 policykit: dbusdeps
562 pylibbe: libbe libzfs
563 rpcsec_gss: libgss
564 sasl_plugins: pkcs11 libgss libsasl
565 scsi: libumem libdevid libdevinfo
566 smbsrv: libpthread librt libshare libidmap pkcs11 libsqlite \
567 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
568 libuuid libads libgss libldap5 krb5 libmlrpc
569 sun_fc: libdevinfo libsysevent
570 sun_sas: libdevinfo libsysevent libkstat libdevid
571 udapl: libdevinfo libdladm
574 # The reason this rule checks for the existence of the
575 # Makefile is that some of the directories do not exist
576 # in certain situations (e.g., exportable source builds,
577 # OpenSolaris).
579 $(SUBDIRS): FRC
580 @if [ -f $@/Makefile ]; then \
581 cd $@; pwd; $(MAKE) $(TARGET); \
582 else \
583 true; \
586 $(SUBDIRS:%=%-nodepend):
587 @if [ -f $(@:%-nodepend=%)/Makefile ]; then \
588 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
589 else \
590 true; \
593 FRC: