1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 # Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright (c) 2012 by Delphix. All rights reserved.
  25 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
  26 # Copyright (c) 2013 Gary Mills
  27 
  28 include ../Makefile.master
  29 
  30 #       Note that libcurses installs commands along with its library.
  31 #       This is a minor bug which probably should be fixed.
  32 #       Note also that a few extra libraries are kept in cmd source.
  33 #
  34 # Certain libraries are linked with, hence depend on, other libraries.
  35 #
  36 # Although we have historically used .WAIT to express dependencies, it
  37 # reduces the amount of parallelism and thus lengthens the time it
  38 # takes to build the libraries.  Thus, we now require that any new
  39 # libraries explicitly call out their dependencies.  Eventually, all
  40 # the library dependencies will be called out explicitly.  See
  41 # "Library interdependencies" near the end of this file.
  42 #
  43 # Aside from explicit dependencies (and legacy .WAITs), all libraries
  44 # are built in parallel.
  45 #
  46 .PARALLEL:
  47 
  48 SUBDIRS= \
  49         common                  .WAIT   \
  50         ../cmd/sgs/libconv              \
  51         ../cmd/sgs/libdl        .WAIT
  52 
  53 SUBDIRS += \
  54         libc                    .WAIT   \
  55         ../cmd/sgs/libelf       .WAIT   \
  56         c_synonyms                      \
  57         libmd                           \
  58         libmd5                          \
  59         librsm                          \
  60         libmp                   .WAIT   \
  61         libnsl                  \
  62         libsecdb                .WAIT   \
  63         librpcsvc                       \
  64         libsocket               .WAIT   \
  65         libsctp                 \
  66         libsip                  \
  67         libcommputil            \
  68         libresolv                       \
  69         libresolv2              .WAIT   \
  70         libw                    .WAIT   \
  71         libintl                 .WAIT   \
  72         ../cmd/sgs/librtld_db   \
  73         libaio                  \
  74         libast                  \
  75         libdll                  \
  76         libcmd                  \
  77         libshell                \
  78         libsum                  \
  79         librt                   \
  80         libadm                  \
  81         libctf                  \
  82         libdtrace               \
  83         libdtrace_jni           \
  84         libcurses               \
  85         libtermcap              \
  86         libgen                  \
  87         libgss                  \
  88         libpam                  \
  89         libuuid                 \
  90         libthread               \
  91         libpthread      .WAIT   \
  92         libslp          \
  93         libbsdmalloc    \
  94         libdoor         \
  95         libdevinfo      \
  96         libdladm        \
  97         libdlpi         \
  98         libeti          \
  99         libcrypt        \
 100         libdns_sd       \
 101         libefi          \
 102         libfstyp        \
 103         libwanboot      \
 104         libwanbootutil  \
 105         libcryptoutil   \
 106         libinetutil     \
 107         libipadm        \
 108         libipmp         \
 109         libiscsit       \
 110         libkmf          \
 111         libkstat        \
 112         libkvm          \
 113         liblm           \
 114         libmalloc       \
 115         libmapmalloc    \
 116         libmtmalloc     \
 117         libnls          \
 118         libnwam         \
 119         libsmbios       \
 120         libtecla        \
 121         libumem         \
 122         libnvpair       .WAIT   \
 123         libexacct       \
 124         libsasl         \
 125         libldap5        \
 126         libsldap        .WAIT   \
 127         libbsm          \
 128         libsys          \
 129         libsysevent     \
 130         libnisdb        \
 131         libpool         \
 132         libpp           \
 133         libproc         \
 134         libproject      \
 135         libsendfile     \
 136         nametoaddr      \
 137         ncad_addr       \
 138         hbaapi          \
 139         smhba           \
 140         sun_fc          \
 141         sun_sas         \
 142         gss_mechs/mech_krb5     .WAIT   \
 143         libkrb5 .WAIT   \
 144         krb5    .WAIT   \
 145         libsmbfs        \
 146         libfcoe         \
 147         libsrpt         \
 148         libstmf         \
 149         libstmfproxy    \
 150         libnsctl        \
 151         libunistat      \
 152         libdscfg        \
 153         librdc          \
 154         libinstzones    \
 155         libpkg          \
 156         libpcidb
 157 
 158 SUBDIRS += \
 159         passwdutil      \
 160         pam_modules     \
 161         crypt_modules   \
 162         libadt_jni      \
 163         abi             \
 164         auditd_plugins  \
 165         libvolmgt       \
 166         libdevice       \
 167         libdevid        \
 168         libdhcpsvc      \
 169         libc_db         \
 170         libndmp         \
 171         libsec          \
 172         libtnfprobe     \
 173         libtnf          \
 174         libtnfctl       \
 175         libdhcpagent    \
 176         libdhcpdu       \
 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         libntfs         \
 267         libparted       \
 268         libfdisk        \
 269         libsaveargs
 270 
 271 sparc_SUBDIRS= .WAIT    \
 272         efcode          \
 273         libds           \
 274         libdscp         \
 275         libprtdiag      .WAIT   \
 276         libprtdiag_psr  \
 277         libpri          \
 278         librsc          \
 279         storage         \
 280         libpcp          \
 281         libtsalarm      \
 282         libv12n
 283 
 284 FM_sparc_DEPLIBS= libpri
 285 
 286 fm:                     \
 287         libexacct       \
 288         libipmi         \
 289         libzfs          \
 290         scsi            \
 291         $(FM_$(MACH)_DEPLIBS)
 292 
 293 #
 294 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
 295 # clean and clobber targets (for more information, see those targets, below).
 296 #
 297 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 298 
 299 DCSUBDIRS =             \
 300         lvm
 301 
 302 MSGSUBDIRS=             \
 303         abi             \
 304         auditd_plugins  \
 305         brand           \
 306         cfgadm_plugins  \
 307         gss_mechs/mech_dh       \
 308         gss_mechs/mech_krb5     \
 309         krb5            \
 310         libast          \
 311         libbsm          \
 312         libc            \
 313         libcfgadm       \
 314         libcmd          \
 315         libcontract     \
 316         libcurses       \
 317         libdhcpsvc      \
 318         libdhcputil     \
 319         libipsecutil    \
 320         libdiskmgt      \
 321         libdladm        \
 322         libdll          \
 323         libgrubmgmt     \
 324         libgss          \
 325         libidmap        \
 326         libipmp         \
 327         libilb          \
 328         libinetutil     \
 329         libinstzones    \
 330         libipadm        \
 331         libnsl          \
 332         libnwam         \
 333         libpam          \
 334         libpicl         \
 335         libpool         \
 336         libpkg          \
 337         libpp           \
 338         libscf          \
 339         libsasl         \
 340         libldap5        \
 341         libsecdb        \
 342         libshare        \
 343         libshell        \
 344         libsldap        \
 345         libslp          \
 346         libsmbfs        \
 347         libsmedia       \
 348         libsum          \
 349         libtsol         \
 350         libuutil        \
 351         libvrrpadm      \
 352         libvscan        \
 353         libwanboot      \
 354         libwanbootutil  \
 355         libzfs          \
 356         libzonecfg      \
 357         lvm             \
 358         madv            \
 359         mpss            \
 360         pam_modules     \
 361         pyzfs           \
 362         pysolaris       \
 363         rpcsec_gss      \
 364         libreparse
 365 MSGSUBDIRS += \
 366         $($(MACH)_MSGSUBDIRS)
 367 
 368 sparc_MSGSUBDIRS=       \
 369         libprtdiag      \
 370         libprtdiag_psr
 371 
 372 i386_MSGSUBDIRS= libfdisk
 373 
 374 HDRSUBDIRS=             \
 375         auditd_plugins  \
 376         libast          \
 377         libbrand        \
 378         libbsm          \
 379         libc            \
 380         libcmd          \
 381         libcmdutils     \
 382         libcommputil    \
 383         libcontract     \
 384         libcpc          \
 385         libctf          \
 386         libcurses       \
 387         libtermcap      \
 388         libcryptoutil   \
 389         libdevice       \
 390         libdevid        \
 391         libdevinfo      \
 392         libdiskmgt      \
 393         libdladm        \
 394         libdll          \
 395         libdlpi         \
 396         libdhcpagent    \
 397         libdhcpsvc      \
 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         libipsecutil    \
 411         libinetsvc      \
 412         libinetutil     \
 413         libinstzones    \
 414         libipmi         \
 415         libipmp         \
 416         libipp          \
 417         libiscsit       \
 418         libkstat        \
 419         libkvm          \
 420         libmail         \
 421         libmd           \
 422         libmtmalloc     \
 423         libndmp         \
 424         libnvpair       \
 425         libnsctl        \
 426         libnsl          \
 427         libnwam         \
 428         libpam          \
 429         libpcidb        \
 430         libpctx         \
 431         libpicl         \
 432         libpicltree     \
 433         libpool         \
 434         libpp           \
 435         libproc         \
 436         libraidcfg      \
 437         librcm          \
 438         librdc          \
 439         libscf          \
 440         libsip          \
 441         libsmbios       \
 442         librestart      \
 443         librpcsvc       \
 444         librsm          \
 445         librstp         \
 446         libsasl         \
 447         libsec          \
 448         libshell        \
 449         libslp          \
 450         libsmedia       \
 451         libsocket       \
 452         libsqlite       \
 453         libfcoe         \
 454         libsrpt         \
 455         libstmf         \
 456         libstmfproxy    \
 457         libsum          \
 458         libsysevent     \
 459         libtecla        \
 460         libtnf          \
 461         libtnfctl       \
 462         libtnfprobe     \
 463         libtsnet        \
 464         libtsol         \
 465         libvrrpadm      \
 466         libvolmgt       \
 467         libumem         \
 468         libunistat      \
 469         libuutil        \
 470         libwanboot      \
 471         libwanbootutil  \
 472         libwrap         \
 473         libxcurses2     \
 474         libzfs          \
 475         libzfs_core     \
 476         libzfs_jni      \
 477         libzoneinfo     \
 478         libzonestat     \
 479         hal             \
 480         policykit       \
 481         lvm             \
 482         pkcs11          \
 483         passwdutil      \
 484         ../cmd/sendmail/libmilter       \
 485         fm              \
 486         udapl           \
 487         libmapid        \
 488         libkrb5         \
 489         libsmbfs        \
 490         libshare        \
 491         libidmap        \
 492         libvscan        \
 493         libgrubmgmt     \
 494         smbsrv          \
 495         libilb          \
 496         scsi            \
 497         hbaapi          \
 498         smhba           \
 499         libima          \
 500         libsun_ima      \
 501         mpapi           \
 502         libreparse      \
 503         $($(MACH)_HDRSUBDIRS)
 504 
 505 i386_HDRSUBDIRS=        \
 506         libparted       \
 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
 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 libdhcpsvc:     libinetutil
 576 libdhcputil:    libnsl libgen libinetutil libdlpi
 577 libdladm:       libdevinfo libinetutil libsocket libscf librcm libnvpair \
 578                 libexacct libnsl libkstat libcurses
 579 libdll:         libast
 580 libdlpi:        libinetutil libdladm
 581 libds:          libsysevent
 582 libdscfg:       libnsctl libunistat libsocket libnsl
 583 libdtrace:      libproc libgen libctf
 584 libdtrace_jni:  libuutil libdtrace
 585 libefi:         libuuid
 586 libfstyp:       libnvpair
 587 libelfsign:     libcryptoutil libkmf
 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
 592 libkmf:         libcryptoutil pkcs11
 593 libnsl:         libmd5
 594 libmapid:       libresolv
 595 librdc:         libsocket libnsl libnsctl libunistat libdscfg
 596 libuuid:        libdlpi
 597 libinetutil:    libsocket
 598 libipsecutil:   libtecla libsocket
 599 libinstzones:   libzonecfg libcontract
 600 libpkg:         libwanboot libscf libadm
 601 libnwam:        libscf
 602 libsecdb:       libnsl
 603 libsasl:        libgss libsocket pkcs11 libmd
 604 sasl_plugins:   pkcs11 libgss libsocket libsasl
 605 libsctp:        libsocket
 606 libshell:       libast libcmd libdll libsocket libsecdb
 607 libsip:         libmd5
 608 libsmbfs:       libcmdutils libsocket libnsl libkrb5
 609 libsocket:      libnsl
 610 libstmfproxy:   libstmf libsocket libnsl libpthread
 611 libsum:         libast
 612 libsysevent:    libsecdb
 613 libldap5:       libsasl libsocket libnsl libmd
 614 libsldap:       libldap5 libtsol libnsl libc libscf libresolv
 615 libpool:        libnvpair libexacct
 616 libpp:          libast
 617 libzonecfg:     libc libsocket libnsl libuuid libnvpair libsysevent libsec \
 618                 libbrand libpool libscf
 619 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf libsaveargs
 620 libproject:     libpool libproc libsecdb
 621 libtermcap:     libcurses
 622 libtsnet:       libnsl libtsol libsecdb
 623 libwrap:        libnsl libsocket
 624 libwanboot:     libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
 625                 libdhcputil
 626 libwanbootutil: libnsl
 627 pam_modules:    libproject passwdutil smbsrv
 628 libscf:         libuutil libmd libgen libsmbios libnsl
 629 libinetsvc:     libscf
 630 librestart:     libuutil libscf
 631 libsaveargs:    libdisasm
 632 ../cmd/sgs/libdl:       ../cmd/sgs/libconv
 633 ../cmd/sgs/libelf:      ../cmd/sgs/libconv
 634 pkcs11:         libcryptoutil
 635 print:          libldap5
 636 udapl/udapl_tavor:      udapl/libdat
 637 libzfs:         libdevid libgen libnvpair libuutil \
 638                 libadm libavl libefi libidmap libmd libzfs_core
 639 libzfs_core:    libnvpair
 640 libzfs_jni:     libdiskmgt libnvpair libzfs
 641 libzpool:       libavl libumem libnvpair libcmdutils
 642 libsec:         libavl libidmap
 643 brand:          libc libsocket
 644 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 645 libexacct/demo: libexacct libproject libsocket libnsl
 646 libtsalarm:     libpcp
 647 smbsrv:         libsocket libnsl libmd libxnet libpthread librt \
 648                 libshare libidmap pkcs11 libsqlite libcryptoutil \
 649                 libreparse libcmdutils
 650 libv12n:        libds libuuid
 651 libvrrpadm:     libsocket libdladm libscf
 652 libvscan:       libscf
 653 libfru:         libfruutils
 654 scsi:           libnvpair libfru
 655 mpapi:          libpthread libdevinfo libsysevent libnvpair
 656 sun_fc:         libdevinfo libsysevent libnvpair
 657 libsun_ima:     libdevinfo libsysevent libnsl
 658 sun_sas:        libdevinfo libsysevent libnvpair libkstat libdevid
 659 libgrubmgmt:    libdevinfo libzfs libfstyp
 660 pylibbe:        libbe libzfs
 661 pyzfs:          libnvpair libzfs
 662 pysolaris:      libsec libidmap
 663 libreparse:     libnvpair
 664 libhotplug:     libnvpair
 665 cfgadm_plugins: libhotplug
 666 libilb:         libsocket
 667 $(INTEL_BUILD)libdiskmgt:libfdisk
 668 
 669 #
 670 # The reason this rule checks for the existence of the
 671 # Makefile is that some of the directories do not exist
 672 # in certain situations (e.g., exportable source builds,
 673 # OpenSolaris).
 674 #
 675 $(SUBDIRS): FRC
 676         @if [ -f $@/Makefile  ]; then \
 677                 cd $@; pwd; $(MAKE) $(TARGET); \
 678         else \
 679                 true; \
 680         fi
 681 
 682 $(SUBDIRS:%=%-nodepend):
 683         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 684                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 685         else \
 686                 true; \
 687         fi
 688 
 689 FRC: