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 2016 Toomas Soome <tsoome@me.com>
  30 # Copyright 2017 Nexenta Systems, Inc.
  31 #
  32 
  33 include ../Makefile.master
  34 
  35 #       Note that libcurses installs commands along with its library.
  36 #       This is a minor bug which probably should be fixed.
  37 #       Note also that a few extra libraries are kept in cmd source.
  38 #
  39 # Certain libraries are linked with, hence depend on, other libraries.
  40 # Library dependencies are called out explicitly, see "Library
  41 # interdependencies" below.
  42 .PARALLEL:
  43 
  44 # Build libc and its dependencies
  45 SUBDIRS=                        \
  46         common                  \
  47         ../cmd/sgs/libconv      \
  48         ../cmd/sgs/libdl        \
  49         libc                    \
  50         .WAIT
  51 
  52 # Build libraries with lots of dependents
  53 SUBDIRS +=              \
  54         libm            \
  55         libmd           \
  56         libmp           \
  57         libnsl          \
  58         libnvpair       \
  59         libsocket       \
  60         .WAIT
  61 
  62 # Build everything else. Aside from explicit dependencies, all libraries
  63 # are built in parallel.
  64 SUBDIRS +=                              \
  65         ../cmd/sendmail/libmilter       \
  66         ../cmd/sgs/libelf       \
  67         ../cmd/sgs/librtld_db   \
  68         abi             \
  69         auditd_plugins  \
  70         brand           \
  71         c_synonyms      \
  72         cfgadm_plugins  \
  73         crypt_modules   \
  74         extendedFILE    \
  75         fm              \
  76         getloginx       \
  77         gss_mechs/mech_dh       \
  78         gss_mechs/mech_dummy    \
  79         gss_mechs/mech_krb5     \
  80         gss_mechs/mech_spnego   \
  81         hal             \
  82         hbaapi          \
  83         krb5            \
  84         libadm          \
  85         libads          \
  86         libadt_jni      \
  87         libadutils      \
  88         libaio          \
  89         libast          \
  90         libavl          \
  91         libbe           \
  92         libbrand        \
  93         libbsdmalloc    \
  94         libbsm          \
  95         libc_db         \
  96         libcfgadm       \
  97         libcmd          \
  98         libcmdutils     \
  99         libcommputil    \
 100         libcontract     \
 101         libcpc          \
 102         libcrypt        \
 103         libcryptoutil   \
 104         libctf          \
 105         libcurses       \
 106         libdevice       \
 107         libdevid        \
 108         libdevinfo      \
 109         libdhcpagent    \
 110         libdhcputil     \
 111         libdisasm       \
 112         libdiskmgt      \
 113         libdladm        \
 114         libdll          \
 115         libdlpi         \
 116         libdns_sd       \
 117         libdoor         \
 118         libdscfg        \
 119         libdtrace       \
 120         libdtrace_jni   \
 121         libefi          \
 122         libelfsign      \
 123         libeti          \
 124         libexacct       \
 125         libexacct/demo  \
 126         libfakekernel   \
 127         libfcoe         \
 128         libficl         \
 129         libfru          \
 130         libfruutils     \
 131         libfsmgt        \
 132         libfstyp        \
 133         libgen          \
 134         libgrubmgmt     \
 135         libgss          \
 136         libhotplug      \
 137         libidmap        \
 138         libilb          \
 139         libima          \
 140         libinetsvc      \
 141         libinetutil     \
 142         libinstzones    \
 143         libintl         \
 144         libipadm        \
 145         libipd          \
 146         libipmi         \
 147         libipmp         \
 148         libipp          \
 149         libipsecutil    \
 150         libiscsit       \
 151         libkmf          \
 152         libkrb5         \
 153         libkstat        \
 154         libkvm          \
 155         libldap5        \
 156         liblgrp         \
 157         liblm           \
 158         libm1           \
 159         libmail         \
 160         libmalloc       \
 161         libmapid        \
 162         libmapmalloc    \
 163         libmd5          \
 164         libmtmalloc     \
 165         libmvec         \
 166         libndmp         \
 167         libnisdb        \
 168         libnls          \
 169         libnsctl        \
 170         libnwam         \
 171         libpam          \
 172         libpcidb        \
 173         libpctx         \
 174         libpicl         \
 175         libpicltree     \
 176         libpkg          \
 177         libpool         \
 178         libpp           \
 179         libproc         \
 180         libproject      \
 181         libpthread      \
 182         libraidcfg      \
 183         librcm          \
 184         librdc          \
 185         libreparse      \
 186         libresolv       \
 187         libresolv2      \
 188         librestart      \
 189         librpcsvc       \
 190         librsm          \
 191         librstp         \
 192         librt           \
 193         libsasl         \
 194         libscf          \
 195         libsched        \
 196         libsctp         \
 197         libsec          \
 198         libsecdb        \
 199         libsendfile     \
 200         libshare        \
 201         libshell        \
 202         libsip          \
 203         libsldap        \
 204         libslp          \
 205         libsmbfs        \
 206         libsmbios       \
 207         libsmedia       \
 208         libsqlite       \
 209         libsrpt         \
 210         libstmf         \
 211         libstmfproxy    \
 212         libsum          \
 213         libsun_ima      \
 214         libsys          \
 215         libsysevent     \
 216         libtecla        \
 217         libtermcap      \
 218         libthread       \
 219         libtnf          \
 220         libtnfctl       \
 221         libtnfprobe     \
 222         libtsnet        \
 223         libtsol         \
 224         libumem         \
 225         libunistat      \
 226         libuserdefs     \
 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         madv            \
 247         mpapi           \
 248         mpss            \
 249         nametoaddr      \
 250         ncad_addr       \
 251         nsswitch        \
 252         pam_modules     \
 253         passwdutil      \
 254         pkcs11          \
 255         policykit       \
 256         print           \
 257         pylibbe         \
 258         pysolaris       \
 259         pyzfs           \
 260         raidcfg_plugins \
 261         rpcsec_gss      \
 262         sasl_plugins    \
 263         scsi            \
 264         smbsrv          \
 265         smhba           \
 266         sun_fc          \
 267         sun_sas         \
 268         udapl           \
 269         watchmalloc     \
 270         $($(MACH)_SUBDIRS)
 271 
 272 i386_SUBDIRS=           \
 273         libfdisk        \
 274         libsaveargs
 275 
 276 sparc_SUBDIRS=          \
 277         efcode          \
 278         libds           \
 279         libdscp         \
 280         libprtdiag      \
 281         libprtdiag_psr  \
 282         libpri          \
 283         librsc          \
 284         storage         \
 285         libpcp          \
 286         libtsalarm      \
 287         libv12n
 288 
 289 #
 290 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
 291 # clean and clobber targets (for more information, see those targets, below).
 292 #
 293 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 294 
 295 DCSUBDIRS=
 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         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         mpapi           \
 488         passwdutil      \
 489         pkcs11          \
 490         policykit       \
 491         scsi            \
 492         smbsrv          \
 493         smhba           \
 494         udapl           \
 495         $($(MACH)_HDRSUBDIRS)
 496 
 497 i386_HDRSUBDIRS=        \
 498         libfdisk        \
 499         libsaveargs
 500 
 501 sparc_HDRSUBDIRS=       \
 502         libds           \
 503         libdscp         \
 504         libpri          \
 505         libv12n         \
 506         storage
 507 
 508 all :=          TARGET= all
 509 check :=        TARGET= check
 510 clean :=        TARGET= clean
 511 clobber :=      TARGET= clobber
 512 install :=      TARGET= install
 513 install_h :=    TARGET= install_h
 514 lint :=         TARGET= lint
 515 _dc :=          TARGET= _dc
 516 _msg :=         TARGET= _msg
 517 
 518 .KEEP_STATE:
 519 
 520 #
 521 # For the all and install targets, we clearly must respect library
 522 # dependencies so that the libraries link correctly.  However, for
 523 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 524 # and _msg), libraries do not have any dependencies on one another
 525 # and thus respecting dependencies just slows down the build.
 526 # As such, for these rules, we use pattern replacement to explicitly
 527 # avoid triggering the dependency information.  Note that for clean,
 528 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 529 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 530 #
 531 
 532 all:                    $(SUBDIRS)
 533 
 534 install:                $(SUBDIRS) .WAIT install_extra
 535 
 536 # extra libraries kept in other source areas
 537 install_extra:
 538         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 539         @pwd
 540 
 541 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 542 
 543 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 544 
 545 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 546 
 547 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 548 
 549 # Library interdependencies are called out explicitly here.
 550 ../cmd/sgs/libconv: common
 551 ../cmd/sgs/libdl: common
 552 libc:           ../cmd/sgs/libconv ../cmd/sgs/libdl
 553 
 554 libm:           libc
 555 libmd:          libc
 556 libmp:          libc
 557 libnsl:         libc libmd libmp
 558 libnvpair:      libc libnsl
 559 libsocket:      libc libnsl
 560 
 561 basedeps:       libc libm libmd libmp libnsl libnvpair libsocket
 562 basedeps :=     TARGET=install
 563 
 564 # The following dependencies are currently required by libdbus-1 and should
 565 # be used for anything linking against it.
 566 dbusdeps:       libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
 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 hal:            dbusdeps
 583 krb5:           gss_mechs/mech_krb5 libtecla libldap5
 584 libadt_jni:     libbsm
 585 libadutils:     libldap5 libresolv2
 586 libbe:          libzfs libinstzones libuuid libgen libdevinfo libefi libficl
 587 libbsm:         libinetutil libscf libsecdb libtsol
 588 libcfgadm:      libdevinfo
 589 libcmd:         libsum libast
 590 libcmdutils:    libavl
 591 libcpc:         libpctx
 592 libcrypt:       libgen
 593 libdevid:       libdevinfo
 594 libdevinfo:     libsec libgen
 595 libdhcpagent:   libdhcputil libuuid libdlpi libcontract
 596 libdhcputil:    libgen libinetutil libdlpi
 597 libdiskmgt:     libdevid libdevinfo libadm libefi libkstat libsysevent
 598 $(INTEL_BLD)libdiskmgt: libfdisk
 599 libdladm:       libdevinfo libinetutil libscf librcm libexacct libkstat \
 600                 libpool
 601 libdll:         libast
 602 libdlpi:        libinetutil libdladm
 603 libds:          libsysevent
 604 libdscfg:       libnsctl libunistat libadm
 605 libdtrace:      libproc libgen libctf libmapmalloc
 606 libdtrace_jni:  libuutil libdtrace
 607 libefi:         libuuid
 608 libelfsign:     libcryptoutil libkmf ../cmd/sgs/libelf
 609 libeti:         libcurses
 610 libexacct/demo: libexacct libproject
 611 libfakekernel:  libumem libcryptoutil
 612 libfcoe:        libdladm
 613 libficl:        libuuid libumem
 614 libfru:         libfruutils
 615 libfsmgt:       libkstat
 616 libgrubmgmt:    libdevinfo libzfs libfstyp libefi
 617 $(INTEL_BLD)libgrubmgmt: libfdisk
 618 libidmap:       libavl libuutil
 619 libinetsvc:     libscf
 620 libinstzones:   libzonecfg libcontract
 621 libipadm:       libinetutil libdlpi libdhcpagent libdladm libsecdb
 622 libipmp:        libinetutil
 623 libipsecutil:   libtecla libtsol
 624 libiscsit:      libstmf libuuid
 625 libkmf:         libcryptoutil pkcs11
 626 libkvm:         ../cmd/sgs/libelf
 627 libldap5:       libsasl
 628 libmapid:       libresolv2 libscf
 629 libndmp:        libscf
 630 libnisdb:       libldap5
 631 libnwam:        libscf libbsm libdladm
 632 libpcp:         libumem libdevinfo
 633 libpctx:        libproc
 634 libpkg:         libwanboot libscf libadm
 635 libpool:        libscf libexacct
 636 libpp:          libast
 637 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
 638 $(INTEL_BLD)libproc: libsaveargs
 639 libproject:     libpool libproc libsecdb
 640 libprtdiag:     libkstat
 641 libprtdiag_psr: libprtdiag
 642 libraidcfg:     libdevinfo
 643 librdc:         libnsctl libunistat libdscfg
 644 librestart:     libuutil libscf libpool libproject libsecdb libsysevent
 645 libsasl:        libgss pkcs11
 646 libsaveargs:    libdisasm
 647 libscf:         libuutil libgen libsmbios
 648 libsec:         libavl libidmap
 649 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 650 libshell:       libast libcmd libdll libsecdb
 651 libsip:         libmd5
 652 libsldap:       libldap5 libscf
 653 libsmbfs:       libkrb5 libsec libidmap pkcs11
 654 libsmbios:      libdevinfo
 655 libsrpt:        libstmf
 656 libstmf:        libscf
 657 libstmfproxy:   libstmf libpthread
 658 libsum:         libast
 659 libsun_ima:     libdevinfo libsysevent
 660 libsysevent:    libsecdb
 661 libtecla:       libcurses
 662 libtermcap:     libcurses
 663 libtnfctl:      ../cmd/sgs/libelf
 664 libtsalarm:     libpcp
 665 libtsnet:       libtsol libsecdb
 666 libtsol:        libsecdb
 667 libuuid:        libdlpi
 668 libv12n:        libds libuuid
 669 libvolmgt:      libadm
 670 libvrrpadm:     libdladm libscf
 671 libvscan:       libscf libsecdb
 672 libwanboot:     libresolv2 libdevinfo libinetutil libdhcputil
 673 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 674                 libumem libtsol libzfs_core
 675 libzfs_jni:     libdiskmgt libzfs
 676 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 677                 libuutil libbsm libsecdb
 678 libzonestat:    libcmdutils libumem
 679 libzpool:       libavl libumem libcmdutils libsysevent
 680 madv:           libgen
 681 mpapi:          libpthread libdevinfo libsysevent
 682 mpss:           libgen
 683 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 684 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 685 passwdutil:     libsldap
 686 pkcs11:         libcryptoutil libgen libuuid
 687 policykit:      dbusdeps
 688 print:          libldap5 libmd5 libsendfile
 689 pylibbe:        libbe libzfs
 690 pysolaris:      libsec libidmap
 691 pyzfs:          libzfs
 692 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 693 rpcsec_gss:     libgss
 694 sasl_plugins:   pkcs11 libgss libsasl
 695 scsi:           libfru libumem libdevid libdevinfo
 696 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 697                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 698                 libuuid libfakekernel libads libgss libldap5 krb5
 699 storage:        libdevice libdevinfo libdevid
 700 sun_fc:         libdevinfo libsysevent
 701 sun_sas:        libdevinfo libsysevent libkstat libdevid
 702 udapl:          libdevinfo libdladm
 703 
 704 #
 705 # The reason this rule checks for the existence of the
 706 # Makefile is that some of the directories do not exist
 707 # in certain situations (e.g., exportable source builds,
 708 # OpenSolaris).
 709 #
 710 $(SUBDIRS): FRC
 711         @if [ -f $@/Makefile  ]; then \
 712                 cd $@; pwd; $(MAKE) $(TARGET); \
 713         else \
 714                 true; \
 715         fi
 716 
 717 $(SUBDIRS:%=%-nodepend):
 718         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 719                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 720         else \
 721                 true; \
 722         fi
 723 
 724 FRC: