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