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 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
  28 
  29 include ../Makefile.master
  30 
  31 #       Note that libcurses installs commands along with its library.
  32 #       This is a minor bug which probably should be fixed.
  33 #       Note also that a few extra libraries are kept in cmd source.
  34 #
  35 # Certain libraries are linked with, hence depend on, other libraries.
  36 #
  37 # Although we have historically used .WAIT to express dependencies, it
  38 # reduces the amount of parallelism and thus lengthens the time it
  39 # takes to build the libraries.  Thus, we now require that any new
  40 # libraries explicitly call out their dependencies.  Eventually, all
  41 # the library dependencies will be called out explicitly.  See
  42 # "Library interdependencies" near the end of this file.
  43 #
  44 # Aside from explicit dependencies (and legacy .WAITs), all libraries
  45 # are built in parallel.
  46 #
  47 .PARALLEL:
  48 
  49 SUBDIRS= \
  50         common                  .WAIT   \
  51         ../cmd/sgs/libconv              \
  52         ../cmd/sgs/libdl        .WAIT
  53 
  54 SUBDIRS += \
  55         libc                    .WAIT   \
  56         ../cmd/sgs/libelf       .WAIT   \
  57         c_synonyms                      \
  58         libmd                           \
  59         libmd5                          \
  60         librsm                          \
  61         libmp                   .WAIT   \
  62         libnsl                  \
  63         libsecdb                .WAIT   \
  64         librpcsvc                       \
  65         libsocket               .WAIT   \
  66         libsctp                 \
  67         libsip                  \
  68         libcommputil            \
  69         libresolv                       \
  70         libresolv2              .WAIT   \
  71         libw                    .WAIT   \
  72         libintl                 .WAIT   \
  73         ../cmd/sgs/librtld_db   \
  74         libaio                  \
  75         libast                  \
  76         libdll                  \
  77         libcmd                  \
  78         libshell                \
  79         libsum                  \
  80         librt                   \
  81         libadm                  \
  82         libctf                  \
  83         libdtrace               \
  84         libdtrace_jni           \
  85         libcurses               \
  86         libtermcap              \
  87         libgen                  \
  88         libgss                  \
  89         libpam                  \
  90         libuuid                 \
  91         libthread               \
  92         libpthread      .WAIT   \
  93         libslp          \
  94         libbsdmalloc    \
  95         libdoor         \
  96         libdevinfo      \
  97         libdladm        \
  98         libdlpi         \
  99         libeti          \
 100         libcrypt        \
 101         libdns_sd       \
 102         libefi          \
 103         libfstyp        \
 104         libwanboot      \
 105         libwanbootutil  \
 106         libcryptoutil   \
 107         libinetutil     \
 108         libipadm        \
 109         libipd          \
 110         libipmp         \
 111         libiscsit       \
 112         libkmf          \
 113         libkstat        \
 114         libkvm          \
 115         liblm           \
 116         libmalloc       \
 117         libmapmalloc    \
 118         libmtmalloc     \
 119         libnls          \
 120         libnwam         \
 121         libsmbios       \
 122         libtecla        \
 123         libumem         \
 124         libnvpair       .WAIT   \
 125         libexacct       \
 126         libsasl         \
 127         libldap5        \
 128         libsldap        .WAIT   \
 129         libbsm          \
 130         libsys          \
 131         libsysevent     \
 132         libnisdb        \
 133         libpool         \
 134         libpp           \
 135         libproc         \
 136         libproject      \
 137         libsendfile     \
 138         nametoaddr      \
 139         ncad_addr       \
 140         hbaapi          \
 141         smhba           \
 142         sun_fc          \
 143         sun_sas         \
 144         gss_mechs/mech_krb5     .WAIT   \
 145         libkrb5 .WAIT   \
 146         krb5    .WAIT   \
 147         libsmbfs        \
 148         libfcoe         \
 149         libsrpt         \
 150         libstmf         \
 151         libstmfproxy    \
 152         libnsctl        \
 153         libunistat      \
 154         libdscfg        \
 155         librdc          \
 156         libinstzones    \
 157         libpkg          \
 158         libpcidb        \
 159         libm1           \
 160         libm            \
 161         libmvec
 162 
 163 
 164 SUBDIRS += \
 165         passwdutil      \
 166         pam_modules     \
 167         crypt_modules   \
 168         libadt_jni      \
 169         abi             \
 170         auditd_plugins  \
 171         libvolmgt       \
 172         libdevice       \
 173         libdevid        \
 174         libc_db         \
 175         libndmp         \
 176         libsec          \
 177         libtnfprobe     \
 178         libtnf          \
 179         libtnfctl       \
 180         libdhcpagent    \
 181         libdhcputil     \
 182         libxnet         \
 183         libipsecutil    \
 184         nsswitch        \
 185         print           \
 186         libuutil        \
 187         libscf          \
 188         libinetsvc      \
 189         librestart      \
 190         libsched        \
 191         libelfsign      \
 192         pkcs11          .WAIT   \
 193         libpctx         .WAIT   \
 194         libcpc          \
 195         getloginx       \
 196         watchmalloc     \
 197         extendedFILE    \
 198         madv            \
 199         mpss            \
 200         libdisasm       \
 201         libwrap         \
 202         libxcurses      \
 203         libxcurses2     \
 204         libbrand        .WAIT   \
 205         libzonecfg      \
 206         libzoneinfo     \
 207         libzonestat     \
 208         libtsnet        \
 209         libtsol         \
 210         gss_mechs/mech_spnego   \
 211         gss_mechs/mech_dummy    \
 212         gss_mechs/mech_dh       \
 213         rpcsec_gss      \
 214         libraidcfg      .WAIT   \
 215         librcm          .WAIT   \
 216         libcfgadm       .WAIT   \
 217         libpicl         .WAIT   \
 218         libpicltree     .WAIT \
 219         raidcfg_plugins \
 220         cfgadm_plugins  \
 221         libmail         \
 222         lvm             \
 223         libsmedia       \
 224         libipp          \
 225         libdiskmgt      \
 226         liblgrp         \
 227         libfsmgt        \
 228         fm              \
 229         libavl          \
 230         libcmdutils     \
 231         libcontract     \
 232         ../cmd/sendmail/libmilter       \
 233         sasl_plugins    \
 234         udapl           \
 235         libzpool        \
 236         libzfs_core     \
 237         libzfs          \
 238         libbe           \
 239         pylibbe         \
 240         libzfs_jni      \
 241         pyzfs           \
 242         pysolaris       \
 243         libmapid        \
 244         brand           \
 245         policykit       \
 246         hal             \
 247         libshare        \
 248         libsqlite       \
 249         libidmap        \
 250         libadutils      \
 251         libipmi         \
 252         libexacct/demo  \
 253         libvrrpadm      \
 254         libvscan        \
 255         libgrubmgmt     \
 256         smbsrv          \
 257         libilb          \
 258         scsi            \
 259         libima          \
 260         libsun_ima      \
 261         mpapi           \
 262         librstp         \
 263         libreparse      \
 264         libhotplug      \
 265         libfruutils     .WAIT   \
 266         libfru          \
 267         $($(MACH)_SUBDIRS)
 268 
 269 i386_SUBDIRS=           \
 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         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         libdhcputil     \
 399         libdisasm       \
 400         libdns_sd       \
 401         libdscfg        \
 402         libdtrace       \
 403         libdtrace_jni   \
 404         libelfsign      \
 405         libeti          \
 406         libfru          \
 407         libfstyp        \
 408         libgen          \
 409         libipadm        \
 410         libipd          \
 411         libipsecutil    \
 412         libinetsvc      \
 413         libinetutil     \
 414         libinstzones    \
 415         libipmi         \
 416         libipmp         \
 417         libipp          \
 418         libiscsit       \
 419         libkstat        \
 420         libkvm          \
 421         libmail         \
 422         libmd           \
 423         libmtmalloc     \
 424         libndmp         \
 425         libnvpair       \
 426         libnsctl        \
 427         libnsl          \
 428         libnwam         \
 429         libpam          \
 430         libpcidb        \
 431         libpctx         \
 432         libpicl         \
 433         libpicltree     \
 434         libpool         \
 435         libpp           \
 436         libproc         \
 437         libraidcfg      \
 438         librcm          \
 439         librdc          \
 440         libscf          \
 441         libsip          \
 442         libsmbios       \
 443         librestart      \
 444         librpcsvc       \
 445         librsm          \
 446         librstp         \
 447         libsasl         \
 448         libsec          \
 449         libshell        \
 450         libslp          \
 451         libsmedia       \
 452         libsocket       \
 453         libsqlite       \
 454         libfcoe         \
 455         libsrpt         \
 456         libstmf         \
 457         libstmfproxy    \
 458         libsum          \
 459         libsysevent     \
 460         libtecla        \
 461         libtnf          \
 462         libtnfctl       \
 463         libtnfprobe     \
 464         libtsnet        \
 465         libtsol         \
 466         libvrrpadm      \
 467         libvolmgt       \
 468         libumem         \
 469         libunistat      \
 470         libuutil        \
 471         libwanboot      \
 472         libwanbootutil  \
 473         libwrap         \
 474         libxcurses2     \
 475         libzfs          \
 476         libzfs_core     \
 477         libzfs_jni      \
 478         libzoneinfo     \
 479         libzonestat     \
 480         hal             \
 481         policykit       \
 482         lvm             \
 483         pkcs11          \
 484         passwdutil      \
 485         ../cmd/sendmail/libmilter       \
 486         fm              \
 487         udapl           \
 488         libmapid        \
 489         libkrb5         \
 490         libsmbfs        \
 491         libshare        \
 492         libidmap        \
 493         libvscan        \
 494         libgrubmgmt     \
 495         smbsrv          \
 496         libilb          \
 497         scsi            \
 498         hbaapi          \
 499         smhba           \
 500         libima          \
 501         libsun_ima      \
 502         mpapi           \
 503         libreparse      \
 504         $($(MACH)_HDRSUBDIRS)
 505 
 506 i386_HDRSUBDIRS=        \
 507         libfdisk        \
 508         libsaveargs
 509 
 510 sparc_HDRSUBDIRS=       \
 511         libds           \
 512         libdscp         \
 513         libpri          \
 514         libv12n         \
 515         storage
 516 
 517 all :=          TARGET= all
 518 check :=        TARGET= check
 519 clean :=        TARGET= clean
 520 clobber :=      TARGET= clobber
 521 install :=      TARGET= install
 522 install_h :=    TARGET= install_h
 523 lint :=         TARGET= lint
 524 _dc :=          TARGET= _dc
 525 _msg :=         TARGET= _msg
 526 
 527 .KEEP_STATE:
 528 
 529 #
 530 # For the all and install targets, we clearly must respect library
 531 # dependencies so that the libraries link correctly.  However, for
 532 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 533 # and _msg), libraries do not have any dependencies on one another
 534 # and thus respecting dependencies just slows down the build.
 535 # As such, for these rules, we use pattern replacement to explicitly
 536 # avoid triggering the dependency information.  Note that for clean,
 537 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 538 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 539 #
 540 
 541 all:                    $(SUBDIRS)
 542 
 543 install:                $(SUBDIRS) .WAIT install_extra
 544 
 545 # extra libraries kept in other source areas
 546 install_extra:
 547         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 548         @pwd
 549 
 550 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 551 
 552 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 553 
 554 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 555 
 556 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 557 
 558 #
 559 # Library interdependencies are called out explicitly here
 560 #
 561 auditd_plugins: libbsm libnsl libsecdb
 562 gss_mechs/mech_krb5:    libgss libnsl libsocket libresolv pkcs11
 563 libadt_jni:     libbsm
 564 libast:         libsocket libm
 565 libadutils:     libldap5 libresolv libsocket libnsl
 566 nsswitch:       libadutils libidmap
 567 libbe:          libzfs
 568 libbsm:         libtsol
 569 libcmd:         libsum libast libsocket libnsl
 570 libcmdutils:    libavl
 571 libcontract:    libnvpair
 572 libdevid:       libdevinfo
 573 libdevinfo:     libnvpair libsec
 574 libdhcpagent:   libsocket libdhcputil libuuid libdlpi libcontract
 575 libdhcputil:    libnsl libgen libinetutil libdlpi
 576 libdladm:       libdevinfo libinetutil libsocket libscf librcm libnvpair \
 577                 libexacct libnsl libkstat libcurses
 578 libdll:         libast
 579 libdlpi:        libinetutil libdladm
 580 libds:          libsysevent
 581 libdscfg:       libnsctl libunistat libsocket libnsl
 582 libdtrace:      libproc libgen libctf
 583 libdtrace_jni:  libuutil libdtrace
 584 libefi:         libuuid
 585 libfstyp:       libnvpair
 586 libelfsign:     libcryptoutil libkmf
 587 libidmap:       libadutils libldap5 libavl libsldap libuutil
 588 libipadm:       libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
 589                 libdladm libsecdb
 590 libiscsit:      libc libnvpair libstmf libuuid libnsl
 591 libkmf:         libcryptoutil pkcs11
 592 libm:           libc
 593 libm1:          libc libm
 594 libmvec:        libc libm
 595 libnsl:         libmd5
 596 libmapid:       libresolv
 597 librdc:         libsocket libnsl libnsctl libunistat libdscfg
 598 libuuid:        libdlpi
 599 libinetutil:    libsocket
 600 libipsecutil:   libtecla libsocket
 601 libinstzones:   libzonecfg libcontract
 602 libpkg:         libwanboot libscf libadm
 603 libnwam:        libscf
 604 libsecdb:       libnsl
 605 libsasl:        libgss libsocket pkcs11 libmd
 606 sasl_plugins:   pkcs11 libgss libsocket libsasl
 607 libsctp:        libsocket
 608 libshell:       libast libcmd libdll libsocket libsecdb libm
 609 libsip:         libmd5
 610 libsmbfs:       libcmdutils libsocket libnsl libkrb5
 611 libsocket:      libnsl
 612 libstmfproxy:   libstmf libsocket libnsl libpthread
 613 libsum:         libast
 614 libsysevent:    libsecdb
 615 libldap5:       libsasl libsocket libnsl libmd
 616 libsldap:       libldap5 libtsol libnsl libc libscf libresolv
 617 libpool:        libnvpair libexacct
 618 libpp:          libast
 619 libzonecfg:     libc libsocket libnsl libuuid libnvpair libsysevent libsec \
 620                 libbrand libpool libscf
 621 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
 622 libproject:     libpool libproc libsecdb
 623 libtermcap:     libcurses
 624 libtsnet:       libnsl libtsol libsecdb
 625 libwrap:        libnsl libsocket
 626 libwanboot:     libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
 627                 libdhcputil
 628 libwanbootutil: libnsl
 629 pam_modules:    libproject passwdutil smbsrv
 630 libscf:         libuutil libmd libgen libsmbios libnsl
 631 libinetsvc:     libscf
 632 librestart:     libuutil libscf
 633 libsaveargs:    libdisasm
 634 ../cmd/sgs/libdl:       ../cmd/sgs/libconv
 635 ../cmd/sgs/libelf:      ../cmd/sgs/libconv
 636 pkcs11:         libcryptoutil
 637 print:          libldap5
 638 udapl/udapl_tavor:      udapl/libdat
 639 libzfs:         libdevid libgen libnvpair libuutil \
 640                 libadm libavl libefi libidmap libmd libzfs_core libm
 641 libzfs_core:    libnvpair
 642 libzfs_jni:     libdiskmgt libnvpair libzfs
 643 libzpool:       libavl libumem libnvpair libcmdutils
 644 libsec:         libavl libidmap
 645 brand:          libc libsocket
 646 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 647 libexacct/demo: libexacct libproject libsocket libnsl
 648 libtsalarm:     libpcp
 649 smbsrv:         libsocket libnsl libmd libxnet libpthread librt \
 650                 libshare libidmap pkcs11 libsqlite libcryptoutil \
 651                 libreparse libcmdutils
 652 libv12n:        libds libuuid
 653 libvrrpadm:     libsocket libdladm libscf
 654 libvscan:       libscf
 655 libfru:         libfruutils
 656 scsi:           libnvpair libfru
 657 mpapi:          libpthread libdevinfo libsysevent libnvpair
 658 sun_fc:         libdevinfo libsysevent libnvpair
 659 libsun_ima:     libdevinfo libsysevent libnsl
 660 sun_sas:        libdevinfo libsysevent libnvpair libkstat libdevid
 661 libgrubmgmt:    libdevinfo libzfs libfstyp
 662 pylibbe:        libbe libzfs
 663 pyzfs:          libnvpair libzfs
 664 pysolaris:      libsec libidmap
 665 libreparse:     libnvpair
 666 libhotplug:     libnvpair
 667 cfgadm_plugins: libhotplug
 668 libilb:         libsocket
 669 libipmi:        libm
 670 libprtdiag:     libm
 671 libsqlite:      libm
 672 libstmf:        libm
 673 libvscan:       libm
 674 
 675 
 676 $(INTEL_BUILD)libdiskmgt:libfdisk
 677 
 678 #
 679 # The reason this rule checks for the existence of the
 680 # Makefile is that some of the directories do not exist
 681 # in certain situations (e.g., exportable source builds,
 682 # OpenSolaris).
 683 #
 684 $(SUBDIRS): FRC
 685         @if [ -f $@/Makefile  ]; then \
 686                 cd $@; pwd; $(MAKE) $(TARGET); \
 687         else \
 688                 true; \
 689         fi
 690 
 691 $(SUBDIRS:%=%-nodepend):
 692         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 693                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 694         else \
 695                 true; \
 696         fi
 697 
 698 FRC: