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