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