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