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