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 #
  33 
  34 include ../Makefile.master
  35 
  36 #       Note that libcurses installs commands along with its library.
  37 #       This is a minor bug which probably should be fixed.
  38 #       Note also that a few extra libraries are kept in cmd source.
  39 #
  40 # Certain libraries are linked with, hence depend on, other libraries.
  41 # Library dependencies are called out explicitly, see "Library
  42 # interdependencies" below.
  43 .PARALLEL:
  44 
  45 # Build libc and its dependencies
  46 SUBDIRS=                        \
  47         crt                     \
  48         ../cmd/sgs/libconv      \
  49         ../cmd/sgs/libdl        \
  50         libc                    \
  51         .WAIT
  52 
  53 # Build libraries with lots of dependents
  54 SUBDIRS +=              \
  55         libm            \
  56         libmd           \
  57         libmp           \
  58         libnsl          \
  59         libnvpair       \
  60         libsocket       \
  61         .WAIT
  62 
  63 # Build everything else. Aside from explicit dependencies, all libraries
  64 # are built in parallel.
  65 SUBDIRS +=                              \
  66         ../cmd/sendmail/libmilter       \
  67         ../cmd/sgs/libelf       \
  68         ../cmd/sgs/librtld_db   \
  69         abi             \
  70         auditd_plugins  \
  71         brand           \
  72         c_synonyms      \
  73         cfgadm_plugins  \
  74         crypt_modules   \
  75         extendedFILE    \
  76         fm              \
  77         fru             \
  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         libfsmgt        \
 132         libfstyp        \
 133         libgen          \
 134         libgrubmgmt     \
 135         libgss          \
 136         libhotplug      \
 137         libidmap        \
 138         libilb          \
 139         libima          \
 140         libinetsvc      \
 141         libinetutil     \
 142         libinstzones    \
 143         libintl         \
 144         libipadm        \
 145         libipd          \
 146         libipmi         \
 147         libipmp         \
 148         libipp          \
 149         libipsecutil    \
 150         libiscsit       \
 151         libkmf          \
 152         libkrb5         \
 153         libkstat        \
 154         libkvm          \
 155         libldap5        \
 156         liblgrp         \
 157         liblm           \
 158         libm1           \
 159         libmail         \
 160         libmalloc       \
 161         libmapid        \
 162         libmapmalloc    \
 163         libmd5          \
 164         libmtmalloc     \
 165         libmvec         \
 166         libndmp         \
 167         libnisdb        \
 168         libnls          \
 169         libnsctl        \
 170         libnwam         \
 171         libofmt         \
 172         libpam          \
 173         libpcidb        \
 174         libpctx         \
 175         libpicl         \
 176         libpicltree     \
 177         libpkg          \
 178         libpool         \
 179         libpp           \
 180         libproc         \
 181         libproject      \
 182         libpthread      \
 183         libraidcfg      \
 184         librcm          \
 185         librdc          \
 186         libreparse      \
 187         libresolv       \
 188         libresolv2      \
 189         librestart      \
 190         librpcsvc       \
 191         librsm          \
 192         librstp         \
 193         librt           \
 194         libsasl         \
 195         libscf          \
 196         libsched        \
 197         libsctp         \
 198         libsec          \
 199         libsecdb        \
 200         libsendfile     \
 201         libsff          \
 202         libshare        \
 203         libshell        \
 204         libsip          \
 205         libsldap        \
 206         libslp          \
 207         libsmbfs        \
 208         libsmbios       \
 209         libsmedia       \
 210         libsqlite       \
 211         libsrpt         \
 212         libstmf         \
 213         libstmfproxy    \
 214         libsum          \
 215         libsun_ima      \
 216         libsys          \
 217         libsysevent     \
 218         libtecla        \
 219         libtermcap      \
 220         libthread       \
 221         libtnf          \
 222         libtnfctl       \
 223         libtnfprobe     \
 224         libtsnet        \
 225         libtsol         \
 226         libumem         \
 227         libunistat      \
 228         libuuid         \
 229         libuutil        \
 230         libvolmgt       \
 231         libvrrpadm      \
 232         libvscan        \
 233         libw            \
 234         libwanboot      \
 235         libwanbootutil  \
 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         libwanboot      \
 350         libwanbootutil  \
 351         libzfs          \
 352         libzonecfg      \
 353         madv            \
 354         mpss            \
 355         pam_modules     \
 356         pyzfs           \
 357         rpcsec_gss      \
 358         $($(MACH)_MSGSUBDIRS)
 359 
 360 sparc_MSGSUBDIRS=       \
 361         libprtdiag      \
 362         libprtdiag_psr
 363 
 364 i386_MSGSUBDIRS= libfdisk
 365 
 366 HDRSUBDIRS=                             \
 367         ../cmd/sendmail/libmilter       \
 368         auditd_plugins  \
 369         fm              \
 370         fru             \
 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         libfstyp        \
 405         libgen          \
 406         libgrubmgmt     \
 407         libidmap        \
 408         libilb          \
 409         libima          \
 410         libinetsvc      \
 411         libinetutil     \
 412         libinstzones    \
 413         libipadm        \
 414         libipd          \
 415         libipmi         \
 416         libipmp         \
 417         libipp          \
 418         libipsecutil    \
 419         libiscsit       \
 420         libkrb5         \
 421         libkstat        \
 422         libkvm          \
 423         libmail         \
 424         libmapid        \
 425         libmd           \
 426         libmtmalloc     \
 427         libndmp         \
 428         libnsctl        \
 429         libnsl          \
 430         libnvpair       \
 431         libnwam         \
 432         libofmt         \
 433         libpam          \
 434         libpcidb        \
 435         libpctx         \
 436         libpicl         \
 437         libpicltree     \
 438         libpool         \
 439         libpp           \
 440         libproc         \
 441         libraidcfg      \
 442         librcm          \
 443         librdc          \
 444         libreparse      \
 445         librestart      \
 446         librpcsvc       \
 447         librsm          \
 448         librstp         \
 449         libsasl         \
 450         libscf          \
 451         libsec          \
 452         libsff          \
 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 libdladm
 580 $(SPARC_BLD)fm: libpri
 581 $(SPARC_BLD)fru: libpicl
 582 gss_mechs/mech_dh: libgss
 583 gss_mechs/mech_dummy: libgss
 584 gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
 585 gss_mechs/mech_spnego: gss_mechs/mech_krb5
 586 hal:            dbusdeps
 587 krb5:           gss_mechs/mech_krb5 libtecla libldap5
 588 libadt_jni:     libbsm
 589 libadutils:     libldap5 libresolv2
 590 libbe:          libzfs libinstzones libuuid libgen libdevinfo libefi libficl
 591 libbsm:         libinetutil libscf libsecdb libtsol
 592 libcfgadm:      libdevinfo
 593 libcmd:         libsum libast
 594 libcmdutils:    libavl
 595 libcpc:         libpctx
 596 libcrypt:       libgen
 597 libdevid:       libdevinfo
 598 libdevinfo:     libsec libgen
 599 libdhcpagent:   libdhcputil libuuid libdlpi libcontract
 600 libdhcputil:    libgen libinetutil libdlpi
 601 libdiskmgt:     libdevid libdevinfo libadm libefi libkstat libsysevent
 602 $(INTEL_BLD)libdiskmgt: libfdisk
 603 libdladm:       libdevinfo libinetutil libscf librcm libexacct libkstat \
 604                 libpool
 605 libdll:         libast
 606 libdlpi:        libinetutil libdladm
 607 libds:          libsysevent
 608 libdscfg:       libnsctl libunistat libadm
 609 libdtrace:      libproc libgen libctf libmapmalloc
 610 libdtrace_jni:  libuutil libdtrace
 611 libefi:         libuuid
 612 libelfsign:     libcryptoutil libkmf ../cmd/sgs/libelf
 613 libeti:         libcurses
 614 libexacct/demo: libexacct libproject
 615 libfakekernel:  libumem libcryptoutil
 616 libfcoe:        libdladm
 617 libficl:        libuuid libumem
 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 libsff:         libnvpair
 653 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 654 libshell:       libast libcmd libdll libsecdb
 655 libsip:         libmd5
 656 libsldap:       libldap5 libscf
 657 libsmbfs:       libkrb5 libsec libidmap pkcs11
 658 libsmbios:      libdevinfo
 659 libsrpt:        libstmf
 660 libstmf:        libscf
 661 libstmfproxy:   libstmf libpthread
 662 libsum:         libast
 663 libsun_ima:     libdevinfo libsysevent
 664 libsysevent:    libsecdb
 665 libtecla:       libcurses
 666 libtermcap:     libcurses
 667 libtnfctl:      ../cmd/sgs/libelf
 668 libtsalarm:     libpcp
 669 libtsnet:       libtsol libsecdb
 670 libtsol:        libsecdb
 671 libuuid:        libdlpi
 672 libv12n:        libds libuuid
 673 libvolmgt:      libadm
 674 libvrrpadm:     libdladm libscf
 675 libvscan:       libscf libsecdb
 676 libwanboot:     libresolv2 libdevinfo libinetutil libdhcputil
 677 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 678                 libumem libtsol libzfs_core
 679 libzfs_jni:     libdiskmgt libzfs
 680 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 681                 libuutil libbsm libsecdb
 682 libzonestat:    libcmdutils libumem
 683 libzpool:       libavl libumem libcmdutils libsysevent
 684 madv:           libgen
 685 mpapi:          libpthread libdevinfo libsysevent
 686 mpss:           libgen
 687 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 688 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 689 passwdutil:     libsldap
 690 pkcs11:         libcryptoutil libgen libuuid
 691 policykit:      dbusdeps
 692 print:          libldap5 libmd5 libsendfile
 693 pylibbe:        libbe libzfs
 694 pysolaris:      libsec libidmap
 695 pyzfs:          libzfs
 696 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 697 rpcsec_gss:     libgss
 698 sasl_plugins:   pkcs11 libgss libsasl
 699 scsi:           fru libumem libdevid libdevinfo
 700 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 701                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 702                 libuuid libfakekernel libads libgss libldap5 krb5
 703 storage:        libdevice libdevinfo libdevid
 704 sun_fc:         libdevinfo libsysevent
 705 sun_sas:        libdevinfo libsysevent libkstat libdevid
 706 udapl:          libdevinfo libdladm
 707 
 708 #
 709 # The reason this rule checks for the existence of the
 710 # Makefile is that some of the directories do not exist
 711 # in certain situations (e.g., exportable source builds,
 712 # OpenSolaris).
 713 #
 714 $(SUBDIRS): FRC
 715         @if [ -f $@/Makefile  ]; then \
 716                 cd $@; pwd; $(MAKE) $(TARGET); \
 717         else \
 718                 true; \
 719         fi
 720 
 721 $(SUBDIRS:%=%-nodepend):
 722         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 723                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 724         else \
 725                 true; \
 726         fi
 727 
 728 FRC: