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