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 # Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  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 
  30 include ../Makefile.master
  31 
  32 #       Note that libcurses installs commands along with its library.
  33 #       This is a minor bug which probably should be fixed.
  34 #       Note also that a few extra libraries are kept in cmd source.
  35 #
  36 # Certain libraries are linked with, hence depend on, other libraries.
  37 #
  38 # Although we have historically used .WAIT to express dependencies, it
  39 # reduces the amount of parallelism and thus lengthens the time it
  40 # takes to build the libraries.  Thus, we now require that any new
  41 # libraries explicitly call out their dependencies.  Eventually, all
  42 # the library dependencies will be called out explicitly.  See
  43 # "Library interdependencies" near the end of this file.
  44 #
  45 # Aside from explicit dependencies (and legacy .WAITs), all libraries
  46 # are built in parallel.
  47 #
  48 .PARALLEL:
  49 
  50 SUBDIRS= \
  51         common                  .WAIT   \
  52         ../cmd/sgs/libconv              \
  53         ../cmd/sgs/libdl        .WAIT
  54 
  55 SUBDIRS += \
  56         libc                    .WAIT   \
  57         ../cmd/sgs/libelf       .WAIT   \
  58         c_synonyms                      \
  59         libmd                           \
  60         libmd5                          \
  61         librsm                          \
  62         libmp                   .WAIT   \
  63         libnsl                  \
  64         libsecdb                .WAIT   \
  65         librpcsvc                       \
  66         libsocket               .WAIT   \
  67         libsctp                 \
  68         libsip                  \
  69         libcommputil            \
  70         libresolv                       \
  71         libresolv2              .WAIT   \
  72         libw                    .WAIT   \
  73         libintl                 .WAIT   \
  74         ../cmd/sgs/librtld_db   \
  75         libaio                  \
  76         libast                  \
  77         libdll                  \
  78         libcmd                  \
  79         libshell                \
  80         libsum                  \
  81         librt                   \
  82         libadm                  \
  83         libctf                  \
  84         libdtrace               \
  85         libdtrace_jni           \
  86         libcurses               \
  87         libtermcap              \
  88         libgen                  \
  89         libgss                  \
  90         libpam                  \
  91         libuuid                 \
  92         libthread               \
  93         libpthread      .WAIT   \
  94         libslp          \
  95         libbsdmalloc    \
  96         libdoor         \
  97         libdevinfo      \
  98         libdladm        \
  99         libdlpi         \
 100         libeti          \
 101         libcrypt        \
 102         libdns_sd       \
 103         libefi          \
 104         libfstyp        \
 105         libwanboot      \
 106         libwanbootutil  \
 107         libcryptoutil   \
 108         libinetutil     \
 109         libipadm        \
 110         libipd          \
 111         libipmp         \
 112         libiscsit       \
 113         libkmf          \
 114         libkstat        \
 115         libkvm          \
 116         liblm           \
 117         libmalloc       \
 118         libmapmalloc    \
 119         libmtmalloc     \
 120         libnls          \
 121         libnwam         \
 122         libsmbios       \
 123         libtecla        \
 124         libumem         \
 125         libnvpair       .WAIT   \
 126         libexacct       \
 127         libsasl         \
 128         libldap5        \
 129         libsldap        .WAIT   \
 130         libbsm          \
 131         libsys          \
 132         libsysevent     \
 133         libnisdb        \
 134         libpool         \
 135         libpp           \
 136         libproc         \
 137         libproject      \
 138         libsendfile     \
 139         nametoaddr      \
 140         ncad_addr       \
 141         hbaapi          \
 142         smhba           \
 143         sun_fc          \
 144         sun_sas         \
 145         gss_mechs/mech_krb5     .WAIT   \
 146         libkrb5 .WAIT   \
 147         krb5    .WAIT   \
 148         libsmbfs        \
 149         libfcoe         \
 150         libsrpt         \
 151         libstmf         \
 152         libstmfproxy    \
 153         libnsctl        \
 154         libunistat      \
 155         libdscfg        \
 156         librdc          \
 157         libinstzones    \
 158         libpkg          \
 159         libpcidb        \
 160         libm1           \
 161         libm            \
 162         libmvec
 163 
 164 
 165 SUBDIRS += \
 166         passwdutil      \
 167         pam_modules     \
 168         crypt_modules   \
 169         libadt_jni      \
 170         abi             \
 171         auditd_plugins  \
 172         libvolmgt       \
 173         libdevice       \
 174         libdevid        \
 175         libc_db         \
 176         libndmp         \
 177         libsec          \
 178         libtnfprobe     \
 179         libtnf          \
 180         libtnfctl       \
 181         libdhcpagent    \
 182         libdhcputil     \
 183         libxnet         \
 184         libipsecutil    \
 185         nsswitch        \
 186         print           \
 187         libuutil        \
 188         libscf          \
 189         libinetsvc      \
 190         librestart      \
 191         libsched        \
 192         libelfsign      \
 193         pkcs11          .WAIT   \
 194         libpctx         .WAIT   \
 195         libcpc          \
 196         getloginx       \
 197         watchmalloc     \
 198         extendedFILE    \
 199         madv            \
 200         mpss            \
 201         libdisasm       \
 202         libwrap         \
 203         libxcurses      \
 204         libxcurses2     \
 205         libbrand        .WAIT   \
 206         libzonecfg      \
 207         libzoneinfo     \
 208         libzonestat     \
 209         libtsnet        \
 210         libtsol         \
 211         gss_mechs/mech_spnego   \
 212         gss_mechs/mech_dummy    \
 213         gss_mechs/mech_dh       \
 214         rpcsec_gss      \
 215         libraidcfg      .WAIT   \
 216         librcm          .WAIT   \
 217         libcfgadm       .WAIT   \
 218         libpicl         .WAIT   \
 219         libpicltree     .WAIT \
 220         raidcfg_plugins \
 221         cfgadm_plugins  \
 222         libmail         \
 223         lvm             \
 224         libsmedia       \
 225         libipp          \
 226         libdiskmgt      \
 227         liblgrp         \
 228         libfsmgt        \
 229         fm              \
 230         libavl          \
 231         libcmdutils     \
 232         libcontract     \
 233         ../cmd/sendmail/libmilter       \
 234         sasl_plugins    \
 235         udapl           \
 236         libzpool        \
 237         libzfs_core     \
 238         libzfs          \
 239         libbe           \
 240         pylibbe         \
 241         libzfs_jni      \
 242         pyzfs           \
 243         pysolaris       \
 244         libmapid        \
 245         brand           \
 246         policykit       \
 247         hal             \
 248         libshare        \
 249         libsqlite       \
 250         libidmap        \
 251         libadutils      \
 252         libipmi         \
 253         libexacct/demo  \
 254         libvrrpadm      \
 255         libvscan        \
 256         libgrubmgmt     \
 257         libfakekernel   \
 258         smbsrv          \
 259         libilb          \
 260         scsi            \
 261         libima          \
 262         libsun_ima      \
 263         mpapi           \
 264         librstp         \
 265         libreparse      \
 266         libhotplug      \
 267         libfruutils     .WAIT   \
 268         libfru          \
 269         $($(MACH)_SUBDIRS)
 270 
 271 i386_SUBDIRS=           \
 272         libfdisk        \
 273         libsaveargs
 274 
 275 sparc_SUBDIRS= .WAIT    \
 276         efcode          \
 277         libds           \
 278         libdscp         \
 279         libprtdiag      .WAIT   \
 280         libprtdiag_psr  \
 281         libpri          \
 282         librsc          \
 283         storage         \
 284         libpcp          \
 285         libtsalarm      \
 286         libv12n
 287 
 288 FM_sparc_DEPLIBS= libpri
 289 
 290 fm:                     \
 291         libexacct       \
 292         libipmi         \
 293         libzfs          \
 294         scsi            \
 295         $(FM_$(MACH)_DEPLIBS)
 296 
 297 #
 298 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
 299 # clean and clobber targets (for more information, see those targets, below).
 300 #
 301 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 302 
 303 DCSUBDIRS =             \
 304         lvm
 305 
 306 MSGSUBDIRS=             \
 307         abi             \
 308         auditd_plugins  \
 309         brand           \
 310         cfgadm_plugins  \
 311         gss_mechs/mech_dh       \
 312         gss_mechs/mech_krb5     \
 313         krb5            \
 314         libast          \
 315         libbsm          \
 316         libc            \
 317         libcfgadm       \
 318         libcmd          \
 319         libcontract     \
 320         libcurses       \
 321         libdhcputil     \
 322         libipsecutil    \
 323         libdiskmgt      \
 324         libdladm        \
 325         libdll          \
 326         libgrubmgmt     \
 327         libgss          \
 328         libidmap        \
 329         libipmp         \
 330         libilb          \
 331         libinetutil     \
 332         libinstzones    \
 333         libipadm        \
 334         libnsl          \
 335         libnwam         \
 336         libpam          \
 337         libpicl         \
 338         libpool         \
 339         libpkg          \
 340         libpp           \
 341         libscf          \
 342         libsasl         \
 343         libldap5        \
 344         libsecdb        \
 345         libshare        \
 346         libshell        \
 347         libsldap        \
 348         libslp          \
 349         libsmbfs        \
 350         libsmedia       \
 351         libsum          \
 352         libtsol         \
 353         libuutil        \
 354         libvrrpadm      \
 355         libvscan        \
 356         libwanboot      \
 357         libwanbootutil  \
 358         libzfs          \
 359         libzonecfg      \
 360         lvm             \
 361         madv            \
 362         mpss            \
 363         pam_modules     \
 364         pyzfs           \
 365         pysolaris       \
 366         rpcsec_gss      \
 367         libreparse
 368 MSGSUBDIRS += \
 369         $($(MACH)_MSGSUBDIRS)
 370 
 371 sparc_MSGSUBDIRS=       \
 372         libprtdiag      \
 373         libprtdiag_psr
 374 
 375 i386_MSGSUBDIRS= libfdisk
 376 
 377 HDRSUBDIRS=             \
 378         auditd_plugins  \
 379         libast          \
 380         libbrand        \
 381         libbsm          \
 382         libc            \
 383         libcmd          \
 384         libcmdutils     \
 385         libcommputil    \
 386         libcontract     \
 387         libcpc          \
 388         libctf          \
 389         libcurses       \
 390         libtermcap      \
 391         libcryptoutil   \
 392         libdevice       \
 393         libdevid        \
 394         libdevinfo      \
 395         libdiskmgt      \
 396         libdladm        \
 397         libdll          \
 398         libdlpi         \
 399         libdhcpagent    \
 400         libdhcputil     \
 401         libdisasm       \
 402         libdns_sd       \
 403         libdscfg        \
 404         libdtrace       \
 405         libdtrace_jni   \
 406         libelfsign      \
 407         libeti          \
 408         libfakekernel   \
 409         libfru          \
 410         libfstyp        \
 411         libgen          \
 412         libipadm        \
 413         libipd          \
 414         libipsecutil    \
 415         libinetsvc      \
 416         libinetutil     \
 417         libinstzones    \
 418         libipmi         \
 419         libipmp         \
 420         libipp          \
 421         libiscsit       \
 422         libkstat        \
 423         libkvm          \
 424         libmail         \
 425         libmd           \
 426         libmtmalloc     \
 427         libndmp         \
 428         libnvpair       \
 429         libnsctl        \
 430         libnsl          \
 431         libnwam         \
 432         libpam          \
 433         libpcidb        \
 434         libpctx         \
 435         libpicl         \
 436         libpicltree     \
 437         libpool         \
 438         libpp           \
 439         libproc         \
 440         libraidcfg      \
 441         librcm          \
 442         librdc          \
 443         libscf          \
 444         libsip          \
 445         libsmbios       \
 446         librestart      \
 447         librpcsvc       \
 448         librsm          \
 449         librstp         \
 450         libsasl         \
 451         libsec          \
 452         libshell        \
 453         libslp          \
 454         libsmedia       \
 455         libsocket       \
 456         libsqlite       \
 457         libfcoe         \
 458         libsrpt         \
 459         libstmf         \
 460         libstmfproxy    \
 461         libsum          \
 462         libsysevent     \
 463         libtecla        \
 464         libtnf          \
 465         libtnfctl       \
 466         libtnfprobe     \
 467         libtsnet        \
 468         libtsol         \
 469         libvrrpadm      \
 470         libvolmgt       \
 471         libumem         \
 472         libunistat      \
 473         libuutil        \
 474         libwanboot      \
 475         libwanbootutil  \
 476         libwrap         \
 477         libxcurses2     \
 478         libzfs          \
 479         libzfs_core     \
 480         libzfs_jni      \
 481         libzoneinfo     \
 482         libzonestat     \
 483         hal             \
 484         policykit       \
 485         lvm             \
 486         pkcs11          \
 487         passwdutil      \
 488         ../cmd/sendmail/libmilter       \
 489         fm              \
 490         udapl           \
 491         libmapid        \
 492         libkrb5         \
 493         libsmbfs        \
 494         libshare        \
 495         libidmap        \
 496         libvscan        \
 497         libgrubmgmt     \
 498         smbsrv          \
 499         libilb          \
 500         scsi            \
 501         hbaapi          \
 502         smhba           \
 503         libima          \
 504         libsun_ima      \
 505         mpapi           \
 506         libreparse      \
 507         $($(MACH)_HDRSUBDIRS)
 508 
 509 i386_HDRSUBDIRS=        \
 510         libfdisk        \
 511         libsaveargs
 512 
 513 sparc_HDRSUBDIRS=       \
 514         libds           \
 515         libdscp         \
 516         libpri          \
 517         libv12n         \
 518         storage
 519 
 520 all :=          TARGET= all
 521 check :=        TARGET= check
 522 clean :=        TARGET= clean
 523 clobber :=      TARGET= clobber
 524 install :=      TARGET= install
 525 install_h :=    TARGET= install_h
 526 lint :=         TARGET= lint
 527 _dc :=          TARGET= _dc
 528 _msg :=         TARGET= _msg
 529 
 530 .KEEP_STATE:
 531 
 532 #
 533 # For the all and install targets, we clearly must respect library
 534 # dependencies so that the libraries link correctly.  However, for
 535 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 536 # and _msg), libraries do not have any dependencies on one another
 537 # and thus respecting dependencies just slows down the build.
 538 # As such, for these rules, we use pattern replacement to explicitly
 539 # avoid triggering the dependency information.  Note that for clean,
 540 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 541 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 542 #
 543 
 544 all:                    $(SUBDIRS)
 545 
 546 install:                $(SUBDIRS) .WAIT install_extra
 547 
 548 # extra libraries kept in other source areas
 549 install_extra:
 550         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 551         @pwd
 552 
 553 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 554 
 555 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 556 
 557 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 558 
 559 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 560 
 561 #
 562 # Library interdependencies are called out explicitly here
 563 #
 564 auditd_plugins: libbsm libnsl libsecdb
 565 krb5:           gss_mechs/mech_krb5
 566 gss_mechs/mech_krb5:    libgss libnsl libsocket libresolv pkcs11
 567 gss_mechs/mech_spnego:  gss_mechs/mech_krb5
 568 libadt_jni:     libbsm
 569 libast:         libsocket libm
 570 libadutils:     libldap5 libresolv libsocket libnsl
 571 nsswitch:       libadutils libidmap
 572 libbe:          libzfs
 573 libbsm:         libtsol
 574 libcmd:         libsum libast libsocket libnsl
 575 libcmdutils:    libavl libnvpair
 576 libcontract:    libnvpair
 577 libcpc:         libdevinfo
 578 libdevid:       libdevinfo
 579 libdevinfo:     libnvpair libsec
 580 libdhcpagent:   libsocket libdhcputil libuuid libdlpi libcontract
 581 libdhcputil:    libnsl libgen libinetutil libdlpi
 582 libdladm:       libdevinfo libinetutil libsocket libscf librcm libnvpair \
 583                 libexacct libnsl libkstat libcurses
 584 libdevice:      libnvpair
 585 libdll:         libast
 586 libdlpi:        libinetutil libdladm
 587 libds:          libsysevent
 588 libdscfg:       libnsctl libunistat libsocket libnsl
 589 libdtrace:      libproc libgen libctf libmapmalloc
 590 libdtrace_jni:  libuutil libdtrace
 591 libefi:         libuuid
 592 libfcoe:        libdladm
 593 libfstyp:       libnvpair
 594 libelfsign:     libcryptoutil libkmf
 595 libidmap:       libadutils libldap5 libavl libsldap libuutil
 596 libipadm:       libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
 597                 libdladm libsecdb
 598 libiscsit:      libc libnvpair libstmf libuuid libnsl
 599 libkmf:         libcryptoutil pkcs11
 600 libm:           libc
 601 libm1:          libc libm
 602 libmvec:        libc libm
 603 libnsl:         libmd5
 604 libmapid:       libresolv
 605 libnisdb:       libnsl libldap5
 606 librcm:         libnvpair
 607 librdc:         libsocket libnsl libnsctl libunistat libdscfg
 608 libuuid:        libdlpi
 609 libinetutil:    libsocket
 610 libipsecutil:   libtecla libsocket
 611 libinstzones:   libzonecfg libcontract
 612 libpkg:         libwanboot libscf libadm
 613 libnwam:        libscf libbsm libdladm
 614 libsecdb:       libnsl
 615 libsasl:        libgss libsocket pkcs11 libmd
 616 sasl_plugins:   pkcs11 libgss libsocket libsasl
 617 libsctp:        libsocket
 618 libshell:       libast libcmd libdll libsocket libsecdb libm
 619 libsip:         libmd5
 620 libsmbfs:       libcmdutils libsocket libnsl libkrb5 libsec libidmap
 621 libsocket:      libnsl
 622 libstmfproxy:   libstmf libsocket libnsl libpthread
 623 libsum:         libast
 624 libsysevent:    libsecdb libnvpair
 625 libldap5:       libsasl libsocket libnsl libmd
 626 libsldap:       libldap5 libtsol libnsl libc libscf libresolv
 627 libpool:        libnvpair libexacct
 628 libpp:          libast
 629 libzonecfg:     libc libsocket libnsl libuuid libnvpair libsysevent libsec \
 630                 libbrand libpool libscf
 631 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
 632 libproject:     libpool libproc libsecdb
 633 libtermcap:     libcurses
 634 libtsnet:       libnsl libtsol libsecdb
 635 libwrap:        libnsl libsocket
 636 libwanboot:     libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
 637                 libdhcputil
 638 libwanbootutil: libnsl
 639 pam_modules:    libproject passwdutil smbsrv libtsnet
 640 libscf:         libuutil libmd libgen libsmbios libnsl libnvpair
 641 libinetsvc:     libscf
 642 librestart:     libuutil libscf libpool libproject libsecdb libnvpair
 643 libsaveargs:    libdisasm
 644 ../cmd/sgs/libdl:       ../cmd/sgs/libconv
 645 ../cmd/sgs/libelf:      ../cmd/sgs/libconv
 646 passwdutil:     libsldap
 647 pkcs11:         libcryptoutil libmd
 648 #               Adding libuuid or libdladm results in a circular dependancy
 649 print:          libldap5
 650 udapl/udapl_tavor:      udapl/libdat
 651 libzfs:         libdevid libgen libnvpair libuutil \
 652                 libadm libavl libefi libidmap libmd libzfs_core libm
 653 libzfs_core:    libnvpair
 654 libzfs_jni:     libdiskmgt libnvpair libzfs
 655 libzpool:       libavl libumem libnvpair libcmdutils
 656 libsec:         libavl libidmap
 657 brand:          libc libsocket
 658 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 659 libexacct/demo: libexacct libproject libsocket libnsl
 660 libtsalarm:     libpcp
 661 smbsrv:         libsocket libnsl libmd libxnet libpthread librt \
 662                 libshare libidmap pkcs11 libsqlite libcryptoutil \
 663                 libreparse libcmdutils libfakekernel
 664 libv12n:        libds libuuid
 665 libvrrpadm:     libsocket libdladm libscf
 666 libvscan:       libscf
 667 libfru:         libfruutils
 668 scsi:           libnvpair libfru
 669 mpapi:          libpthread libdevinfo libsysevent libnvpair
 670 sun_fc:         libdevinfo libsysevent libnvpair
 671 libsun_ima:     libdevinfo libsysevent libnsl
 672 sun_sas:        libdevinfo libsysevent libnvpair libkstat libdevid
 673 libgrubmgmt:    libdevinfo libzfs libfstyp
 674 pylibbe:        libbe libzfs
 675 pyzfs:          libnvpair libzfs
 676 pysolaris:      libsec libidmap
 677 libreparse:     libnvpair
 678 libhotplug:     libnvpair
 679 cfgadm_plugins: libhotplug
 680 libilb:         libsocket
 681 libipmi:        libm
 682 libprtdiag:     libm
 683 libsqlite:      libm
 684 libstmf:        libm
 685 libvscan:       libm
 686 
 687 
 688 $(INTEL_BUILD)libdiskmgt:libfdisk
 689 
 690 #
 691 # The reason this rule checks for the existence of the
 692 # Makefile is that some of the directories do not exist
 693 # in certain situations (e.g., exportable source builds,
 694 # OpenSolaris).
 695 #
 696 $(SUBDIRS): FRC
 697         @if [ -f $@/Makefile  ]; then \
 698                 cd $@; pwd; $(MAKE) $(TARGET); \
 699         else \
 700                 true; \
 701         fi
 702 
 703 $(SUBDIRS:%=%-nodepend):
 704         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 705                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 706         else \
 707                 true; \
 708         fi
 709 
 710 FRC: