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 2014 Garrett D'Amore <garrett@damore.org>
  27 # Copyright 2015 Gary Mills
  28 # Copyright 2015 RackTop Systems.
  29 
  30 include ../Makefile.master
  31 
  32 #       Note that libcurses installs commands along with its library.
  33 #       This is a minor bug which probably should be fixed.
  34 #       Note also that a few extra libraries are kept in cmd source.
  35 #
  36 # Certain libraries are linked with, hence depend on, other libraries.
  37 #
  38 # Although we have historically used .WAIT to express dependencies, it
  39 # reduces the amount of parallelism and thus lengthens the time it
  40 # takes to build the libraries.  Thus, we now require that any new
  41 # libraries explicitly call out their dependencies.  Eventually, all
  42 # the library dependencies will be called out explicitly.  See
  43 # "Library interdependencies" near the end of this file.
  44 #
  45 # Aside from explicit dependencies (and legacy .WAITs), all libraries
  46 # are built in parallel.
  47 #
  48 .PARALLEL:
  49 
  50 SUBDIRS= \
  51         common                  .WAIT   \
  52         ../cmd/sgs/libconv              \
  53         ../cmd/sgs/libdl        .WAIT
  54 
  55 SUBDIRS += \
  56         libc                    .WAIT   \
  57         ../cmd/sgs/libelf       .WAIT   \
  58         c_synonyms                      \
  59         libmd                           \
  60         libmd5                          \
  61         librsm                          \
  62         libmp                   .WAIT   \
  63         libnsl                  \
  64         libsecdb                .WAIT   \
  65         librpcsvc                       \
  66         libsocket               .WAIT   \
  67         libsctp                 \
  68         libsip                  \
  69         libcommputil            \
  70         libresolv                       \
  71         libresolv2              .WAIT   \
  72         libw                    .WAIT   \
  73         libintl                 .WAIT   \
  74         ../cmd/sgs/librtld_db   \
  75         libaio                  \
  76         libast                  \
  77         libdll                  \
  78         libcmd                  \
  79         libshell                \
  80         libsum                  \
  81         librt                   \
  82         libadm                  \
  83         libctf                  \
  84         libdtrace               \
  85         libdtrace_jni           \
  86         libcurses               \
  87         libtermcap              \
  88         libgen                  \
  89         libgss                  \
  90         libpam                  \
  91         libuuid                 \
  92         libthread               \
  93         libpthread      .WAIT   \
  94         libslp          \
  95         libbsdmalloc    \
  96         libdoor         \
  97         libdevinfo      \
  98         libdladm        \
  99         libdlpi         \
 100         libeti          \
 101         libcrypt        \
 102         libdns_sd       \
 103         libefi          \
 104         libfstyp        \
 105         libwanboot      \
 106         libwanbootutil  \
 107         libcryptoutil   \
 108         libinetutil     \
 109         libipadm        \
 110         libipd          \
 111         libipmp         \
 112         libiscsit       \
 113         libkmf          \
 114         libkstat        \
 115         libkvm          \
 116         liblm           \
 117         libmalloc       \
 118         libmapmalloc    \
 119         libmtmalloc     \
 120         libnls          \
 121         libnwam         \
 122         libsmbios       \
 123         libtecla        \
 124         libumem         \
 125         libnvpair       .WAIT   \
 126         libexacct       \
 127         libsasl         \
 128         libldap5        \
 129         libsldap        .WAIT   \
 130         libbsm          \
 131         libsys          \
 132         libsysevent     \
 133         libnisdb        \
 134         libpool         \
 135         libpp           \
 136         libproc         \
 137         libproject      \
 138         libsendfile     \
 139         nametoaddr      \
 140         ncad_addr       \
 141         hbaapi          \
 142         smhba           \
 143         sun_fc          \
 144         sun_sas         \
 145         gss_mechs/mech_krb5     .WAIT   \
 146         libkrb5 .WAIT   \
 147         krb5    .WAIT   \
 148         libsmbfs        \
 149         libfcoe         \
 150         libsrpt         \
 151         libstmf         \
 152         libstmfproxy    \
 153         libnsctl        \
 154         libunistat      \
 155         libdscfg        \
 156         librdc          \
 157         libinstzones    \
 158         libpkg          \
 159         libpcidb        \
 160         libm1           \
 161         libm            \
 162         libmvec
 163 
 164 
 165 SUBDIRS += \
 166         passwdutil      \
 167         pam_modules     \
 168         crypt_modules   \
 169         libadt_jni      \
 170         abi             \
 171         auditd_plugins  \
 172         libvolmgt       \
 173         libdevice       \
 174         libdevid        \
 175         libc_db         \
 176         libndmp         \
 177         libsec          \
 178         libtnfprobe     \
 179         libtnf          \
 180         libtnfctl       \
 181         libdhcpagent    \
 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         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         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         libfdisk        \
 509         libsaveargs
 510 
 511 sparc_HDRSUBDIRS=       \
 512         libds           \
 513         libdscp         \
 514         libpri          \
 515         libv12n         \
 516         storage
 517 
 518 all :=          TARGET= all
 519 check :=        TARGET= check
 520 clean :=        TARGET= clean
 521 clobber :=      TARGET= clobber
 522 install :=      TARGET= install
 523 install_h :=    TARGET= install_h
 524 lint :=         TARGET= lint
 525 _dc :=          TARGET= _dc
 526 _msg :=         TARGET= _msg
 527 
 528 .KEEP_STATE:
 529 
 530 #
 531 # For the all and install targets, we clearly must respect library
 532 # dependencies so that the libraries link correctly.  However, for
 533 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 534 # and _msg), libraries do not have any dependencies on one another
 535 # and thus respecting dependencies just slows down the build.
 536 # As such, for these rules, we use pattern replacement to explicitly
 537 # avoid triggering the dependency information.  Note that for clean,
 538 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 539 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 540 #
 541 
 542 all:                    $(SUBDIRS)
 543 
 544 install:                $(SUBDIRS) .WAIT install_extra
 545 
 546 # extra libraries kept in other source areas
 547 install_extra:
 548         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 549         @pwd
 550 
 551 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 552 
 553 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 554 
 555 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 556 
 557 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 558 
 559 #
 560 # Library interdependencies are called out explicitly here
 561 #
 562 auditd_plugins: libbsm libnsl libsecdb
 563 gss_mechs/mech_krb5:    libgss libnsl libsocket libresolv pkcs11
 564 libadt_jni:     libbsm
 565 libast:         libsocket libm
 566 libadutils:     libldap5 libresolv libsocket libnsl
 567 nsswitch:       libadutils libidmap
 568 libbe:          libzfs
 569 libbsm:         libtsol
 570 libcmd:         libsum libast libsocket libnsl
 571 libcmdutils:    libavl libnvpair
 572 libcontract:    libnvpair
 573 libdevid:       libdevinfo
 574 libdevinfo:     libnvpair libsec
 575 libdhcpagent:   libsocket libdhcputil libuuid libdlpi libcontract
 576 libdhcputil:    libnsl libgen libinetutil libdlpi
 577 libdladm:       libdevinfo libinetutil libsocket libscf librcm libnvpair \
 578                 libexacct libnsl libkstat libcurses libpool
 579 libdll:         libast
 580 libdlpi:        libinetutil libdladm
 581 libds:          libsysevent
 582 libdscfg:       libnsctl libunistat libsocket libnsl
 583 libdtrace:      libproc libgen libctf libmapmalloc
 584 libdtrace_jni:  libuutil libdtrace
 585 libefi:         libuuid
 586 libfstyp:       libnvpair
 587 libelfsign:     libcryptoutil libkmf libmd
 588 libidmap:       libadutils libldap5 libavl libsldap libuutil
 589 libipadm:       libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
 590                 libdladm libsecdb
 591 libiscsit:      libc libnvpair libstmf libuuid libnsl libscf
 592 libkmf:         libcryptoutil pkcs11
 593 libm:           libc
 594 libm1:          libc libm
 595 libmvec:        libc libm
 596 libnsl:         libmd5
 597 libmapid:       libresolv
 598 librdc:         libsocket libnsl libnsctl libunistat libdscfg
 599 libuuid:        libdlpi
 600 libinetutil:    libsocket
 601 libipsecutil:   libtecla libsocket
 602 libinstzones:   libzonecfg libcontract
 603 libpkg:         libwanboot libscf libadm
 604 libnwam:        libbsm libdladm libnsl libnvpair libscf libsecdb libsocket
 605 libsecdb:       libnsl
 606 libsasl:        libgss libsocket pkcs11 libmd
 607 sasl_plugins:   pkcs11 libgss libsocket libsasl
 608 libsctp:        libsocket
 609 libshell:       libast libcmd libdll libsocket libsecdb libm
 610 libsip:         libmd5
 611 libsmbfs:       libcmdutils libsocket libnsl libkrb5
 612 libsocket:      libnsl
 613 libstmfproxy:   libstmf libsocket libnsl libpthread
 614 libsum:         libast
 615 libsysevent:    libsecdb
 616 libldap5:       libsasl libsocket libnsl libmd
 617 libsldap:       libldap5 libtsol libnsl libc libscf libresolv
 618 libpool:        libnvpair libexacct
 619 libpp:          libast
 620 libzonecfg:     libc libsocket libnsl libuuid libnvpair libsysevent libsec \
 621                 libbrand libpool libscf
 622 libzonestat:    libcmdutils libumem
 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
 630 libwanbootutil: libnsl
 631 pam_modules:    libproject passwdutil smbsrv
 632 libscf:         libuutil libmd libgen libsmbios libnsl
 633 libinetsvc:     libscf
 634 librestart:     libuutil libscf libpool
 635 libsaveargs:    libdisasm
 636 ../cmd/sgs/libdl:       ../cmd/sgs/libconv
 637 ../cmd/sgs/libelf:      ../cmd/sgs/libconv
 638 pkcs11:         libcryptoutil
 639 print:          libldap5
 640 udapl/udapl_tavor:      udapl/libdat
 641 libzfs:         libdevid libgen libnvpair libuutil \
 642                 libadm libavl libefi libidmap libmd libzfs_core libm
 643 libzfs_core:    libnvpair
 644 libzfs_jni:     libdiskmgt libnvpair libzfs
 645 libzpool:       libavl libumem libnvpair libcmdutils libsysevent libmd
 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 libfdisk
 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 libipmi:        libm
 672 libprtdiag:     libm
 673 libsqlite:      libm
 674 libstmf:        libm
 675 libvscan:       libm
 676 
 677 
 678 $(INTEL_BUILD)libdiskmgt:libfdisk
 679 
 680 #
 681 # The reason this rule checks for the existence of the
 682 # Makefile is that some of the directories do not exist
 683 # in certain situations (e.g., exportable source builds,
 684 # OpenSolaris).
 685 #
 686 $(SUBDIRS): FRC
 687         @if [ -f $@/Makefile  ]; then \
 688                 cd $@; pwd; $(MAKE) $(TARGET); \
 689         else \
 690                 true; \
 691         fi
 692 
 693 $(SUBDIRS:%=%-nodepend):
 694         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 695                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 696         else \
 697                 true; \
 698         fi
 699 
 700 FRC: