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         libfsd
 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         libdhcpsvc      \
 176         libc_db         \
 177         libndmp         \
 178         libsec          \
 179         libtnfprobe     \
 180         libtnf          \
 181         libtnfctl       \
 182         libdhcpagent    \
 183         libdhcpdu       \
 184         libdhcputil     \
 185         libxnet         \
 186         libipsecutil
 187 $(CLOSED_BUILD)SUBDIRS += \
 188         $(CLOSED)/lib/libike
 189 SUBDIRS += \
 190         nsswitch        \
 191         print           \
 192         libuutil        \
 193         libscf          \
 194         libinetsvc      \
 195         librestart      \
 196         libsched        \
 197         libelfsign      \
 198         pkcs11          .WAIT   \
 199         libpctx         .WAIT   \
 200         libcpc          \
 201         watchmalloc     \
 202         extendedFILE    \
 203         madv            \
 204         mpss            \
 205         libdisasm       \
 206         libwrap         \
 207         libxcurses      \
 208         libxcurses2     \
 209         libbrand        .WAIT   \
 210         libzonecfg      \
 211         libzoneinfo     \
 212         libzonestat     \
 213         libtsnet        \
 214         libtsol         \
 215         gss_mechs/mech_spnego   \
 216         gss_mechs/mech_dummy    \
 217         gss_mechs/mech_dh       \
 218         rpcsec_gss      \
 219         libraidcfg      .WAIT   \
 220         librcm          .WAIT   \
 221         libcfgadm       .WAIT   \
 222         libpicl         .WAIT   \
 223         libpicltree     .WAIT \
 224         raidcfg_plugins \
 225         cfgadm_plugins  \
 226         libmail         \
 227         lvm             \
 228         libsmedia       \
 229         libipp          \
 230         libdiskmgt      \
 231         liblgrp         \
 232         libfsmgt        \
 233         fm              \
 234         libavl          \
 235         libcmdutils     \
 236         libcontract     \
 237         ../cmd/sendmail/libmilter       \
 238         sasl_plugins    \
 239         udapl           \
 240         libzpool        \
 241         libzfs_core     \
 242         libzfs          \
 243         libbe           \
 244         pylibbe         \
 245         libzfs_jni      \
 246         pyzfs           \
 247         pysolaris       \
 248         libmapid        \
 249         brand           \
 250         policykit       \
 251         hal             \
 252         libshare        \
 253         libsqlite       \
 254         libidmap        \
 255         libadutils      \
 256         libipmi         \
 257         libexacct/demo  \
 258         libvrrpadm      \
 259         libvscan        \
 260         libgrubmgmt     \
 261         smbsrv          \
 262         libilb          \
 263         scsi            \
 264         libima          \
 265         libsun_ima      \
 266         mpapi           \
 267         librstp         \
 268         libreparse      \
 269         libhotplug      \
 270         libfruutils     .WAIT   \
 271         libfru          \
 272         $($(MACH)_SUBDIRS)
 273 
 274 i386_SUBDIRS=           \
 275         libntfs         \
 276         libparted       \
 277         libfdisk        \
 278         libsaveargs
 279 
 280 sparc_SUBDIRS= .WAIT    \
 281         efcode          \
 282         libds           \
 283         libdscp         \
 284         libprtdiag      .WAIT   \
 285         libprtdiag_psr  \
 286         libpri          \
 287         librsc          \
 288         storage         \
 289         libpcp          \
 290         libtsalarm      \
 291         libv12n
 292 
 293 FM_sparc_DEPLIBS= libpri
 294 
 295 fm:                     \
 296         libexacct       \
 297         libipmi         \
 298         libzfs          \
 299         scsi            \
 300         $(FM_$(MACH)_DEPLIBS)
 301 
 302 #
 303 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
 304 # clean and clobber targets (for more information, see those targets, below).
 305 #
 306 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 307 
 308 DCSUBDIRS =             \
 309         lvm
 310 
 311 MSGSUBDIRS=             \
 312         abi             \
 313         auditd_plugins  \
 314         brand           \
 315         cfgadm_plugins  \
 316         gss_mechs/mech_dh       \
 317         gss_mechs/mech_krb5     \
 318         krb5            \
 319         libast          \
 320         libbsm          \
 321         libc            \
 322         libcfgadm       \
 323         libcmd          \
 324         libcontract     \
 325         libcurses       \
 326         libdhcpsvc      \
 327         libdhcputil     \
 328         libipsecutil    \
 329         libdiskmgt      \
 330         libdladm        \
 331         libdll          \
 332         libgrubmgmt     \
 333         libgss          \
 334         libidmap        \
 335         libipmp         \
 336         libilb          \
 337         libinetutil     \
 338         libinstzones    \
 339         libipadm        \
 340         libnsl          \
 341         libnwam         \
 342         libpam          \
 343         libpicl         \
 344         libpool         \
 345         libpkg          \
 346         libpp           \
 347         libscf          \
 348         libsasl         \
 349         libldap5        \
 350         libsecdb        \
 351         libshare        \
 352         libshell        \
 353         libsldap        \
 354         libslp          \
 355         libsmbfs        \
 356         libsmedia       \
 357         libsum          \
 358         libtsol         \
 359         libuutil        \
 360         libvrrpadm      \
 361         libvscan        \
 362         libwanboot      \
 363         libwanbootutil  \
 364         libzfs          \
 365         libzonecfg      \
 366         lvm             \
 367         madv            \
 368         mpss            \
 369         pam_modules     \
 370         pyzfs           \
 371         pysolaris       \
 372         rpcsec_gss      \
 373         libreparse
 374 MSGSUBDIRS += \
 375         $($(MACH)_MSGSUBDIRS)
 376 
 377 sparc_MSGSUBDIRS=       \
 378         libprtdiag      \
 379         libprtdiag_psr
 380 
 381 i386_MSGSUBDIRS= libfdisk
 382 
 383 HDRSUBDIRS=             \
 384         auditd_plugins  \
 385         libast          \
 386         libbrand        \
 387         libbsm          \
 388         libc            \
 389         libcmd          \
 390         libcmdutils     \
 391         libcommputil    \
 392         libcontract     \
 393         libcpc          \
 394         libctf          \
 395         libcurses       \
 396         libtermcap      \
 397         libcryptoutil   \
 398         libdevice       \
 399         libdevid        \
 400         libdevinfo      \
 401         libdiskmgt      \
 402         libdladm        \
 403         libdll          \
 404         libdlpi         \
 405         libdhcpagent    \
 406         libdhcpsvc      \
 407         libdhcputil     \
 408         libdisasm       \
 409         libdns_sd       \
 410         libdscfg        \
 411         libdtrace       \
 412         libdtrace_jni   \
 413         libelfsign      \
 414         libeti          \
 415         libfru          \
 416         libfstyp        \
 417         libgen          \
 418         libipadm        \
 419         libipsecutil    \
 420         libinetsvc      \
 421         libinetutil     \
 422         libinstzones    \
 423         libipmi         \
 424         libipmp         \
 425         libipp          \
 426         libiscsit       \
 427         libkstat        \
 428         libkvm          \
 429         libmail         \
 430         libmd           \
 431         libmtmalloc     \
 432         libndmp         \
 433         libnvpair       \
 434         libnsctl        \
 435         libnsl          \
 436         libnwam         \
 437         libpam          \
 438         libpcidb        \
 439         libpctx         \
 440         libpicl         \
 441         libpicltree     \
 442         libpool         \
 443         libpp           \
 444         libproc         \
 445         libraidcfg      \
 446         librcm          \
 447         librdc          \
 448         libscf          \
 449         libsip          \
 450         libsmbios       \
 451         librestart      \
 452         librpcsvc       \
 453         librsm          \
 454         librstp         \
 455         libsasl         \
 456         libsec          \
 457         libshell        \
 458         libslp          \
 459         libsmedia       \
 460         libsocket       \
 461         libsqlite       \
 462         libfcoe         \
 463         libsrpt         \
 464         libstmf         \
 465         libstmfproxy    \
 466         libsum          \
 467         libsysevent     \
 468         libtecla        \
 469         libtnf          \
 470         libtnfctl       \
 471         libtnfprobe     \
 472         libtsnet        \
 473         libtsol         \
 474         libvrrpadm      \
 475         libvolmgt       \
 476         libumem         \
 477         libunistat      \
 478         libuutil        \
 479         libwanboot      \
 480         libwanbootutil  \
 481         libwrap         \
 482         libxcurses2     \
 483         libzfs          \
 484         libzfs_core     \
 485         libzfs_jni      \
 486         libzoneinfo     \
 487         libzonestat     \
 488         hal             \
 489         policykit       \
 490         lvm             \
 491         pkcs11          \
 492         passwdutil      \
 493         ../cmd/sendmail/libmilter       \
 494         fm              \
 495         udapl           \
 496         libmapid        \
 497         libkrb5         \
 498         libsmbfs        \
 499         libshare        \
 500         libidmap        \
 501         libvscan        \
 502         libgrubmgmt     \
 503         smbsrv          \
 504         libilb          \
 505         scsi            \
 506         hbaapi          \
 507         smhba           \
 508         libima          \
 509         libsun_ima      \
 510         mpapi           \
 511         libreparse      \
 512         libfsd          \
 513         $($(MACH)_HDRSUBDIRS)
 514 
 515 $(CLOSED_BUILD)HDRSUBDIRS += \
 516         $(CLOSED)/lib/libike
 517 
 518 i386_HDRSUBDIRS=        \
 519         libparted       \
 520         libfdisk        \
 521         libsaveargs
 522 
 523 sparc_HDRSUBDIRS=       \
 524         libds           \
 525         libdscp         \
 526         libpri          \
 527         libv12n         \
 528         storage
 529 
 530 all :=          TARGET= all
 531 check :=        TARGET= check
 532 clean :=        TARGET= clean
 533 clobber :=      TARGET= clobber
 534 install :=      TARGET= install
 535 install_h :=    TARGET= install_h
 536 lint :=         TARGET= lint
 537 _dc :=          TARGET= _dc
 538 _msg :=         TARGET= _msg
 539 
 540 .KEEP_STATE:
 541 
 542 #
 543 # For the all and install targets, we clearly must respect library
 544 # dependencies so that the libraries link correctly.  However, for
 545 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 546 # and _msg), libraries do not have any dependencies on one another
 547 # and thus respecting dependencies just slows down the build.
 548 # As such, for these rules, we use pattern replacement to explicitly
 549 # avoid triggering the dependency information.  Note that for clean,
 550 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 551 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 552 #
 553 
 554 all:                    $(SUBDIRS)
 555 
 556 install:                $(SUBDIRS) .WAIT install_extra
 557 
 558 # extra libraries kept in other source areas
 559 install_extra:
 560         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 561         @pwd
 562 
 563 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 564 
 565 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 566 
 567 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 568 
 569 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 570 
 571 #
 572 # Library interdependencies are called out explicitly here
 573 #
 574 auditd_plugins: libbsm libnsl libsecdb
 575 gss_mechs/mech_krb5:    libgss libnsl libsocket libresolv pkcs11
 576 libadt_jni:     libbsm
 577 libast:         libsocket
 578 libadutils:     libldap5 libresolv libsocket libnsl
 579 nsswitch:       libadutils libidmap
 580 libbe:          libzfs
 581 libbsm:         libtsol
 582 libcmd:         libsum libast libsocket libnsl
 583 libcmdutils:    libavl
 584 libcontract:    libnvpair
 585 libdevid:       libdevinfo
 586 libdevinfo:     libnvpair libsec
 587 libdhcpagent:   libsocket libdhcputil libuuid libdlpi libcontract
 588 libdhcpsvc:     libinetutil
 589 libdhcputil:    libnsl libgen libinetutil libdlpi
 590 libdladm:       libdevinfo libinetutil libsocket libscf librcm libnvpair \
 591                 libexacct libnsl libkstat libcurses
 592 libdll:         libast
 593 libdlpi:        libinetutil libdladm
 594 libds:          libsysevent
 595 libdscfg:       libnsctl libunistat libsocket libnsl
 596 libdtrace:      libproc libgen libctf
 597 libdtrace_jni:  libuutil libdtrace
 598 libefi:         libuuid
 599 libfstyp:       libnvpair
 600 libelfsign:     libcryptoutil libkmf
 601 libidmap:       libadutils libldap5 libavl libsldap libuutil
 602 libipadm:       libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
 603                 libdladm libsecdb
 604 libiscsit:      libc libnvpair libstmf libuuid libnsl
 605 libkmf:         libcryptoutil pkcs11
 606 libnsl:         libmd5
 607 libmapid:       libresolv
 608 librdc:         libsocket libnsl libnsctl libunistat libdscfg
 609 libuuid:        libdlpi
 610 $(CLOSED_BUILD)libike:  libipsecutil libxnet libcryptoutil
 611 libinetutil:    libsocket
 612 libipsecutil:   libtecla libsocket
 613 libinstzones:   libzonecfg libcontract
 614 libpkg:         libwanboot libscf libadm
 615 libnwam:        libscf
 616 libsecdb:       libnsl
 617 libsasl:        libgss libsocket pkcs11 libmd
 618 sasl_plugins:   pkcs11 libgss libsocket libsasl
 619 libsctp:        libsocket
 620 libshell:       libast libcmd libdll libsocket libsecdb
 621 libsip:         libmd5
 622 libsmbfs:       libcmdutils libsocket libnsl libkrb5
 623 libsocket:      libnsl
 624 libstmfproxy:   libstmf libsocket libnsl libpthread
 625 libsum:         libast
 626 libsysevent:    libsecdb
 627 libldap5:       libsasl libsocket libnsl libmd
 628 libsldap:       libldap5 libtsol libnsl libc libscf libresolv
 629 libpool:        libnvpair libexacct
 630 libpp:          libast
 631 libzonecfg:     libc libsocket libnsl libuuid libnvpair libsysevent libsec \
 632                 libbrand libpool libscf
 633 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
 634 libproject:     libpool libproc libsecdb
 635 libtermcap:     libcurses
 636 libtsnet:       libnsl libtsol libsecdb
 637 libwrap:        libnsl libsocket
 638 libwanboot:     libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
 639                 libdhcputil
 640 libwanbootutil: libnsl
 641 pam_modules:    libproject passwdutil smbsrv
 642 libscf:         libuutil libmd libgen libsmbios libnsl
 643 libinetsvc:     libscf
 644 librestart:     libuutil libscf
 645 libsaveargs:    libdisasm
 646 ../cmd/sgs/libdl:       ../cmd/sgs/libconv
 647 ../cmd/sgs/libelf:      ../cmd/sgs/libconv
 648 pkcs11:         libcryptoutil
 649 print:          libldap5
 650 udapl/udapl_tavor:      udapl/libdat
 651 libzfs:         libdevid libgen libnvpair libuutil \
 652                 libadm libavl libefi libidmap libmd libzfs_core
 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
 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 $(INTEL_BUILD)libdiskmgt:libfdisk
 682 
 683 #
 684 # The reason this rule checks for the existence of the
 685 # Makefile is that some of the directories do not exist
 686 # in certain situations (e.g., exportable source builds,
 687 # OpenSolaris).
 688 #
 689 $(SUBDIRS): FRC
 690         @if [ -f $@/Makefile  ]; then \
 691                 cd $@; pwd; $(MAKE) $(TARGET); \
 692         else \
 693                 true; \
 694         fi
 695 
 696 $(SUBDIRS:%=%-nodepend):
 697         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 698                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 699         else \
 700                 true; \
 701         fi
 702 
 703 FRC: