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