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 #
  34 
  35 include ../Makefile.master
  36 
  37 #       Note that libcurses installs commands along with its library.
  38 #       This is a minor bug which probably should be fixed.
  39 #       Note also that a few extra libraries are kept in cmd source.
  40 #
  41 # Certain libraries are linked with, hence depend on, other libraries.
  42 # Library dependencies are called out explicitly, see "Library
  43 # interdependencies" below.
  44 .PARALLEL:
  45 
  46 # Build libc and its dependencies
  47 SUBDIRS=                        \
  48         crt                     \
  49         ../cmd/sgs/libconv      \
  50         ../cmd/sgs/libdl        \
  51         libc                    \
  52         .WAIT
  53 
  54 # Build libraries with lots of dependents
  55 SUBDIRS +=              \
  56         libm            \
  57         libmd           \
  58         libmp           \
  59         libnsl          \
  60         libnvpair       \
  61         libsocket       \
  62         .WAIT
  63 
  64 # Build everything else. Aside from explicit dependencies, all libraries
  65 # are built in parallel.
  66 SUBDIRS +=                              \
  67         ../cmd/sendmail/libmilter       \
  68         ../cmd/sgs/libelf       \
  69         ../cmd/sgs/librtld_db   \
  70         abi             \
  71         auditd_plugins  \
  72         brand           \
  73         c_synonyms      \
  74         cfgadm_plugins  \
  75         crypt_modules   \
  76         extendedFILE    \
  77         fm              \
  78         getloginx       \
  79         gss_mechs/mech_dh       \
  80         gss_mechs/mech_dummy    \
  81         gss_mechs/mech_krb5     \
  82         gss_mechs/mech_spnego   \
  83         hal             \
  84         hbaapi          \
  85         krb5            \
  86         libadm          \
  87         libads          \
  88         libadt_jni      \
  89         libadutils      \
  90         libaio          \
  91         libast          \
  92         libavl          \
  93         libbe           \
  94         libbrand        \
  95         libbsdmalloc    \
  96         libbsm          \
  97         libc_db         \
  98         libcfgadm       \
  99         libcmd          \
 100         libcmdutils     \
 101         libcommputil    \
 102         libcontract     \
 103         libcpc          \
 104         libcrypt        \
 105         libcryptoutil   \
 106         libctf          \
 107         libcurses       \
 108         libdevice       \
 109         libdevid        \
 110         libdevinfo      \
 111         libdhcpagent    \
 112         libdhcputil     \
 113         libdisasm       \
 114         libdiskmgt      \
 115         libdladm        \
 116         libdll          \
 117         libdlpi         \
 118         libdns_sd       \
 119         libdoor         \
 120         libdscfg        \
 121         libdtrace       \
 122         libdtrace_jni   \
 123         libefi          \
 124         libelfsign      \
 125         libeti          \
 126         libexacct       \
 127         libexacct/demo  \
 128         libfakekernel   \
 129         libfcoe         \
 130         libficl         \
 131         libfru          \
 132         libfruutils     \
 133         libfsmgt        \
 134         libfstyp        \
 135         libgen          \
 136         libgrubmgmt     \
 137         libgss          \
 138         libhotplug      \
 139         libidmap        \
 140         libilb          \
 141         libima          \
 142         libinetsvc      \
 143         libinetutil     \
 144         libinstzones    \
 145         libintl         \
 146         libipadm        \
 147         libipd          \
 148         libipmi         \
 149         libipmp         \
 150         libipp          \
 151         libipsecutil    \
 152         libiscsit       \
 153         libkmf          \
 154         libkrb5         \
 155         libkstat        \
 156         libkvm          \
 157         libldap5        \
 158         liblgrp         \
 159         liblm           \
 160         libm1           \
 161         libmail         \
 162         libmalloc       \
 163         libmapid        \
 164         libmapmalloc    \
 165         libmd5          \
 166         libmtmalloc     \
 167         libmvec         \
 168         libndmp         \
 169         libnisdb        \
 170         libnls          \
 171         libnsctl        \
 172         libnwam         \
 173         libofmt         \
 174         libpam          \
 175         libpcidb        \
 176         libpctx         \
 177         libpicl         \
 178         libpicltree     \
 179         libpkg          \
 180         libpool         \
 181         libpp           \
 182         libproc         \
 183         libproject      \
 184         libpthread      \
 185         libraidcfg      \
 186         librcm          \
 187         librdc          \
 188         libreparse      \
 189         libresolv       \
 190         libresolv2      \
 191         librestart      \
 192         librpcsvc       \
 193         librsm          \
 194         librstp         \
 195         librt           \
 196         libsasl         \
 197         libscf          \
 198         libsched        \
 199         libsctp         \
 200         libsec          \
 201         libsecdb        \
 202         libsendfile     \
 203         libsff          \
 204         libshare        \
 205         libshell        \
 206         libsip          \
 207         libsldap        \
 208         libslp          \
 209         libsmbfs        \
 210         libsmbios       \
 211         libsmedia       \
 212         libsqlite       \
 213         libsrpt         \
 214         libstmf         \
 215         libstmfproxy    \
 216         libsum          \
 217         libsun_ima      \
 218         libsys          \
 219         libsysevent     \
 220         libtecla        \
 221         libtermcap      \
 222         libthread       \
 223         libtnf          \
 224         libtnfctl       \
 225         libtnfprobe     \
 226         libtsnet        \
 227         libtsol         \
 228         libumem         \
 229         libunistat      \
 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         libdevice       \
 384         libdevid        \
 385         libdevinfo      \
 386         libdhcpagent    \
 387         libdhcputil     \
 388         libdisasm       \
 389         libdiskmgt      \
 390         libdladm        \
 391         libdll          \
 392         libdlpi         \
 393         libdns_sd       \
 394         libdscfg        \
 395         libdtrace       \
 396         libdtrace_jni   \
 397         libelfsign      \
 398         libeti          \
 399         libfakekernel   \
 400         libfcoe         \
 401         libfru          \
 402         libfstyp        \
 403         libgen          \
 404         libgrubmgmt     \
 405         libidmap        \
 406         libilb          \
 407         libima          \
 408         libinetsvc      \
 409         libinetutil     \
 410         libinstzones    \
 411         libipadm        \
 412         libipd          \
 413         libipmi         \
 414         libipmp         \
 415         libipp          \
 416         libipsecutil    \
 417         libiscsit       \
 418         libkrb5         \
 419         libkstat        \
 420         libkvm          \
 421         libmail         \
 422         libmapid        \
 423         libmd           \
 424         libmtmalloc     \
 425         libndmp         \
 426         libnsctl        \
 427         libnsl          \
 428         libnvpair       \
 429         libnwam         \
 430         libofmt         \
 431         libpam          \
 432         libpcidb        \
 433         libpctx         \
 434         libpicl         \
 435         libpicltree     \
 436         libpool         \
 437         libpp           \
 438         libproc         \
 439         libraidcfg      \
 440         librcm          \
 441         librdc          \
 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         libunistat      \
 475         libuutil        \
 476         libvolmgt       \
 477         libvrrpadm      \
 478         libvscan        \
 479         libwrap         \
 480         libxcurses2     \
 481         libzfs          \
 482         libzfs_core     \
 483         libzfs_jni      \
 484         libzoneinfo     \
 485         libzonestat     \
 486         mpapi           \
 487         passwdutil      \
 488         pkcs11          \
 489         policykit       \
 490         scsi            \
 491         smbsrv          \
 492         smhba           \
 493         udapl           \
 494         $($(MACH)_HDRSUBDIRS)
 495 
 496 i386_HDRSUBDIRS=        \
 497         libfdisk        \
 498         libsaveargs
 499 
 500 sparc_HDRSUBDIRS=       \
 501         libds           \
 502         libdscp         \
 503         libpri          \
 504         libv12n         \
 505         storage
 506 
 507 all :=          TARGET= all
 508 check :=        TARGET= check
 509 clean :=        TARGET= clean
 510 clobber :=      TARGET= clobber
 511 install :=      TARGET= install
 512 install_h :=    TARGET= install_h
 513 lint :=         TARGET= lint
 514 _dc :=          TARGET= _dc
 515 _msg :=         TARGET= _msg
 516 
 517 .KEEP_STATE:
 518 
 519 #
 520 # For the all and install targets, we clearly must respect library
 521 # dependencies so that the libraries link correctly.  However, for
 522 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 523 # and _msg), libraries do not have any dependencies on one another
 524 # and thus respecting dependencies just slows down the build.
 525 # As such, for these rules, we use pattern replacement to explicitly
 526 # avoid triggering the dependency information.  Note that for clean,
 527 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 528 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 529 #
 530 
 531 all:                    $(SUBDIRS)
 532 
 533 install:                $(SUBDIRS) .WAIT install_extra
 534 
 535 # extra libraries kept in other source areas
 536 install_extra:
 537         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 538         @pwd
 539 
 540 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 541 
 542 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 543 
 544 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 545 
 546 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 547 
 548 # Library interdependencies are called out explicitly here.
 549 ../cmd/sgs/libconv: crt
 550 ../cmd/sgs/libdl: crt
 551 libc:           ../cmd/sgs/libconv ../cmd/sgs/libdl
 552 
 553 libm:           libc
 554 libmd:          libc
 555 libmp:          libc
 556 libnsl:         libc libmd libmp
 557 libnvpair:      libc libnsl
 558 libsocket:      libc libnsl
 559 
 560 basedeps:       libc libm libmd libmp libnsl libnvpair libsocket
 561 basedeps :=     TARGET=install
 562 
 563 # The following dependencies are currently required by libdbus-1 and should
 564 # be used for anything linking against it.
 565 dbusdeps:       libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
 566 
 567 # The following dependencies don't need to be listed below as they are built
 568 # before everything else:
 569 # libc libm libmd libmp libnsl libnvpair libsocket
 570 abi:            libctf libmapmalloc libproc
 571 auditd_plugins: libbsm libsecdb libgss libmtmalloc
 572 brand:          libzonecfg libmapmalloc
 573 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
 574 fm:             libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
 575                 libcontract libsysevent ../cmd/sgs/libelf libdladm libsff
 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 libdscfg:       libnsctl libunistat libadm
 604 libdtrace:      libproc libgen libctf libmapmalloc
 605 libdtrace_jni:  libuutil libdtrace
 606 libefi:         libuuid
 607 libelfsign:     libcryptoutil libkmf ../cmd/sgs/libelf
 608 libeti:         libcurses
 609 libexacct/demo: libexacct libproject
 610 libfakekernel:  libumem libcryptoutil
 611 libfcoe:        libdladm
 612 libficl:        libuuid libumem
 613 libfru:         libfruutils
 614 libfsmgt:       libkstat
 615 libgrubmgmt:    libdevinfo libzfs libfstyp libefi
 616 $(INTEL_BLD)libgrubmgmt: libfdisk
 617 libidmap:       libavl libuutil
 618 libinetsvc:     libscf
 619 libinstzones:   libzonecfg libcontract
 620 libipadm:       libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
 621 libipmp:        libinetutil
 622 libipsecutil:   libtecla libtsol
 623 libiscsit:      libstmf libuuid
 624 libkmf:         libcryptoutil pkcs11
 625 libkvm:         ../cmd/sgs/libelf
 626 libldap5:       libsasl
 627 libmapid:       libresolv2 libscf
 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 librdc:         libnsctl libunistat libdscfg
 643 librestart:     libuutil libscf libpool libproject libsecdb libsysevent
 644 libsasl:        libgss pkcs11
 645 libsaveargs:    libdisasm
 646 libscf:         libuutil libgen libsmbios
 647 libsec:         libavl libidmap
 648 libsff:         libnvpair
 649 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 650 libshell:       libast libcmd libdll libsecdb
 651 libsip:         libmd5
 652 libsldap:       libldap5 libscf
 653 libsmbfs:       libkrb5 libsec libidmap pkcs11
 654 libsmbios:      libdevinfo
 655 libsrpt:        libstmf
 656 libstmf:        libscf
 657 libstmfproxy:   libstmf libpthread
 658 libsum:         libast
 659 libsun_ima:     libdevinfo libsysevent
 660 libsysevent:    libsecdb
 661 libtecla:       libcurses
 662 libtermcap:     libcurses
 663 libtnfctl:      ../cmd/sgs/libelf
 664 libtsalarm:     libpcp
 665 libtsnet:       libtsol libsecdb
 666 libtsol:        libsecdb
 667 libuuid:        libdlpi
 668 libv12n:        libds libuuid
 669 libvolmgt:      libadm
 670 libvrrpadm:     libdladm libscf
 671 libvscan:       libscf libsecdb
 672 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 673                 libumem libtsol libzfs_core libcmdutils
 674 libzfs_jni:     libdiskmgt libzfs
 675 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 676                 libuutil libbsm libsecdb
 677 libzonestat:    libcmdutils libumem
 678 libzpool:       libavl libumem libcmdutils libsysevent libfakekernel
 679 madv:           libgen
 680 mpapi:          libpthread libdevinfo libsysevent
 681 mpss:           libgen
 682 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 683 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 684 passwdutil:     libsldap
 685 pkcs11:         libcryptoutil libgen libuuid
 686 policykit:      dbusdeps
 687 print:          libldap5 libmd5 libsendfile
 688 pylibbe:        libbe libzfs
 689 pysolaris:      libsec libidmap
 690 pyzfs:          libzfs
 691 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 692 rpcsec_gss:     libgss
 693 sasl_plugins:   pkcs11 libgss libsasl
 694 scsi:           libfru libumem libdevid libdevinfo
 695 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 696                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 697                 libuuid libfakekernel libads libgss libldap5 krb5
 698 storage:        libdevice libdevinfo libdevid
 699 sun_fc:         libdevinfo libsysevent
 700 sun_sas:        libdevinfo libsysevent libkstat libdevid
 701 udapl:          libdevinfo libdladm
 702 
 703 #
 704 # The reason this rule checks for the existence of the
 705 # Makefile is that some of the directories do not exist
 706 # in certain situations (e.g., exportable source builds,
 707 # OpenSolaris).
 708 #
 709 $(SUBDIRS): FRC
 710         @if [ -f $@/Makefile  ]; then \
 711                 cd $@; pwd; $(MAKE) $(TARGET); \
 712         else \
 713                 true; \
 714         fi
 715 
 716 $(SUBDIRS:%=%-nodepend):
 717         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 718                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 719         else \
 720                 true; \
 721         fi
 722 
 723 FRC: