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