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         libdscfg        \
 121         libdtrace       \
 122         libdtrace_jni   \
 123         libefi          \
 124         libelfsign      \
 125         libeti          \
 126         libexacct       \
 127         libexacct/demo  \
 128         libfakekernel   \
 129         libfcoe         \
 130         libficl         \
 131         libfru          \
 132         libfruutils     \
 133         libfsmgt        \
 134         libfstyp        \
 135         libgen          \
 136         libgrubmgmt     \
 137         libgss          \
 138         libhotplug      \
 139         libidmap        \
 140         libilb          \
 141         libima          \
 142         libinetsvc      \
 143         libinetutil     \
 144         libinstzones    \
 145         libintl         \
 146         libipadm        \
 147         libipd          \
 148         libipmi         \
 149         libipmp         \
 150         libipp          \
 151         libipsecutil    \
 152         libiscsit       \
 153         libkmf          \
 154         libkrb5         \
 155         libkstat        \
 156         libkvm          \
 157         libldap5        \
 158         liblgrp         \
 159         liblm           \
 160         libm1           \
 161         libmail         \
 162         libmalloc       \
 163         libmapid        \
 164         libmapmalloc    \
 165         libmd5          \
 166         libmlrpc        \
 167         libmtmalloc     \
 168         libmvec         \
 169         libndmp         \
 170         libnisdb        \
 171         libnls          \
 172         libnsctl        \
 173         libnwam         \
 174         libofmt         \
 175         libpam          \
 176         libpcidb        \
 177         libpctx         \
 178         libpicl         \
 179         libpicltree     \
 180         libpkg          \
 181         libpool         \
 182         libpp           \
 183         libproc         \
 184         libproject      \
 185         libpthread      \
 186         libraidcfg      \
 187         librcm          \
 188         librdc          \
 189         libreparse      \
 190         libresolv       \
 191         libresolv2      \
 192         librestart      \
 193         librpcsvc       \
 194         librsm          \
 195         librstp         \
 196         librt           \
 197         libsasl         \
 198         libscf          \
 199         libsched        \
 200         libsctp         \
 201         libsec          \
 202         libsecdb        \
 203         libsendfile     \
 204         libsff          \
 205         libshare        \
 206         libshell        \
 207         libsip          \
 208         libsldap        \
 209         libslp          \
 210         libsmbfs        \
 211         libsmbios       \
 212         libsmedia       \
 213         libsqlite       \
 214         libsrpt         \
 215         libstmf         \
 216         libstmfproxy    \
 217         libsum          \
 218         libsun_ima      \
 219         libsys          \
 220         libsysevent     \
 221         libtecla        \
 222         libtermcap      \
 223         libthread       \
 224         libtnf          \
 225         libtnfctl       \
 226         libtnfprobe     \
 227         libtsnet        \
 228         libtsol         \
 229         libumem         \
 230         libunistat      \
 231         libuuid         \
 232         libuutil        \
 233         libvolmgt       \
 234         libvrrpadm      \
 235         libvscan        \
 236         libw            \
 237         libwrap         \
 238         libxcurses      \
 239         libxcurses2     \
 240         libxnet         \
 241         libzfs          \
 242         libzfs_core     \
 243         libzfs_jni      \
 244         libzonecfg      \
 245         libzoneinfo     \
 246         libzonestat     \
 247         libzpool        \
 248         madv            \
 249         mpapi           \
 250         mpss            \
 251         nametoaddr      \
 252         ncad_addr       \
 253         nsswitch        \
 254         pam_modules     \
 255         passwdutil      \
 256         pkcs11          \
 257         policykit       \
 258         print           \
 259         pylibbe         \
 260         pysolaris       \
 261         pyzfs           \
 262         raidcfg_plugins \
 263         rpcsec_gss      \
 264         sasl_plugins    \
 265         scsi            \
 266         smbsrv          \
 267         smhba           \
 268         sun_fc          \
 269         sun_sas         \
 270         udapl           \
 271         watchmalloc     \
 272         $($(MACH)_SUBDIRS)
 273 
 274 i386_SUBDIRS=           \
 275         libfdisk        \
 276         libsaveargs
 277 
 278 sparc_SUBDIRS=          \
 279         efcode          \
 280         libds           \
 281         libdscp         \
 282         libprtdiag      \
 283         libprtdiag_psr  \
 284         libpri          \
 285         librsc          \
 286         storage         \
 287         libpcp          \
 288         libtsalarm      \
 289         libv12n
 290 
 291 #
 292 # Create a special version of $(SUBDIRS) with no .WAIT's, for use with the
 293 # clean and clobber targets (for more information, see those targets, below).
 294 #
 295 NOWAIT_SUBDIRS= $(SUBDIRS:.WAIT=)
 296 
 297 DCSUBDIRS=
 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         libinstzones    \
 323         libipadm        \
 324         libipmp         \
 325         libipsecutil    \
 326         libldap5        \
 327         libnsl          \
 328         libnwam         \
 329         libofmt         \
 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         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         libmlrpc        \
 426         libmtmalloc     \
 427         libndmp         \
 428         libnsctl        \
 429         libnsl          \
 430         libnvpair       \
 431         libnwam         \
 432         libofmt         \
 433         libpam          \
 434         libpcidb        \
 435         libpctx         \
 436         libpicl         \
 437         libpicltree     \
 438         libpool         \
 439         libpp           \
 440         libproc         \
 441         libraidcfg      \
 442         librcm          \
 443         librdc          \
 444         libreparse      \
 445         librestart      \
 446         librpcsvc       \
 447         librsm          \
 448         librstp         \
 449         libsasl         \
 450         libscf          \
 451         libsec          \
 452         libsff          \
 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         libwrap         \
 482         libxcurses2     \
 483         libzfs          \
 484         libzfs_core     \
 485         libzfs_jni      \
 486         libzoneinfo     \
 487         libzonestat     \
 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: crt
 552 ../cmd/sgs/libdl: crt
 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 are currently required by libdbus-1 and should
 566 # be used for anything linking against it.
 567 dbusdeps:       libsecdb libtsol libinetutil libscf libuutil libgen libsmbios
 568 
 569 # The following dependencies don't need to be listed below as they are built
 570 # before everything else:
 571 # libc libm libmd libmp libnsl libnvpair libsocket
 572 abi:            libctf libmapmalloc libproc
 573 auditd_plugins: libbsm libsecdb libgss libmtmalloc
 574 brand:          libzonecfg libmapmalloc
 575 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
 576 fm:             libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
 577                 libcontract libsysevent ../cmd/sgs/libelf libdladm libsff
 578 $(SPARC_BLD)fm: libpri
 579 gss_mechs/mech_dh: libgss
 580 gss_mechs/mech_dummy: libgss
 581 gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
 582 gss_mechs/mech_spnego: gss_mechs/mech_krb5
 583 hal:            dbusdeps
 584 krb5:           gss_mechs/mech_krb5 libtecla libldap5
 585 libadt_jni:     libbsm
 586 libadutils:     libldap5 libresolv2
 587 libbe:          libzfs libinstzones libuuid libgen libdevinfo libefi libficl
 588 libbsm:         libinetutil libscf libsecdb libtsol
 589 libcfgadm:      libdevinfo
 590 libcmd:         libsum libast
 591 libcmdutils:    libavl
 592 libcpc:         libpctx
 593 libcrypt:       libgen
 594 libdevid:       libdevinfo
 595 libdevinfo:     libsec libgen
 596 libdhcpagent:   libdhcputil libuuid libdlpi libcontract
 597 libdhcputil:    libgen libinetutil libdlpi
 598 libdiskmgt:     libdevid libdevinfo libadm libefi libkstat libsysevent
 599 $(INTEL_BLD)libdiskmgt: libfdisk
 600 libdladm:       libdevinfo libinetutil libscf librcm libexacct libkstat \
 601                 libpool
 602 libdll:         libast
 603 libdlpi:        libinetutil libdladm
 604 libds:          libsysevent
 605 libdscfg:       libnsctl libunistat libadm
 606 libdtrace:      libproc libgen libctf libmapmalloc
 607 libdtrace_jni:  libuutil libdtrace
 608 libefi:         libuuid
 609 libelfsign:     libcryptoutil libkmf ../cmd/sgs/libelf
 610 libeti:         libcurses
 611 libexacct/demo: libexacct libproject
 612 libfakekernel:  libumem libcryptoutil
 613 libfcoe:        libdladm
 614 libficl:        libuuid libumem
 615 libfru:         libfruutils
 616 libfsmgt:       libkstat
 617 libgrubmgmt:    libdevinfo libzfs libfstyp libefi
 618 $(INTEL_BLD)libgrubmgmt: libfdisk
 619 libidmap:       libavl libuutil
 620 libinetsvc:     libscf
 621 libinstzones:   libzonecfg libcontract
 622 libipadm:       libinetutil libdlpi libdhcpagent libdladm libsecdb libdhcputil
 623 libipmp:        libinetutil
 624 libipsecutil:   libtecla libtsol
 625 libiscsit:      libstmf libuuid
 626 libkmf:         libcryptoutil pkcs11
 627 libkvm:         ../cmd/sgs/libelf
 628 libldap5:       libsasl
 629 libmapid:       libresolv2 libscf
 630 libmlrpc:       libsmbfs libuuid
 631 libndmp:        libscf
 632 libnisdb:       libldap5
 633 libnwam:        libscf libbsm libdladm libipadm
 634 libpcp:         libumem libdevinfo
 635 libpctx:        libproc
 636 libpkg:         libscf libadm
 637 libpool:        libscf libexacct
 638 libpp:          libast
 639 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
 640 $(INTEL_BLD)libproc: libsaveargs
 641 libproject:     libpool libproc libsecdb
 642 libprtdiag:     libkstat
 643 libprtdiag_psr: libprtdiag
 644 libraidcfg:     libdevinfo
 645 librdc:         libnsctl libunistat libdscfg
 646 librestart:     libuutil libscf libpool libproject libsecdb libsysevent
 647 libsasl:        libgss pkcs11
 648 libsaveargs:    libdisasm
 649 libscf:         libuutil libgen libsmbios
 650 libsec:         libavl libidmap
 651 libsff:         libnvpair
 652 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 653 libshell:       libast libcmd libdll libsecdb
 654 libsip:         libmd5
 655 libsldap:       libldap5 libscf
 656 libsmbfs:       libkrb5 libsec libidmap pkcs11
 657 libsmbios:      libdevinfo
 658 libsrpt:        libstmf
 659 libstmf:        libscf
 660 libstmfproxy:   libstmf libpthread
 661 libsum:         libast
 662 libsun_ima:     libdevinfo libsysevent
 663 libsysevent:    libsecdb
 664 libtecla:       libcurses
 665 libtermcap:     libcurses
 666 libtnfctl:      ../cmd/sgs/libelf
 667 libtsalarm:     libpcp
 668 libtsnet:       libtsol libsecdb
 669 libtsol:        libsecdb
 670 libuuid:        libdlpi
 671 libv12n:        libds libuuid
 672 libvolmgt:      libadm
 673 libvrrpadm:     libdladm libscf
 674 libvscan:       libscf libsecdb
 675 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 676                 libumem libtsol libzfs_core libcmdutils
 677 libzfs_jni:     libdiskmgt libzfs
 678 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 679                 libuutil libbsm libsecdb
 680 libzonestat:    libcmdutils libumem
 681 libzpool:       libavl libumem libcmdutils libsysevent libfakekernel
 682 madv:           libgen
 683 mpapi:          libpthread libdevinfo libsysevent
 684 mpss:           libgen
 685 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 686 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 687 passwdutil:     libsldap
 688 pkcs11:         libcryptoutil libgen libuuid
 689 policykit:      dbusdeps
 690 print:          libldap5 libmd5 libsendfile
 691 pylibbe:        libbe libzfs
 692 pysolaris:      libsec libidmap
 693 pyzfs:          libzfs
 694 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 695 rpcsec_gss:     libgss
 696 sasl_plugins:   pkcs11 libgss libsasl
 697 scsi:           libfru libumem libdevid libdevinfo
 698 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 699                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 700                 libuuid libfakekernel libads libgss libldap5 krb5 libmlrpc
 701 storage:        libdevice libdevinfo libdevid
 702 sun_fc:         libdevinfo libsysevent
 703 sun_sas:        libdevinfo libsysevent libkstat libdevid
 704 udapl:          libdevinfo libdladm
 705 
 706 #
 707 # The reason this rule checks for the existence of the
 708 # Makefile is that some of the directories do not exist
 709 # in certain situations (e.g., exportable source builds,
 710 # OpenSolaris).
 711 #
 712 $(SUBDIRS): FRC
 713         @if [ -f $@/Makefile  ]; then \
 714                 cd $@; pwd; $(MAKE) $(TARGET); \
 715         else \
 716                 true; \
 717         fi
 718 
 719 $(SUBDIRS:%=%-nodepend):
 720         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 721                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 722         else \
 723                 true; \
 724         fi
 725 
 726 FRC: