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