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