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