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