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