1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright (c) 2012 by Delphix. All rights reserved.
  25 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
  26 # Copyright (c) 2013 Gary Mills
  27 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
  28 # Copyright (c) 2015 Gary Mills
  29 # Copyright 2016 Toomas Soome <tsoome@me.com>
  30 # Copyright 2017 Nexenta Systems, Inc.
  31 # Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
  32 # 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         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         libunistat      \
 229         libuuid         \
 230         libuutil        \
 231         libvolmgt       \
 232         libvrrpadm      \
 233         libvscan        \
 234         libw            \
 235         libwanboot      \
 236         libwanbootutil  \
 237         libwrap         \
 238         libxcurses      \
 239         libxcurses2     \
 240         libxnet         \
 241         libzfs          \
 242         libzfs_core     \
 243         libzfs_jni      \
 244         libzonecfg      \
 245         libzoneinfo     \
 246         libzonestat     \
 247         libzpool        \
 248         madv            \
 249         mpapi           \
 250         mpss            \
 251         nametoaddr      \
 252         ncad_addr       \
 253         nsswitch        \
 254         pam_modules     \
 255         passwdutil      \
 256         pkcs11          \
 257         policykit       \
 258         print           \
 259         pylibbe         \
 260         pysolaris       \
 261         pyzfs           \
 262         raidcfg_plugins \
 263         rpcsec_gss      \
 264         sasl_plugins    \
 265         scsi            \
 266         smbsrv          \
 267         smhba           \
 268         sun_fc          \
 269         sun_sas         \
 270         udapl           \
 271         watchmalloc     \
 272         $($(MACH)_SUBDIRS)
 273 
 274 i386_SUBDIRS=           \
 275         libfdisk        \
 276         libsaveargs
 277 
 278 sparc_SUBDIRS=          \
 279         efcode          \
 280         libds           \
 281         libdscp         \
 282         libprtdiag      \
 283         libprtdiag_psr  \
 284         libpri          \
 285         librsc          \
 286         storage         \
 287         libpcp          \
 288         libtsalarm      \
 289         libv12n
 290 
 291 #
 292 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
 293 # clean and clobber targets (for more information, see those targets, below).
 294 #
 295 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 296 
 297 DCSUBDIRS=
 298 
 299 MSGSUBDIRS=             \
 300         abi             \
 301         auditd_plugins  \
 302         brand           \
 303         cfgadm_plugins  \
 304         gss_mechs/mech_dh       \
 305         gss_mechs/mech_krb5     \
 306         krb5            \
 307         libast          \
 308         libbsm          \
 309         libc            \
 310         libcfgadm       \
 311         libcmd          \
 312         libcontract     \
 313         libcurses       \
 314         libdhcputil     \
 315         libdiskmgt      \
 316         libdladm        \
 317         libdll          \
 318         libgrubmgmt     \
 319         libgss          \
 320         libidmap        \
 321         libilb          \
 322         libinstzones    \
 323         libipadm        \
 324         libipmp         \
 325         libipsecutil    \
 326         libldap5        \
 327         libnsl          \
 328         libnwam         \
 329         libofmt         \
 330         libpam          \
 331         libpicl         \
 332         libpkg          \
 333         libpool         \
 334         libpp           \
 335         libreparse      \
 336         libsasl         \
 337         libscf          \
 338         libsecdb        \
 339         libshare        \
 340         libshell        \
 341         libsldap        \
 342         libslp          \
 343         libsmbfs        \
 344         libsmedia       \
 345         libsum          \
 346         libtsol         \
 347         libuutil        \
 348         libvrrpadm      \
 349         libvscan        \
 350         libwanboot      \
 351         libwanbootutil  \
 352         libzfs          \
 353         libzonecfg      \
 354         madv            \
 355         mpss            \
 356         pam_modules     \
 357         pyzfs           \
 358         rpcsec_gss      \
 359         $($(MACH)_MSGSUBDIRS)
 360 
 361 sparc_MSGSUBDIRS=       \
 362         libprtdiag      \
 363         libprtdiag_psr
 364 
 365 i386_MSGSUBDIRS= libfdisk
 366 
 367 HDRSUBDIRS=                             \
 368         ../cmd/sendmail/libmilter       \
 369         auditd_plugins  \
 370         fm              \
 371         hal             \
 372         hbaapi          \
 373         libads          \
 374         libast          \
 375         libbrand        \
 376         libbsm          \
 377         libc            \
 378         libcmd          \
 379         libcmdutils     \
 380         libcommputil    \
 381         libcontract     \
 382         libcpc          \
 383         libcryptoutil   \
 384         libctf          \
 385         libcurses       \
 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         libshare        \
 454         libshell        \
 455         libsip          \
 456         libslp          \
 457         libsmbfs        \
 458         libsmbios       \
 459         libsmedia       \
 460         libsocket       \
 461         libsqlite       \
 462         libsrpt         \
 463         libstmf         \
 464         libstmfproxy    \
 465         libsum          \
 466         libsun_ima      \
 467         libsysevent     \
 468         libtecla        \
 469         libtermcap      \
 470         libtnf          \
 471         libtnfctl       \
 472         libtnfprobe     \
 473         libtsnet        \
 474         libtsol         \
 475         libumem         \
 476         libunistat      \
 477         libuutil        \
 478         libvolmgt       \
 479         libvrrpadm      \
 480         libvscan        \
 481         libwanboot      \
 482         libwanbootutil  \
 483         libwrap         \
 484         libxcurses2     \
 485         libzfs          \
 486         libzfs_core     \
 487         libzfs_jni      \
 488         libzoneinfo     \
 489         libzonestat     \
 490         mpapi           \
 491         passwdutil      \
 492         pkcs11          \
 493         policykit       \
 494         scsi            \
 495         smbsrv          \
 496         smhba           \
 497         udapl           \
 498         $($(MACH)_HDRSUBDIRS)
 499 
 500 i386_HDRSUBDIRS=        \
 501         libfdisk        \
 502         libsaveargs
 503 
 504 sparc_HDRSUBDIRS=       \
 505         libds           \
 506         libdscp         \
 507         libpri          \
 508         libv12n         \
 509         storage
 510 
 511 all :=          TARGET= all
 512 check :=        TARGET= check
 513 clean :=        TARGET= clean
 514 clobber :=      TARGET= clobber
 515 install :=      TARGET= install
 516 install_h :=    TARGET= install_h
 517 lint :=         TARGET= lint
 518 _dc :=          TARGET= _dc
 519 _msg :=         TARGET= _msg
 520 
 521 .KEEP_STATE:
 522 
 523 #
 524 # For the all and install targets, we clearly must respect library
 525 # dependencies so that the libraries link correctly.  However, for
 526 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 527 # and _msg), libraries do not have any dependencies on one another
 528 # and thus respecting dependencies just slows down the build.
 529 # As such, for these rules, we use pattern replacement to explicitly
 530 # avoid triggering the dependency information.  Note that for clean,
 531 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 532 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 533 #
 534 
 535 all:                    $(SUBDIRS)
 536 
 537 install:                $(SUBDIRS) .WAIT install_extra
 538 
 539 # extra libraries kept in other source areas
 540 install_extra:
 541         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 542         @pwd
 543 
 544 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 545 
 546 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 547 
 548 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 549 
 550 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 551 
 552 # Library interdependencies are called out explicitly here.
 553 ../cmd/sgs/libconv: crt
 554 ../cmd/sgs/libdl: crt
 555 libc:           ../cmd/sgs/libconv ../cmd/sgs/libdl
 556 
 557 libm:           libc
 558 libmd:          libc
 559 libmp:          libc
 560 libnsl:         libc libmd libmp
 561 libnvpair:      libc libnsl
 562 libsocket:      libc libnsl
 563 
 564 basedeps:       libc libm libmd libmp libnsl libnvpair libsocket
 565 basedeps :=     TARGET=install
 566 
 567 # The following dependencies are currently required by libdbus-1 and should
 568 # be used for anything linking against it.
 569 dbusdeps:       libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
 570 
 571 # The following dependencies don't need to be listed below as they are built
 572 # before everything else:
 573 # libc libm libmd libmp libnsl libnvpair libsocket
 574 abi:            libctf libmapmalloc libproc
 575 auditd_plugins: libbsm libsecdb libgss libmtmalloc
 576 brand:          libzonecfg libmapmalloc
 577 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
 578 fm:             libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
 579                 libcontract libsysevent ../cmd/sgs/libelf
 580 $(SPARC_BLD)fm: libpri
 581 gss_mechs/mech_dh: libgss
 582 gss_mechs/mech_dummy: libgss
 583 gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
 584 gss_mechs/mech_spnego: gss_mechs/mech_krb5
 585 hal:            dbusdeps
 586 krb5:           gss_mechs/mech_krb5 libtecla libldap5
 587 libadt_jni:     libbsm
 588 libadutils:     libldap5 libresolv2
 589 libbe:          libzfs libinstzones libuuid libgen libdevinfo libefi libficl
 590 libbsm:         libinetutil libscf libsecdb libtsol
 591 libcfgadm:      libdevinfo
 592 libcmd:         libsum libast
 593 libcmdutils:    libavl
 594 libcpc:         libpctx
 595 libcrypt:       libgen
 596 libdevid:       libdevinfo
 597 libdevinfo:     libsec libgen
 598 libdhcpagent:   libdhcputil libuuid libdlpi libcontract
 599 libdhcputil:    libgen libinetutil libdlpi
 600 libdiskmgt:     libdevid libdevinfo libadm libefi libkstat libsysevent
 601 $(INTEL_BLD)libdiskmgt: libfdisk
 602 libdladm:       libdevinfo libinetutil libscf librcm libexacct libkstat \
 603                 libpool
 604 libdll:         libast
 605 libdlpi:        libinetutil libdladm
 606 libds:          libsysevent
 607 libdscfg:       libnsctl libunistat libadm
 608 libdtrace:      libproc libgen libctf libmapmalloc
 609 libdtrace_jni:  libuutil libdtrace
 610 libefi:         libuuid
 611 libelfsign:     libcryptoutil libkmf ../cmd/sgs/libelf
 612 libeti:         libcurses
 613 libexacct/demo: libexacct libproject
 614 libfakekernel:  libumem libcryptoutil
 615 libfcoe:        libdladm
 616 libficl:        libuuid libumem
 617 libfru:         libfruutils
 618 libfsmgt:       libkstat
 619 libgrubmgmt:    libdevinfo libzfs libfstyp libefi
 620 $(INTEL_BLD)libgrubmgmt: libfdisk
 621 libidmap:       libavl libuutil
 622 libinetsvc:     libscf
 623 libinstzones:   libzonecfg libcontract
 624 libipadm:       libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
 625 libipmp:        libinetutil
 626 libipsecutil:   libtecla libtsol
 627 libiscsit:      libstmf libuuid
 628 libkmf:         libcryptoutil pkcs11
 629 libkvm:         ../cmd/sgs/libelf
 630 libldap5:       libsasl
 631 libmapid:       libresolv2 libscf
 632 libndmp:        libscf
 633 libnisdb:       libldap5
 634 libnwam:        libscf libbsm libdladm libipadm
 635 libpcp:         libumem libdevinfo
 636 libpctx:        libproc
 637 libpkg:         libwanboot libscf libadm
 638 libpool:        libscf libexacct
 639 libpp:          libast
 640 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
 641 $(INTEL_BLD)libproc: libsaveargs
 642 libproject:     libpool libproc libsecdb
 643 libprtdiag:     libkstat
 644 libprtdiag_psr: libprtdiag
 645 libraidcfg:     libdevinfo
 646 librdc:         libnsctl libunistat libdscfg
 647 librestart:     libuutil libscf libpool libproject libsecdb libsysevent
 648 libsasl:        libgss pkcs11
 649 libsaveargs:    libdisasm
 650 libscf:         libuutil libgen libsmbios
 651 libsec:         libavl libidmap
 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 libwanboot:     libresolv2 libdevinfo libinetutil libdhcputil
 676 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 677                 libumem libtsol libzfs_core libfakekernel
 678 libzfs_jni:     libdiskmgt libzfs
 679 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 680                 libuutil libbsm libsecdb
 681 libzonestat:    libcmdutils libumem
 682 libzpool:       libavl libumem libcmdutils libsysevent libfakekernel
 683 madv:           libgen
 684 mpapi:          libpthread libdevinfo libsysevent
 685 mpss:           libgen
 686 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 687 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 688 passwdutil:     libsldap
 689 pkcs11:         libcryptoutil libgen libuuid
 690 policykit:      dbusdeps
 691 print:          libldap5 libmd5 libsendfile
 692 pylibbe:        libbe libzfs
 693 pysolaris:      libsec libidmap
 694 pyzfs:          libzfs
 695 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 696 rpcsec_gss:     libgss
 697 sasl_plugins:   pkcs11 libgss libsasl
 698 scsi:           libfru libumem libdevid libdevinfo
 699 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 700                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 701                 libuuid libfakekernel libads libgss libldap5 krb5
 702 storage:        libdevice libdevinfo libdevid
 703 sun_fc:         libdevinfo libsysevent
 704 sun_sas:        libdevinfo libsysevent libkstat libdevid
 705 udapl:          libdevinfo libdladm
 706 
 707 #
 708 # The reason this rule checks for the existence of the
 709 # Makefile is that some of the directories do not exist
 710 # in certain situations (e.g., exportable source builds,
 711 # OpenSolaris).
 712 #
 713 $(SUBDIRS): FRC
 714         @if [ -f $@/Makefile  ]; then \
 715                 cd $@; pwd; $(MAKE) $(TARGET); \
 716         else \
 717                 true; \
 718         fi
 719 
 720 $(SUBDIRS:%=%-nodepend):
 721         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 722                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 723         else \
 724                 true; \
 725         fi
 726 
 727 FRC: