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         smbsrv          \
 258         libilb          \
 259         scsi            \
 260         libima          \
 261         libsun_ima      \
 262         mpapi           \
 263         librstp         \
 264         libreparse      \
 265         libhotplug      \
 266         libfruutils     .WAIT   \
 267         libfru          \
 268         zlib            \
 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         libfru          \
 409         libfstyp        \
 410         libgen          \
 411         libipadm        \
 412         libipd          \
 413         libipsecutil    \
 414         libinetsvc      \
 415         libinetutil     \
 416         libinstzones    \
 417         libipmi         \
 418         libipmp         \
 419         libipp          \
 420         libiscsit       \
 421         libkstat        \
 422         libkvm          \
 423         libmail         \
 424         libmd           \
 425         libmtmalloc     \
 426         libndmp         \
 427         libnvpair       \
 428         libnsctl        \
 429         libnsl          \
 430         libnwam         \
 431         libpam          \
 432         libpcidb        \
 433         libpctx         \
 434         libpicl         \
 435         libpicltree     \
 436         libpool         \
 437         libpp           \
 438         libproc         \
 439         libraidcfg      \
 440         librcm          \
 441         librdc          \
 442         libscf          \
 443         libsip          \
 444         libsmbios       \
 445         librestart      \
 446         librpcsvc       \
 447         librsm          \
 448         librstp         \
 449         libsasl         \
 450         libsec          \
 451         libshell        \
 452         libslp          \
 453         libsmedia       \
 454         libsocket       \
 455         libsqlite       \
 456         libfcoe         \
 457         libsrpt         \
 458         libstmf         \
 459         libstmfproxy    \
 460         libsum          \
 461         libsysevent     \
 462         libtecla        \
 463         libtnf          \
 464         libtnfctl       \
 465         libtnfprobe     \
 466         libtsnet        \
 467         libtsol         \
 468         libvrrpadm      \
 469         libvolmgt       \
 470         libumem         \
 471         libunistat      \
 472         libuutil        \
 473         libwanboot      \
 474         libwanbootutil  \
 475         libwrap         \
 476         libxcurses2     \
 477         libzfs          \
 478         libzfs_core     \
 479         libzfs_jni      \
 480         libzoneinfo     \
 481         libzonestat     \
 482         hal             \
 483         policykit       \
 484         lvm             \
 485         pkcs11          \
 486         passwdutil      \
 487         ../cmd/sendmail/libmilter       \
 488         fm              \
 489         udapl           \
 490         libmapid        \
 491         libkrb5         \
 492         libsmbfs        \
 493         libshare        \
 494         libidmap        \
 495         libvscan        \
 496         libgrubmgmt     \
 497         smbsrv          \
 498         libilb          \
 499         scsi            \
 500         hbaapi          \
 501         smhba           \
 502         libima          \
 503         libsun_ima      \
 504         mpapi           \
 505         libreparse      \
 506         zlib            \
 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 gss_mechs/mech_krb5:    libgss libnsl libsocket libresolv pkcs11
 566 libadt_jni:     libbsm
 567 libast:         libsocket libm
 568 libadutils:     libldap5 libresolv libsocket libnsl
 569 nsswitch:       libadutils libidmap
 570 libbe:          libzfs
 571 libbsm:         libtsol
 572 libcmd:         libsum libast libsocket libnsl
 573 libcmdutils:    libavl
 574 libcontract:    libnvpair
 575 libdevid:       libdevinfo
 576 libdevinfo:     libnvpair libsec
 577 libdhcpagent:   libsocket libdhcputil libuuid libdlpi libcontract
 578 libdhcputil:    libnsl libgen libinetutil libdlpi
 579 libdladm:       libdevinfo libinetutil libsocket libscf librcm libnvpair \
 580                 libexacct libnsl libkstat libcurses
 581 libdll:         libast
 582 libdlpi:        libinetutil libdladm
 583 libds:          libsysevent
 584 libdscfg:       libnsctl libunistat libsocket libnsl
 585 libdtrace:      libproc libgen libctf
 586 libdtrace_jni:  libuutil libdtrace
 587 libefi:         libuuid
 588 libfstyp:       libnvpair
 589 libelfsign:     libcryptoutil libkmf
 590 libidmap:       libadutils libldap5 libavl libsldap libuutil
 591 libipadm:       libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
 592                 libdladm libsecdb
 593 libiscsit:      libc libnvpair libstmf libuuid libnsl
 594 libkmf:         libcryptoutil pkcs11
 595 libm:           libc
 596 libm1:          libc libm
 597 libmvec:        libc libm
 598 libnsl:         libmd5
 599 libmapid:       libresolv
 600 librdc:         libsocket libnsl libnsctl libunistat libdscfg
 601 libuuid:        libdlpi
 602 libinetutil:    libsocket
 603 libipsecutil:   libtecla libsocket
 604 libinstzones:   libzonecfg libcontract
 605 libpkg:         libwanboot libscf libadm
 606 libnwam:        libscf
 607 libsecdb:       libnsl
 608 libsasl:        libgss libsocket pkcs11 libmd
 609 sasl_plugins:   pkcs11 libgss libsocket libsasl
 610 libsctp:        libsocket
 611 libshell:       libast libcmd libdll libsocket libsecdb libm
 612 libsip:         libmd5
 613 libsmbfs:       libcmdutils libsocket libnsl libkrb5
 614 libsocket:      libnsl
 615 libstmfproxy:   libstmf libsocket libnsl libpthread
 616 libsum:         libast
 617 libsysevent:    libsecdb
 618 libldap5:       libsasl libsocket libnsl libmd
 619 libsldap:       libldap5 libtsol libnsl libc libscf libresolv
 620 libpool:        libnvpair libexacct
 621 libpp:          libast
 622 libzonecfg:     libc libsocket libnsl libuuid libnvpair libsysevent libsec \
 623                 libbrand libpool libscf
 624 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
 625 libproject:     libpool libproc libsecdb
 626 libtermcap:     libcurses
 627 libtsnet:       libnsl libtsol libsecdb
 628 libwrap:        libnsl libsocket
 629 libwanboot:     libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
 630                 libdhcputil
 631 libwanbootutil: libnsl
 632 pam_modules:    libproject passwdutil smbsrv
 633 libscf:         libuutil libmd libgen libsmbios libnsl
 634 libinetsvc:     libscf
 635 librestart:     libuutil libscf
 636 libsaveargs:    libdisasm
 637 ../cmd/sgs/libdl:       ../cmd/sgs/libconv
 638 ../cmd/sgs/libelf:      ../cmd/sgs/libconv
 639 pkcs11:         libcryptoutil
 640 print:          libldap5
 641 udapl/udapl_tavor:      udapl/libdat
 642 libzfs:         libdevid libgen libnvpair libuutil \
 643                 libadm libavl libefi libidmap libmd libzfs_core libm
 644 libzfs_core:    libnvpair
 645 libzfs_jni:     libdiskmgt libnvpair libzfs
 646 libzpool:       libavl libumem libnvpair libcmdutils zlib
 647 libsec:         libavl libidmap
 648 brand:          libc libsocket
 649 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 650 libexacct/demo: libexacct libproject libsocket libnsl
 651 libtsalarm:     libpcp
 652 smbsrv:         libsocket libnsl libmd libxnet libpthread librt \
 653                 libshare libidmap pkcs11 libsqlite libcryptoutil \
 654                 libreparse libcmdutils
 655 libv12n:        libds libuuid
 656 libvrrpadm:     libsocket libdladm libscf
 657 libvscan:       libscf
 658 libfru:         libfruutils
 659 scsi:           libnvpair libfru
 660 mpapi:          libpthread libdevinfo libsysevent libnvpair
 661 sun_fc:         libdevinfo libsysevent libnvpair
 662 libsun_ima:     libdevinfo libsysevent libnsl
 663 sun_sas:        libdevinfo libsysevent libnvpair libkstat libdevid
 664 libgrubmgmt:    libdevinfo libzfs libfstyp
 665 pylibbe:        libbe libzfs
 666 pyzfs:          libnvpair libzfs
 667 pysolaris:      libsec libidmap
 668 libreparse:     libnvpair
 669 libhotplug:     libnvpair
 670 cfgadm_plugins: libhotplug
 671 libilb:         libsocket
 672 libipmi:        libm
 673 libprtdiag:     libm
 674 libsqlite:      libm
 675 libstmf:        libm
 676 libvscan:       libm
 677 
 678 
 679 $(INTEL_BUILD)libdiskmgt:libfdisk
 680 
 681 #
 682 # The reason this rule checks for the existence of the
 683 # Makefile is that some of the directories do not exist
 684 # in certain situations (e.g., exportable source builds,
 685 # OpenSolaris).
 686 #
 687 $(SUBDIRS): FRC
 688         @if [ -f $@/Makefile  ]; then \
 689                 cd $@; pwd; $(MAKE) $(TARGET); \
 690         else \
 691                 true; \
 692         fi
 693 
 694 $(SUBDIRS:%=%-nodepend):
 695         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 696                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 697         else \
 698                 true; \
 699         fi
 700 
 701 FRC: