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 2018 Nexenta Systems, Inc.
  31 # Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
  32 # Copyright 2017 RackTop Systems.
  33 # Copyirght 2018 Jason King
  34 #
  35 
  36 include ../Makefile.master
  37 
  38 #       Note that libcurses installs commands along with its library.
  39 #       This is a minor bug which probably should be fixed.
  40 #       Note also that a few extra libraries are kept in cmd source.
  41 #
  42 # Certain libraries are linked with, hence depend on, other libraries.
  43 # Library dependencies are called out explicitly, see "Library
  44 # interdependencies" below.
  45 .PARALLEL:
  46 
  47 # Build libc and its dependencies
  48 SUBDIRS=                        \
  49         crt                     \
  50         ../cmd/sgs/libconv      \
  51         ../cmd/sgs/libdl        \
  52         libc                    \
  53         .WAIT
  54 
  55 # Build libraries with lots of dependents
  56 SUBDIRS +=              \
  57         libm            \
  58         libmd           \
  59         libmp           \
  60         libnsl          \
  61         libnvpair       \
  62         libsocket       \
  63         .WAIT
  64 
  65 # Build everything else. Aside from explicit dependencies, all libraries
  66 # are built in parallel.
  67 SUBDIRS +=                              \
  68         ../cmd/sendmail/libmilter       \
  69         ../cmd/sgs/libelf       \
  70         ../cmd/sgs/librtld_db   \
  71         abi             \
  72         auditd_plugins  \
  73         brand           \
  74         c_synonyms      \
  75         cfgadm_plugins  \
  76         crypt_modules   \
  77         extendedFILE    \
  78         fm              \
  79         getloginx       \
  80         gss_mechs/mech_dh       \
  81         gss_mechs/mech_dummy    \
  82         gss_mechs/mech_krb5     \
  83         gss_mechs/mech_spnego   \
  84         hal             \
  85         hbaapi          \
  86         krb5            \
  87         libadm          \
  88         libads          \
  89         libadt_jni      \
  90         libadutils      \
  91         libaio          \
  92         libast          \
  93         libavl          \
  94         libbe           \
  95         libbrand        \
  96         libbsdmalloc    \
  97         libbsm          \
  98         libc_db         \
  99         libcfgadm       \
 100         libcmd          \
 101         libcmdutils     \
 102         libcommputil    \
 103         libcontract     \
 104         libcpc          \
 105         libcrypt        \
 106         libcryptoutil   \
 107         libctf          \
 108         libcurses       \
 109         libdemangle     \
 110         libdevice       \
 111         libdevid        \
 112         libdevinfo      \
 113         libdhcpagent    \
 114         libdhcputil     \
 115         libdisasm       \
 116         libdiskmgt      \
 117         libdladm        \
 118         libdll          \
 119         libdlpi         \
 120         libdns_sd       \
 121         libdoor         \
 122         libdscfg        \
 123         libdtrace       \
 124         libdtrace_jni   \
 125         libefi          \
 126         libelfsign      \
 127         libeti          \
 128         libexacct       \
 129         libexacct/demo  \
 130         libfakekernel   \
 131         libfcoe         \
 132         libficl         \
 133         libfru          \
 134         libfruutils     \
 135         libfsmgt        \
 136         libfstyp        \
 137         libgen          \
 138         libgrubmgmt     \
 139         libgss          \
 140         libhotplug      \
 141         libidmap        \
 142         libilb          \
 143         libima          \
 144         libinetsvc      \
 145         libinetutil     \
 146         libinstzones    \
 147         libintl         \
 148         libipadm        \
 149         libipd          \
 150         libipmi         \
 151         libipmp         \
 152         libipp          \
 153         libipsecutil    \
 154         libiscsit       \
 155         libkmf          \
 156         libkrb5         \
 157         libkstat        \
 158         libkvm          \
 159         libldap5        \
 160         liblgrp         \
 161         liblm           \
 162         libm1           \
 163         libmail         \
 164         libmalloc       \
 165         libmapid        \
 166         libmapmalloc    \
 167         libmd5          \
 168         libmtmalloc     \
 169         libmvec         \
 170         libndmp         \
 171         libnisdb        \
 172         libnls          \
 173         libnsctl        \
 174         libnwam         \
 175         libofmt         \
 176         libpam          \
 177         libpcidb        \
 178         libpctx         \
 179         libpicl         \
 180         libpicltree     \
 181         libpkg          \
 182         libpool         \
 183         libpp           \
 184         libproc         \
 185         libproject      \
 186         libpthread      \
 187         libraidcfg      \
 188         librcm          \
 189         librdc          \
 190         libreparse      \
 191         libresolv       \
 192         libresolv2      \
 193         librestart      \
 194         librpcsvc       \
 195         librsm          \
 196         librstp         \
 197         librt           \
 198         libsasl         \
 199         libscf          \
 200         libsched        \
 201         libsctp         \
 202         libsec          \
 203         libsecdb        \
 204         libsendfile     \
 205         libsff          \
 206         libshare        \
 207         libshell        \
 208         libsip          \
 209         libsldap        \
 210         libslp          \
 211         libsmbfs        \
 212         libsmbios       \
 213         libsmedia       \
 214         libsqlite       \
 215         libsrpt         \
 216         libstmf         \
 217         libstmfproxy    \
 218         libsum          \
 219         libsun_ima      \
 220         libsys          \
 221         libsysevent     \
 222         libtecla        \
 223         libtermcap      \
 224         libthread       \
 225         libtnf          \
 226         libtnfctl       \
 227         libtnfprobe     \
 228         libtsnet        \
 229         libtsol         \
 230         libumem         \
 231         libunistat      \
 232         libuuid         \
 233         libuutil        \
 234         libvolmgt       \
 235         libvrrpadm      \
 236         libvscan        \
 237         libw            \
 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 
 275 i386_SUBDIRS=           \
 276         libfdisk        \
 277         libsaveargs
 278 
 279 sparc_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 #
 296 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 297 
 298 DCSUBDIRS=
 299 
 300 MSGSUBDIRS=             \
 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         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         libdemangle     \
 386         libdevice       \
 387         libdevid        \
 388         libdevinfo      \
 389         libdhcpagent    \
 390         libdhcputil     \
 391         libdisasm       \
 392         libdiskmgt      \
 393         libdladm        \
 394         libdll          \
 395         libdlpi         \
 396         libdns_sd       \
 397         libdscfg        \
 398         libdtrace       \
 399         libdtrace_jni   \
 400         libelfsign      \
 401         libeti          \
 402         libfakekernel   \
 403         libfcoe         \
 404         libfru          \
 405         libfstyp        \
 406         libgen          \
 407         libgrubmgmt     \
 408         libidmap        \
 409         libilb          \
 410         libima          \
 411         libinetsvc      \
 412         libinetutil     \
 413         libinstzones    \
 414         libipadm        \
 415         libipd          \
 416         libipmi         \
 417         libipmp         \
 418         libipp          \
 419         libipsecutil    \
 420         libiscsit       \
 421         libkrb5         \
 422         libkstat        \
 423         libkvm          \
 424         libmail         \
 425         libmapid        \
 426         libmd           \
 427         libmtmalloc     \
 428         libndmp         \
 429         libnsctl        \
 430         libnsl          \
 431         libnvpair       \
 432         libnwam         \
 433         libofmt         \
 434         libpam          \
 435         libpcidb        \
 436         libpctx         \
 437         libpicl         \
 438         libpicltree     \
 439         libpool         \
 440         libpp           \
 441         libproc         \
 442         libraidcfg      \
 443         librcm          \
 444         librdc          \
 445         libreparse      \
 446         librestart      \
 447         librpcsvc       \
 448         librsm          \
 449         librstp         \
 450         libsasl         \
 451         libscf          \
 452         libsec          \
 453         libsff          \
 454         libshare        \
 455         libshell        \
 456         libsip          \
 457         libslp          \
 458         libsmbfs        \
 459         libsmbios       \
 460         libsmedia       \
 461         libsocket       \
 462         libsqlite       \
 463         libsrpt         \
 464         libstmf         \
 465         libstmfproxy    \
 466         libsum          \
 467         libsun_ima      \
 468         libsysevent     \
 469         libtecla        \
 470         libtermcap      \
 471         libtnf          \
 472         libtnfctl       \
 473         libtnfprobe     \
 474         libtsnet        \
 475         libtsol         \
 476         libumem         \
 477         libunistat      \
 478         libuutil        \
 479         libvolmgt       \
 480         libvrrpadm      \
 481         libvscan        \
 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 libdladm libsff
 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:         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 libsff:         libnvpair
 652 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 653 libshell:       libast libcmd libdll libsecdb
 654 libsip:         libmd5
 655 libsldap:       libldap5 libscf
 656 libsmbfs:       libkrb5 libsec libidmap pkcs11
 657 libsmbios:      libdevinfo
 658 libsrpt:        libstmf
 659 libstmf:        libscf
 660 libstmfproxy:   libstmf libpthread
 661 libsum:         libast
 662 libsun_ima:     libdevinfo libsysevent
 663 libsysevent:    libsecdb
 664 libtecla:       libcurses
 665 libtermcap:     libcurses
 666 libtnfctl:      ../cmd/sgs/libelf
 667 libtsalarm:     libpcp
 668 libtsnet:       libtsol libsecdb
 669 libtsol:        libsecdb
 670 libuuid:        libdlpi
 671 libv12n:        libds libuuid
 672 libvolmgt:      libadm
 673 libvrrpadm:     libdladm libscf
 674 libvscan:       libscf libsecdb
 675 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 676                 libumem libtsol libzfs_core libcmdutils
 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 libfakekernel
 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: