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