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