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         libcustr        \
 110         libdemangle     \
 111         libdevice       \
 112         libdevid        \
 113         libdevinfo      \
 114         libdhcpagent    \
 115         libdhcputil     \
 116         libdisasm       \
 117         libdiskmgt      \
 118         libdladm        \
 119         libdll          \
 120         libdlpi         \
 121         libdns_sd       \
 122         libdoor         \
 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         libmlrpc        \
 169         libmtmalloc     \
 170         libmvec         \
 171         libndmp         \
 172         libnisdb        \
 173         libnls          \
 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         libreparse      \
 190         libresolv       \
 191         libresolv2      \
 192         librestart      \
 193         librpcsvc       \
 194         librsm          \
 195         librstp         \
 196         librt           \
 197         libsasl         \
 198         libscf          \
 199         libsched        \
 200         libsctp         \
 201         libsec          \
 202         libsecdb        \
 203         libsendfile     \
 204         libsff          \
 205         libshare        \
 206         libshell        \
 207         libsip          \
 208         libsldap        \
 209         libslp          \
 210         libsmbfs        \
 211         libsmbios       \
 212         libsmedia       \
 213         libsqlite       \
 214         libsrpt         \
 215         libstmf         \
 216         libstmfproxy    \
 217         libsum          \
 218         libsun_ima      \
 219         libsys          \
 220         libsysevent     \
 221         libtecla        \
 222         libtermcap      \
 223         libthread       \
 224         libtnf          \
 225         libtnfctl       \
 226         libtnfprobe     \
 227         libtsnet        \
 228         libtsol         \
 229         libumem         \
 230         libuuid         \
 231         libuutil        \
 232         libvolmgt       \
 233         libvrrpadm      \
 234         libvscan        \
 235         libw            \
 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         libzfs          \
 350         libzonecfg      \
 351         madv            \
 352         mpss            \
 353         pam_modules     \
 354         pyzfs           \
 355         rpcsec_gss      \
 356         $($(MACH)_MSGSUBDIRS)
 357 
 358 sparc_MSGSUBDIRS=       \
 359         libprtdiag      \
 360         libprtdiag_psr
 361 
 362 i386_MSGSUBDIRS= libfdisk
 363 
 364 HDRSUBDIRS=                             \
 365         ../cmd/sendmail/libmilter       \
 366         auditd_plugins  \
 367         fm              \
 368         hal             \
 369         hbaapi          \
 370         libads          \
 371         libast          \
 372         libbrand        \
 373         libbsm          \
 374         libc            \
 375         libcmd          \
 376         libcmdutils     \
 377         libcommputil    \
 378         libcontract     \
 379         libcpc          \
 380         libcryptoutil   \
 381         libctf          \
 382         libcurses       \
 383         libcustr        \
 384         libdemangle     \
 385         libdevice       \
 386         libdevid        \
 387         libdevinfo      \
 388         libdhcpagent    \
 389         libdhcputil     \
 390         libdisasm       \
 391         libdiskmgt      \
 392         libdladm        \
 393         libdll          \
 394         libdlpi         \
 395         libdns_sd       \
 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         libmlrpc        \
 426         libmtmalloc     \
 427         libndmp         \
 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         libreparse      \
 443         librestart      \
 444         librpcsvc       \
 445         librsm          \
 446         librstp         \
 447         libsasl         \
 448         libscf          \
 449         libsec          \
 450         libsff          \
 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         libuutil        \
 475         libvolmgt       \
 476         libvrrpadm      \
 477         libvscan        \
 478         libwrap         \
 479         libxcurses2     \
 480         libzfs          \
 481         libzfs_core     \
 482         libzfs_jni      \
 483         libzoneinfo     \
 484         libzonestat     \
 485         mpapi           \
 486         passwdutil      \
 487         pkcs11          \
 488         policykit       \
 489         scsi            \
 490         smbsrv          \
 491         smhba           \
 492         udapl           \
 493         $($(MACH)_HDRSUBDIRS)
 494 
 495 i386_HDRSUBDIRS=        \
 496         libfdisk        \
 497         libsaveargs
 498 
 499 sparc_HDRSUBDIRS=       \
 500         libds           \
 501         libdscp         \
 502         libpri          \
 503         libv12n         \
 504         storage
 505 
 506 all :=          TARGET= all
 507 check :=        TARGET= check
 508 clean :=        TARGET= clean
 509 clobber :=      TARGET= clobber
 510 install :=      TARGET= install
 511 install_h :=    TARGET= install_h
 512 lint :=         TARGET= lint
 513 _dc :=          TARGET= _dc
 514 _msg :=         TARGET= _msg
 515 
 516 .KEEP_STATE:
 517 
 518 #
 519 # For the all and install targets, we clearly must respect library
 520 # dependencies so that the libraries link correctly.  However, for
 521 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 522 # and _msg), libraries do not have any dependencies on one another
 523 # and thus respecting dependencies just slows down the build.
 524 # As such, for these rules, we use pattern replacement to explicitly
 525 # avoid triggering the dependency information.  Note that for clean,
 526 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 527 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 528 #
 529 
 530 all:                    $(SUBDIRS)
 531 
 532 install:                $(SUBDIRS) .WAIT install_extra
 533 
 534 # extra libraries kept in other source areas
 535 install_extra:
 536         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 537         @pwd
 538 
 539 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 540 
 541 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 542 
 543 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 544 
 545 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 546 
 547 # Library interdependencies are called out explicitly here.
 548 ../cmd/sgs/libconv: crt
 549 ../cmd/sgs/libdl: crt
 550 libc:           ../cmd/sgs/libconv ../cmd/sgs/libdl
 551 
 552 libm:           libc
 553 libmd:          libc
 554 libmp:          libc
 555 libnsl:         libc libmd libmp
 556 libnvpair:      libc libnsl
 557 libsocket:      libc libnsl
 558 
 559 basedeps:       libc libm libmd libmp libnsl libnvpair libsocket
 560 basedeps :=     TARGET=install
 561 
 562 # The following dependencies are currently required by libdbus-1 and should
 563 # be used for anything linking against it.
 564 dbusdeps:       libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
 565 
 566 # The following dependencies don't need to be listed below as they are built
 567 # before everything else:
 568 # libc libm libmd libmp libnsl libnvpair libsocket
 569 abi:            libctf libmapmalloc libproc
 570 auditd_plugins: libbsm libsecdb libgss libmtmalloc
 571 brand:          libzonecfg libmapmalloc
 572 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
 573 fm:             libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
 574                 libcontract libsysevent ../cmd/sgs/libelf libdladm libsff \
 575                 libpcidb
 576 $(SPARC_BLD)fm: libpri
 577 gss_mechs/mech_dh: libgss
 578 gss_mechs/mech_dummy: libgss
 579 gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
 580 gss_mechs/mech_spnego: gss_mechs/mech_krb5
 581 hal:            dbusdeps
 582 krb5:           gss_mechs/mech_krb5 libtecla libldap5
 583 libadt_jni:     libbsm
 584 libadutils:     libldap5 libresolv2
 585 libbe:          libzfs libinstzones libuuid libgen libdevinfo libefi libficl
 586 libbsm:         libinetutil libscf libsecdb libtsol
 587 libcfgadm:      libdevinfo
 588 libcmd:         libsum libast
 589 libcmdutils:    libavl
 590 libcpc:         libpctx
 591 libcrypt:       libgen
 592 libdevid:       libdevinfo
 593 libdevinfo:     libsec libgen
 594 libdhcpagent:   libdhcputil libuuid libdlpi libcontract
 595 libdhcputil:    libgen libinetutil libdlpi
 596 libdiskmgt:     libdevid libdevinfo libadm libefi libkstat libsysevent
 597 $(INTEL_BLD)libdiskmgt: libfdisk
 598 libdladm:       libdevinfo libinetutil libscf librcm libexacct libkstat \
 599                 libpool
 600 libdll:         libast
 601 libdlpi:        libinetutil libdladm
 602 libds:          libsysevent
 603 libdtrace:      libproc libgen libctf libmapmalloc
 604 libdtrace_jni:  libuutil libdtrace
 605 libefi:         libuuid libsmbios
 606 libelfsign:     libcryptoutil libkmf ../cmd/sgs/libelf
 607 libeti:         libcurses
 608 libexacct/demo: libexacct libproject
 609 libfakekernel:  libumem libcryptoutil
 610 libfcoe:        libdladm
 611 libficl:        libuuid libumem
 612 libfru:         libfruutils
 613 libfsmgt:       libkstat
 614 libgrubmgmt:    libdevinfo libzfs libfstyp libefi
 615 $(INTEL_BLD)libgrubmgmt: libfdisk
 616 libidmap:       libavl libuutil
 617 libinetsvc:     libscf
 618 libinstzones:   libzonecfg libcontract
 619 libipadm:       libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
 620 libipmp:        libinetutil
 621 libipsecutil:   libtecla libtsol libkmf
 622 libiscsit:      libstmf libuuid
 623 libkmf:         libcryptoutil pkcs11 libcustr
 624 libkvm:         ../cmd/sgs/libelf
 625 libldap5:       libsasl
 626 libmapid:       libresolv2 libscf
 627 libmlrpc:       libsmbfs libuuid
 628 libndmp:        libscf
 629 libnisdb:       libldap5
 630 libnwam:        libscf libbsm libdladm libipadm
 631 libpcp:         libumem libdevinfo
 632 libpctx:        libproc
 633 libpkg:         libscf libadm
 634 libpool:        libscf libexacct
 635 libpp:          libast
 636 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
 637 $(INTEL_BLD)libproc: libsaveargs
 638 libproject:     libpool libproc libsecdb
 639 libprtdiag:     libkstat
 640 libprtdiag_psr: libprtdiag
 641 libraidcfg:     libdevinfo
 642 librestart:     libuutil libscf libpool libproject libsecdb libsysevent
 643 libsasl:        libgss pkcs11
 644 libsaveargs:    libdisasm
 645 libscf:         libuutil libgen libsmbios
 646 libsec:         libavl libidmap
 647 libsff:         libnvpair
 648 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 649 libshell:       libast libcmd libdll libsecdb
 650 libsip:         libmd5
 651 libsldap:       libldap5 libscf
 652 libsmbfs:       libkrb5 libsec libidmap pkcs11
 653 libsmbios:      libdevinfo
 654 libsrpt:        libstmf
 655 libstmf:        libscf
 656 libstmfproxy:   libstmf libpthread
 657 libsum:         libast
 658 libsun_ima:     libdevinfo libsysevent
 659 libsysevent:    libsecdb
 660 libtecla:       libcurses
 661 libtermcap:     libcurses
 662 libtnfctl:      ../cmd/sgs/libelf
 663 libtsalarm:     libpcp
 664 libtsnet:       libtsol libsecdb
 665 libtsol:        libsecdb
 666 libuuid:        libdlpi
 667 libv12n:        libds libuuid
 668 libvolmgt:      libadm
 669 libvrrpadm:     libdladm libscf
 670 libvscan:       libscf libsecdb
 671 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 672                 libumem libtsol libzfs_core
 673 libzfs_jni:     libdiskmgt libzfs
 674 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 675                 libuutil libbsm libsecdb
 676 libzonestat:    libcmdutils libumem
 677 libzpool:       libavl libumem libcmdutils libsysevent libfakekernel
 678 madv:           libgen
 679 mpapi:          libpthread libdevinfo libsysevent
 680 mpss:           libgen
 681 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 682 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 683 passwdutil:     libsldap
 684 pkcs11:         libcryptoutil libgen libuuid
 685 policykit:      dbusdeps
 686 print:          libldap5 libmd5 libsendfile
 687 pylibbe:        libbe libzfs
 688 pysolaris:      libsec libidmap
 689 pyzfs:          libzfs
 690 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 691 rpcsec_gss:     libgss
 692 sasl_plugins:   pkcs11 libgss libsasl
 693 scsi:           libfru libumem libdevid libdevinfo
 694 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 695                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 696                 libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
 697 storage:        libdevice libdevinfo libdevid
 698 sun_fc:         libdevinfo libsysevent
 699 sun_sas:        libdevinfo libsysevent libkstat libdevid
 700 udapl:          libdevinfo libdladm
 701 
 702 #
 703 # The reason this rule checks for the existence of the
 704 # Makefile is that some of the directories do not exist
 705 # in certain situations (e.g., exportable source builds,
 706 # OpenSolaris).
 707 #
 708 $(SUBDIRS): FRC
 709         @if [ -f $@/Makefile  ]; then \
 710                 cd $@; pwd; $(MAKE) $(TARGET); \
 711         else \
 712                 true; \
 713         fi
 714 
 715 $(SUBDIRS:%=%-nodepend):
 716         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 717                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 718         else \
 719                 true; \
 720         fi
 721 
 722 FRC: