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         getloginx       \
  78         gss_mechs/mech_dh       \
  79         gss_mechs/mech_dummy    \
  80         gss_mechs/mech_krb5     \
  81         gss_mechs/mech_spnego   \
  82         hal             \
  83         hbaapi          \
  84         krb5            \
  85         libadm          \
  86         libads          \
  87         libadt_jni      \
  88         libadutils      \
  89         libaio          \
  90         libast          \
  91         libavl          \
  92         libbe           \
  93         libbrand        \
  94         libbsdmalloc    \
  95         libbsm          \
  96         libc_db         \
  97         libcfgadm       \
  98         libcmd          \
  99         libcmdutils     \
 100         libcommputil    \
 101         libcontract     \
 102         libcpc          \
 103         libcrypt        \
 104         libcryptoutil   \
 105         libctf          \
 106         libcurses       \
 107         libdevice       \
 108         libdevid        \
 109         libdevinfo      \
 110         libdhcpagent    \
 111         libdhcputil     \
 112         libdisasm       \
 113         libdiskmgt      \
 114         libdladm        \
 115         libdll          \
 116         libdlpi         \
 117         libdns_sd       \
 118         libdoor         \
 119         libdscfg        \
 120         libdtrace       \
 121         libdtrace_jni   \
 122         libefi          \
 123         libelfsign      \
 124         libeti          \
 125         libexacct       \
 126         libexacct/demo  \
 127         libfakekernel   \
 128         libfcoe         \
 129         libficl         \
 130         libfru          \
 131         libfruutils     \
 132         libfsmgt        \
 133         libfstyp        \
 134         libgen          \
 135         libgrubmgmt     \
 136         libgss          \
 137         libhotplug      \
 138         libidmap        \
 139         libilb          \
 140         libima          \
 141         libinetsvc      \
 142         libinetutil     \
 143         libinstzones    \
 144         libintl         \
 145         libipadm        \
 146         libipd          \
 147         libipmi         \
 148         libipmp         \
 149         libipp          \
 150         libipsecutil    \
 151         libiscsit       \
 152         libkmf          \
 153         libkrb5         \
 154         libkstat        \
 155         libkvm          \
 156         libldap5        \
 157         liblgrp         \
 158         liblm           \
 159         libm1           \
 160         libmail         \
 161         libmalloc       \
 162         libmapid        \
 163         libmapmalloc    \
 164         libmd5          \
 165         libmtmalloc     \
 166         libmvec         \
 167         libndmp         \
 168         libnisdb        \
 169         libnls          \
 170         libnsctl        \
 171         libnwam         \
 172         libofmt         \
 173         libpam          \
 174         libpcidb        \
 175         libpctx         \
 176         libpicl         \
 177         libpicltree     \
 178         libpkg          \
 179         libpool         \
 180         libpp           \
 181         libproc         \
 182         libproject      \
 183         libpthread      \
 184         libraidcfg      \
 185         librcm          \
 186         librdc          \
 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         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         libsff          \
 454         libshare        \
 455         libshell        \
 456         libsip          \
 457         libslp          \
 458         libsmbfs        \
 459         libsmbios       \
 460         libsmedia       \
 461         libsocket       \
 462         libsqlite       \
 463         libsrpt         \
 464         libstmf         \
 465         libstmfproxy    \
 466         libsum          \
 467         libsun_ima      \
 468         libsysevent     \
 469         libtecla        \
 470         libtermcap      \
 471         libtnf          \
 472         libtnfctl       \
 473         libtnfprobe     \
 474         libtsnet        \
 475         libtsol         \
 476         libumem         \
 477         libunistat      \
 478         libuutil        \
 479         libvolmgt       \
 480         libvrrpadm      \
 481         libvscan        \
 482         libwanboot      \
 483         libwanbootutil  \
 484         libwrap         \
 485         libxcurses2     \
 486         libzfs          \
 487         libzfs_core     \
 488         libzfs_jni      \
 489         libzoneinfo     \
 490         libzonestat     \
 491         mpapi           \
 492         passwdutil      \
 493         pkcs11          \
 494         policykit       \
 495         scsi            \
 496         smbsrv          \
 497         smhba           \
 498         udapl           \
 499         $($(MACH)_HDRSUBDIRS)
 500 
 501 i386_HDRSUBDIRS=        \
 502         libfdisk        \
 503         libsaveargs
 504 
 505 sparc_HDRSUBDIRS=       \
 506         libds           \
 507         libdscp         \
 508         libpri          \
 509         libv12n         \
 510         storage
 511 
 512 all :=          TARGET= all
 513 check :=        TARGET= check
 514 clean :=        TARGET= clean
 515 clobber :=      TARGET= clobber
 516 install :=      TARGET= install
 517 install_h :=    TARGET= install_h
 518 lint :=         TARGET= lint
 519 _dc :=          TARGET= _dc
 520 _msg :=         TARGET= _msg
 521 
 522 .KEEP_STATE:
 523 
 524 #
 525 # For the all and install targets, we clearly must respect library
 526 # dependencies so that the libraries link correctly.  However, for
 527 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 528 # and _msg), libraries do not have any dependencies on one another
 529 # and thus respecting dependencies just slows down the build.
 530 # As such, for these rules, we use pattern replacement to explicitly
 531 # avoid triggering the dependency information.  Note that for clean,
 532 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 533 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 534 #
 535 
 536 all:                    $(SUBDIRS)
 537 
 538 install:                $(SUBDIRS) .WAIT install_extra
 539 
 540 # extra libraries kept in other source areas
 541 install_extra:
 542         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 543         @pwd
 544 
 545 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 546 
 547 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 548 
 549 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 550 
 551 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 552 
 553 # Library interdependencies are called out explicitly here.
 554 ../cmd/sgs/libconv: crt
 555 ../cmd/sgs/libdl: crt
 556 libc:           ../cmd/sgs/libconv ../cmd/sgs/libdl
 557 
 558 libm:           libc
 559 libmd:          libc
 560 libmp:          libc
 561 libnsl:         libc libmd libmp
 562 libnvpair:      libc libnsl
 563 libsocket:      libc libnsl
 564 
 565 basedeps:       libc libm libmd libmp libnsl libnvpair libsocket
 566 basedeps :=     TARGET=install
 567 
 568 # The following dependencies are currently required by libdbus-1 and should
 569 # be used for anything linking against it.
 570 dbusdeps:       libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
 571 
 572 # The following dependencies don't need to be listed below as they are built
 573 # before everything else:
 574 # libc libm libmd libmp libnsl libnvpair libsocket
 575 abi:            libctf libmapmalloc libproc
 576 auditd_plugins: libbsm libsecdb libgss libmtmalloc
 577 brand:          libzonecfg libmapmalloc
 578 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
 579 fm:             libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
 580                 libcontract libsysevent ../cmd/sgs/libelf libdladm
 581 $(SPARC_BLD)fm: libpri
 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 libfru:         libfruutils
 619 libfsmgt:       libkstat
 620 libgrubmgmt:    libdevinfo libzfs libfstyp libefi
 621 $(INTEL_BLD)libgrubmgmt: libfdisk
 622 libidmap:       libavl libuutil
 623 libinetsvc:     libscf
 624 libinstzones:   libzonecfg libcontract
 625 libipadm:       libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
 626 libipmp:        libinetutil
 627 libipsecutil:   libtecla libtsol
 628 libiscsit:      libstmf libuuid
 629 libkmf:         libcryptoutil pkcs11
 630 libkvm:         ../cmd/sgs/libelf
 631 libldap5:       libsasl
 632 libmapid:       libresolv2 libscf
 633 libndmp:        libscf
 634 libnisdb:       libldap5
 635 libnwam:        libscf libbsm libdladm libipadm
 636 libpcp:         libumem libdevinfo
 637 libpctx:        libproc
 638 libpkg:         libwanboot libscf libadm
 639 libpool:        libscf libexacct
 640 libpp:          libast
 641 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
 642 $(INTEL_BLD)libproc: libsaveargs
 643 libproject:     libpool libproc libsecdb
 644 libprtdiag:     libkstat
 645 libprtdiag_psr: libprtdiag
 646 libraidcfg:     libdevinfo
 647 librdc:         libnsctl libunistat libdscfg
 648 librestart:     libuutil libscf libpool libproject libsecdb libsysevent
 649 libsasl:        libgss pkcs11
 650 libsaveargs:    libdisasm
 651 libscf:         libuutil libgen libsmbios
 652 libsec:         libavl libidmap
 653 libsff:         libnvpair
 654 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 655 libshell:       libast libcmd libdll libsecdb
 656 libsip:         libmd5
 657 libsldap:       libldap5 libscf
 658 libsmbfs:       libkrb5 libsec libidmap pkcs11
 659 libsmbios:      libdevinfo
 660 libsrpt:        libstmf
 661 libstmf:        libscf
 662 libstmfproxy:   libstmf libpthread
 663 libsum:         libast
 664 libsun_ima:     libdevinfo libsysevent
 665 libsysevent:    libsecdb
 666 libtecla:       libcurses
 667 libtermcap:     libcurses
 668 libtnfctl:      ../cmd/sgs/libelf
 669 libtsalarm:     libpcp
 670 libtsnet:       libtsol libsecdb
 671 libtsol:        libsecdb
 672 libuuid:        libdlpi
 673 libv12n:        libds libuuid
 674 libvolmgt:      libadm
 675 libvrrpadm:     libdladm libscf
 676 libvscan:       libscf libsecdb
 677 libwanboot:     libresolv2 libdevinfo libinetutil libdhcputil
 678 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 679                 libumem libtsol libzfs_core
 680 libzfs_jni:     libdiskmgt libzfs
 681 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 682                 libuutil libbsm libsecdb
 683 libzonestat:    libcmdutils libumem
 684 libzpool:       libavl libumem libcmdutils libsysevent
 685 madv:           libgen
 686 mpapi:          libpthread libdevinfo libsysevent
 687 mpss:           libgen
 688 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 689 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 690 passwdutil:     libsldap
 691 pkcs11:         libcryptoutil libgen libuuid
 692 policykit:      dbusdeps
 693 print:          libldap5 libmd5 libsendfile
 694 pylibbe:        libbe libzfs
 695 pysolaris:      libsec libidmap
 696 pyzfs:          libzfs
 697 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 698 rpcsec_gss:     libgss
 699 sasl_plugins:   pkcs11 libgss libsasl
 700 scsi:           libfru libumem libdevid libdevinfo
 701 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 702                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 703                 libuuid libfakekernel libads libgss libldap5 krb5
 704 storage:        libdevice libdevinfo libdevid
 705 sun_fc:         libdevinfo libsysevent
 706 sun_sas:        libdevinfo libsysevent libkstat libdevid
 707 udapl:          libdevinfo libdladm
 708 
 709 #
 710 # The reason this rule checks for the existence of the
 711 # Makefile is that some of the directories do not exist
 712 # in certain situations (e.g., exportable source builds,
 713 # OpenSolaris).
 714 #
 715 $(SUBDIRS): FRC
 716         @if [ -f $@/Makefile  ]; then \
 717                 cd $@; pwd; $(MAKE) $(TARGET); \
 718         else \
 719                 true; \
 720         fi
 721 
 722 $(SUBDIRS:%=%-nodepend):
 723         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 724                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 725         else \
 726                 true; \
 727         fi
 728 
 729 FRC: