1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 # Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright (c) 2012 by Delphix. All rights reserved.
  25 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
  26 # Copyright (c) 2013 Gary Mills
  27 
  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 SUBDIRS= \
  49         common                  .WAIT   \
  50         ../cmd/sgs/libconv              \
  51         ../cmd/sgs/libdl        .WAIT
  52 
  53 SUBDIRS += \
  54         libc                    .WAIT   \
  55         ../cmd/sgs/libelf       .WAIT   \
  56         c_synonyms                      \
  57         libmd                           \
  58         libmd5                          \
  59         librsm                          \
  60         libmp                   .WAIT   \
  61         libnsl                  \
  62         libsecdb                .WAIT   \
  63         librpcsvc                       \
  64         libsocket               .WAIT   \
  65         libsctp                 \
  66         libsip                  \
  67         libcommputil            \
  68         libresolv                       \
  69         libresolv2              .WAIT   \
  70         libw                    .WAIT   \
  71         libintl                 .WAIT   \
  72         ../cmd/sgs/librtld_db   \
  73         libaio                  \
  74         libast                  \
  75         libdll                  \
  76         libcmd                  \
  77         libshell                \
  78         libsum                  \
  79         librt                   \
  80         libadm                  \
  81         libctf                  \
  82         libdtrace               \
  83         libdtrace_jni           \
  84         libcurses               \
  85         libtermcap              \
  86         libgen                  \
  87         libgss                  \
  88         libpam                  \
  89         libuuid                 \
  90         libthread               \
  91         libpthread      .WAIT   \
  92         libslp          \
  93         libbsdmalloc    \
  94         libdoor         \
  95         libdevinfo      \
  96         libdladm        \
  97         libdlpi         \
  98         libeti          \
  99         libcrypt        \
 100         libdns_sd       \
 101         libefi          \
 102         libfstyp        \
 103         libwanboot      \
 104         libwanbootutil  \
 105         libcryptoutil   \
 106         libinetutil     \
 107         libipadm        \
 108         libipd          \
 109         libipmp         \
 110         libiscsit       \
 111         libkmf          \
 112         libkstat        \
 113         libkvm          \
 114         liblm           \
 115         libmalloc       \
 116         libmapmalloc    \
 117         libmtmalloc     \
 118         libnls          \
 119         libnwam         \
 120         libsmbios       \
 121         libtecla        \
 122         libumem         \
 123         libnvpair       .WAIT   \
 124         libexacct       \
 125         libsasl         \
 126         libldap5        \
 127         libsldap        .WAIT   \
 128         libbsm          \
 129         libsys          \
 130         libsysevent     \
 131         libnisdb        \
 132         libpool         \
 133         libpp           \
 134         libproc         \
 135         libproject      \
 136         libsendfile     \
 137         nametoaddr      \
 138         ncad_addr       \
 139         hbaapi          \
 140         smhba           \
 141         sun_fc          \
 142         sun_sas         \
 143         gss_mechs/mech_krb5     .WAIT   \
 144         libkrb5 .WAIT   \
 145         krb5    .WAIT   \
 146         libsmbfs        \
 147         libfcoe         \
 148         libsrpt         \
 149         libstmf         \
 150         libstmfproxy    \
 151         libnsctl        \
 152         libunistat      \
 153         libdscfg        \
 154         librdc          \
 155         libinstzones    \
 156         libpkg          \
 157         libpcidb        \
 158         libm1           \
 159         libm            \
 160         libmvec
 161 
 162 
 163 SUBDIRS += \
 164         passwdutil      \
 165         pam_modules     \
 166         crypt_modules   \
 167         libadt_jni      \
 168         abi             \
 169         auditd_plugins  \
 170         libvolmgt       \
 171         libdevice       \
 172         libdevid        \
 173         libdhcpsvc      \
 174         libc_db         \
 175         libndmp         \
 176         libsec          \
 177         libtnfprobe     \
 178         libtnf          \
 179         libtnfctl       \
 180         libdhcpagent    \
 181         libdhcpdu       \
 182         libdhcputil     \
 183         libxnet         \
 184         libipsecutil    \
 185         nsswitch        \
 186         print           \
 187         libuutil        \
 188         libscf          \
 189         libinetsvc      \
 190         librestart      \
 191         libsched        \
 192         libelfsign      \
 193         pkcs11          .WAIT   \
 194         libpctx         .WAIT   \
 195         libcpc          \
 196         getloginx       \
 197         watchmalloc     \
 198         extendedFILE    \
 199         madv            \
 200         mpss            \
 201         libdisasm       \
 202         libwrap         \
 203         libxcurses      \
 204         libxcurses2     \
 205         libbrand        .WAIT   \
 206         libzonecfg      \
 207         libzoneinfo     \
 208         libzonestat     \
 209         libtsnet        \
 210         libtsol         \
 211         gss_mechs/mech_spnego   \
 212         gss_mechs/mech_dummy    \
 213         gss_mechs/mech_dh       \
 214         rpcsec_gss      \
 215         libraidcfg      .WAIT   \
 216         librcm          .WAIT   \
 217         libcfgadm       .WAIT   \
 218         libpicl         .WAIT   \
 219         libpicltree     .WAIT \
 220         raidcfg_plugins \
 221         cfgadm_plugins  \
 222         libmail         \
 223         lvm             \
 224         libsmedia       \
 225         libipp          \
 226         libdiskmgt      \
 227         liblgrp         \
 228         libfsmgt        \
 229         fm              \
 230         libavl          \
 231         libcmdutils     \
 232         libcontract     \
 233         ../cmd/sendmail/libmilter       \
 234         sasl_plugins    \
 235         udapl           \
 236         libzpool        \
 237         libzfs_core     \
 238         libzfs          \
 239         libbe           \
 240         pylibbe         \
 241         libzfs_jni      \
 242         pyzfs           \
 243         pysolaris       \
 244         libmapid        \
 245         brand           \
 246         policykit       \
 247         hal             \
 248         libshare        \
 249         libsqlite       \
 250         libidmap        \
 251         libadutils      \
 252         libipmi         \
 253         libexacct/demo  \
 254         libvrrpadm      \
 255         libvscan        \
 256         libgrubmgmt     \
 257         smbsrv          \
 258         libilb          \
 259         scsi            \
 260         libima          \
 261         libsun_ima      \
 262         mpapi           \
 263         librstp         \
 264         libreparse      \
 265         libhotplug      \
 266         libfruutils     .WAIT   \
 267         libfru          \
 268         $($(MACH)_SUBDIRS)
 269 
 270 i386_SUBDIRS=           \
 271         libfdisk        \
 272         libsaveargs
 273 
 274 sparc_SUBDIRS= .WAIT    \
 275         efcode          \
 276         libds           \
 277         libdscp         \
 278         libprtdiag      .WAIT   \
 279         libprtdiag_psr  \
 280         libpri          \
 281         librsc          \
 282         storage         \
 283         libpcp          \
 284         libtsalarm      \
 285         libv12n
 286 
 287 FM_sparc_DEPLIBS= libpri
 288 
 289 fm:                     \
 290         libexacct       \
 291         libipmi         \
 292         libzfs          \
 293         scsi            \
 294         $(FM_$(MACH)_DEPLIBS)
 295 
 296 #
 297 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
 298 # clean and clobber targets (for more information, see those targets, below).
 299 #
 300 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 301 
 302 DCSUBDIRS =             \
 303         lvm
 304 
 305 MSGSUBDIRS=             \
 306         abi             \
 307         auditd_plugins  \
 308         brand           \
 309         cfgadm_plugins  \
 310         gss_mechs/mech_dh       \
 311         gss_mechs/mech_krb5     \
 312         krb5            \
 313         libast          \
 314         libbsm          \
 315         libc            \
 316         libcfgadm       \
 317         libcmd          \
 318         libcontract     \
 319         libcurses       \
 320         libdhcpsvc      \
 321         libdhcputil     \
 322         libipsecutil    \
 323         libdiskmgt      \
 324         libdladm        \
 325         libdll          \
 326         libgrubmgmt     \
 327         libgss          \
 328         libidmap        \
 329         libipmp         \
 330         libilb          \
 331         libinetutil     \
 332         libinstzones    \
 333         libipadm        \
 334         libnsl          \
 335         libnwam         \
 336         libpam          \
 337         libpicl         \
 338         libpool         \
 339         libpkg          \
 340         libpp           \
 341         libscf          \
 342         libsasl         \
 343         libldap5        \
 344         libsecdb        \
 345         libshare        \
 346         libshell        \
 347         libsldap        \
 348         libslp          \
 349         libsmbfs        \
 350         libsmedia       \
 351         libsum          \
 352         libtsol         \
 353         libuutil        \
 354         libvrrpadm      \
 355         libvscan        \
 356         libwanboot      \
 357         libwanbootutil  \
 358         libzfs          \
 359         libzonecfg      \
 360         lvm             \
 361         madv            \
 362         mpss            \
 363         pam_modules     \
 364         pyzfs           \
 365         pysolaris       \
 366         rpcsec_gss      \
 367         libreparse
 368 MSGSUBDIRS += \
 369         $($(MACH)_MSGSUBDIRS)
 370 
 371 sparc_MSGSUBDIRS=       \
 372         libprtdiag      \
 373         libprtdiag_psr
 374 
 375 i386_MSGSUBDIRS= libfdisk
 376 
 377 HDRSUBDIRS=             \
 378         auditd_plugins  \
 379         libast          \
 380         libbrand        \
 381         libbsm          \
 382         libc            \
 383         libcmd          \
 384         libcmdutils     \
 385         libcommputil    \
 386         libcontract     \
 387         libcpc          \
 388         libctf          \
 389         libcurses       \
 390         libtermcap      \
 391         libcryptoutil   \
 392         libdevice       \
 393         libdevid        \
 394         libdevinfo      \
 395         libdiskmgt      \
 396         libdladm        \
 397         libdll          \
 398         libdlpi         \
 399         libdhcpagent    \
 400         libdhcpsvc      \
 401         libdhcputil     \
 402         libdisasm       \
 403         libdns_sd       \
 404         libdscfg        \
 405         libdtrace       \
 406         libdtrace_jni   \
 407         libelfsign      \
 408         libeti          \
 409         libfru          \
 410         libfstyp        \
 411         libgen          \
 412         libipadm        \
 413         libipd          \
 414         libipsecutil    \
 415         libinetsvc      \
 416         libinetutil     \
 417         libinstzones    \
 418         libipmi         \
 419         libipmp         \
 420         libipp          \
 421         libiscsit       \
 422         libkstat        \
 423         libkvm          \
 424         libmail         \
 425         libmd           \
 426         libmtmalloc     \
 427         libndmp         \
 428         libnvpair       \
 429         libnsctl        \
 430         libnsl          \
 431         libnwam         \
 432         libpam          \
 433         libpcidb        \
 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 i386_HDRSUBDIRS=        \
 510         libfdisk        \
 511         libsaveargs
 512 
 513 sparc_HDRSUBDIRS=       \
 514         libds           \
 515         libdscp         \
 516         libpri          \
 517         libv12n         \
 518         storage
 519 
 520 all :=          TARGET= all
 521 check :=        TARGET= check
 522 clean :=        TARGET= clean
 523 clobber :=      TARGET= clobber
 524 install :=      TARGET= install
 525 install_h :=    TARGET= install_h
 526 lint :=         TARGET= lint
 527 _dc :=          TARGET= _dc
 528 _msg :=         TARGET= _msg
 529 
 530 .KEEP_STATE:
 531 
 532 #
 533 # For the all and install targets, we clearly must respect library
 534 # dependencies so that the libraries link correctly.  However, for
 535 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 536 # and _msg), libraries do not have any dependencies on one another
 537 # and thus respecting dependencies just slows down the build.
 538 # As such, for these rules, we use pattern replacement to explicitly
 539 # avoid triggering the dependency information.  Note that for clean,
 540 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 541 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 542 #
 543 
 544 all:                    $(SUBDIRS)
 545 
 546 install:                $(SUBDIRS) .WAIT install_extra
 547 
 548 # extra libraries kept in other source areas
 549 install_extra:
 550         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 551         @pwd
 552 
 553 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 554 
 555 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 556 
 557 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 558 
 559 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 560 
 561 #
 562 # Library interdependencies are called out explicitly here
 563 #
 564 auditd_plugins: libbsm libnsl libsecdb
 565 gss_mechs/mech_krb5:    libgss libnsl libsocket libresolv pkcs11
 566 libadt_jni:     libbsm
 567 libast:         libsocket libm
 568 libadutils:     libldap5 libresolv libsocket libnsl
 569 nsswitch:       libadutils libidmap
 570 libbe:          libzfs
 571 libbsm:         libtsol
 572 libcmd:         libsum libast libsocket libnsl
 573 libcmdutils:    libavl
 574 libcontract:    libnvpair
 575 libdevid:       libdevinfo
 576 libdevinfo:     libnvpair libsec
 577 libdhcpagent:   libsocket libdhcputil libuuid libdlpi libcontract
 578 libdhcpsvc:     libinetutil
 579 libdhcputil:    libnsl libgen libinetutil libdlpi
 580 libdladm:       libdevinfo libinetutil libsocket libscf librcm libnvpair \
 581                 libexacct libnsl libkstat libcurses
 582 libdll:         libast
 583 libdlpi:        libinetutil libdladm
 584 libds:          libsysevent
 585 libdscfg:       libnsctl libunistat libsocket libnsl
 586 libdtrace:      libproc libgen libctf
 587 libdtrace_jni:  libuutil libdtrace
 588 libefi:         libuuid
 589 libfstyp:       libnvpair
 590 libelfsign:     libcryptoutil libkmf
 591 libidmap:       libadutils libldap5 libavl libsldap libuutil
 592 libipadm:       libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
 593                 libdladm libsecdb
 594 libiscsit:      libc libnvpair libstmf libuuid libnsl
 595 libkmf:         libcryptoutil pkcs11
 596 libm:           libc
 597 libm1:          libc libm
 598 libmvec:        libc libm
 599 libnsl:         libmd5
 600 libmapid:       libresolv
 601 librdc:         libsocket libnsl libnsctl libunistat libdscfg
 602 libuuid:        libdlpi
 603 libinetutil:    libsocket
 604 libipsecutil:   libtecla libsocket
 605 libinstzones:   libzonecfg libcontract
 606 libpkg:         libwanboot libscf libadm
 607 libnwam:        libscf
 608 libsecdb:       libnsl
 609 libsasl:        libgss libsocket pkcs11 libmd
 610 sasl_plugins:   pkcs11 libgss libsocket libsasl
 611 libsctp:        libsocket
 612 libshell:       libast libcmd libdll libsocket libsecdb libm
 613 libsip:         libmd5
 614 libsmbfs:       libcmdutils libsocket libnsl libkrb5
 615 libsocket:      libnsl
 616 libstmfproxy:   libstmf libsocket libnsl libpthread
 617 libsum:         libast
 618 libsysevent:    libsecdb
 619 libldap5:       libsasl libsocket libnsl libmd
 620 libsldap:       libldap5 libtsol libnsl libc libscf libresolv
 621 libpool:        libnvpair libexacct
 622 libpp:          libast
 623 libzonecfg:     libc libsocket libnsl libuuid libnvpair libsysevent libsec \
 624                 libbrand libpool libscf
 625 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
 626 libproject:     libpool libproc libsecdb
 627 libtermcap:     libcurses
 628 libtsnet:       libnsl libtsol libsecdb
 629 libwrap:        libnsl libsocket
 630 libwanboot:     libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
 631                 libdhcputil
 632 libwanbootutil: libnsl
 633 pam_modules:    libproject passwdutil smbsrv
 634 libscf:         libuutil libmd libgen libsmbios libnsl
 635 libinetsvc:     libscf
 636 librestart:     libuutil libscf
 637 libsaveargs:    libdisasm
 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 libm
 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 libipmi:        libm
 674 libprtdiag:     libm
 675 libsqlite:      libm
 676 libstmf:        libm
 677 libvscan:       libm
 678 
 679 
 680 $(INTEL_BUILD)libdiskmgt:libfdisk
 681 
 682 #
 683 # The reason this rule checks for the existence of the
 684 # Makefile is that some of the directories do not exist
 685 # in certain situations (e.g., exportable source builds,
 686 # OpenSolaris).
 687 #
 688 $(SUBDIRS): FRC
 689         @if [ -f $@/Makefile  ]; then \
 690                 cd $@; pwd; $(MAKE) $(TARGET); \
 691         else \
 692                 true; \
 693         fi
 694 
 695 $(SUBDIRS:%=%-nodepend):
 696         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 697                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 698         else \
 699                 true; \
 700         fi
 701 
 702 FRC: