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