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