1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright (c) 2012 by Delphix. All rights reserved.
  25 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
  26 # Copyright (c) 2013 Gary Mills
  27 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
  28 # Copyright (c) 2015 Gary Mills
  29 # Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  30 # Copyright 2016 Toomas Soome <tsoome@me.com>
  31 #
  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         crt                     \
  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         libuuid         \
 227         libuutil        \
 228         libvolmgt       \
 229         libvrrpadm      \
 230         libvscan        \
 231         libw            \
 232         libwanboot      \
 233         libwanbootutil  \
 234         libwrap         \
 235         libxcurses      \
 236         libxcurses2     \
 237         libxnet         \
 238         libzfs          \
 239         libzfs_core     \
 240         libzfs_jni      \
 241         libzonecfg      \
 242         libzoneinfo     \
 243         libzonestat     \
 244         libzpool        \
 245         lvm             \
 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         lvm
 297 
 298 MSGSUBDIRS=             \
 299         abi             \
 300         auditd_plugins  \
 301         brand           \
 302         cfgadm_plugins  \
 303         gss_mechs/mech_dh       \
 304         gss_mechs/mech_krb5     \
 305         krb5            \
 306         libast          \
 307         libbsm          \
 308         libc            \
 309         libcfgadm       \
 310         libcmd          \
 311         libcontract     \
 312         libcurses       \
 313         libdhcputil     \
 314         libdiskmgt      \
 315         libdladm        \
 316         libdll          \
 317         libgrubmgmt     \
 318         libgss          \
 319         libidmap        \
 320         libilb          \
 321         libinetutil     \
 322         libinstzones    \
 323         libipadm        \
 324         libipmp         \
 325         libipsecutil    \
 326         libldap5        \
 327         libnsl          \
 328         libnwam         \
 329         libpam          \
 330         libpicl         \
 331         libpkg          \
 332         libpool         \
 333         libpp           \
 334         libreparse      \
 335         libsasl         \
 336         libscf          \
 337         libsecdb        \
 338         libshare        \
 339         libshell        \
 340         libsldap        \
 341         libslp          \
 342         libsmbfs        \
 343         libsmedia       \
 344         libsum          \
 345         libtsol         \
 346         libuutil        \
 347         libvrrpadm      \
 348         libvscan        \
 349         libwanboot      \
 350         libwanbootutil  \
 351         libzfs          \
 352         libzonecfg      \
 353         lvm             \
 354         madv            \
 355         mpss            \
 356         pam_modules     \
 357         pyzfs           \
 358         rpcsec_gss      \
 359         $($(MACH)_MSGSUBDIRS)
 360 
 361 sparc_MSGSUBDIRS=       \
 362         libprtdiag      \
 363         libprtdiag_psr
 364 
 365 i386_MSGSUBDIRS= libfdisk
 366 
 367 HDRSUBDIRS=                             \
 368         ../cmd/sendmail/libmilter       \
 369         auditd_plugins  \
 370         fm              \
 371         hal             \
 372         hbaapi          \
 373         libads          \
 374         libast          \
 375         libbrand        \
 376         libbsm          \
 377         libc            \
 378         libcmd          \
 379         libcmdutils     \
 380         libcommputil    \
 381         libcontract     \
 382         libcpc          \
 383         libcryptoutil   \
 384         libctf          \
 385         libcurses       \
 386         libdevice       \
 387         libdevid        \
 388         libdevinfo      \
 389         libdhcpagent    \
 390         libdhcputil     \
 391         libdisasm       \
 392         libdiskmgt      \
 393         libdladm        \
 394         libdll          \
 395         libdlpi         \
 396         libdns_sd       \
 397         libdscfg        \
 398         libdtrace       \
 399         libdtrace_jni   \
 400         libelfsign      \
 401         libeti          \
 402         libfakekernel   \
 403         libfcoe         \
 404         libfru          \
 405         libfstyp        \
 406         libgen          \
 407         libgrubmgmt     \
 408         libidmap        \
 409         libilb          \
 410         libima          \
 411         libinetsvc      \
 412         libinetutil     \
 413         libinstzones    \
 414         libipadm        \
 415         libipd          \
 416         libipmi         \
 417         libipmp         \
 418         libipp          \
 419         libipsecutil    \
 420         libiscsit       \
 421         libkrb5         \
 422         libkstat        \
 423         libkvm          \
 424         libmail         \
 425         libmapid        \
 426         libmd           \
 427         libmtmalloc     \
 428         libndmp         \
 429         libnsctl        \
 430         libnsl          \
 431         libnvpair       \
 432         libnwam         \
 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         libshare        \
 453         libshell        \
 454         libsip          \
 455         libslp          \
 456         libsmbfs        \
 457         libsmbios       \
 458         libsmedia       \
 459         libsocket       \
 460         libsqlite       \
 461         libsrpt         \
 462         libstmf         \
 463         libstmfproxy    \
 464         libsum          \
 465         libsun_ima      \
 466         libsysevent     \
 467         libtecla        \
 468         libtermcap      \
 469         libtnf          \
 470         libtnfctl       \
 471         libtnfprobe     \
 472         libtsnet        \
 473         libtsol         \
 474         libumem         \
 475         libunistat      \
 476         libuutil        \
 477         libvolmgt       \
 478         libvrrpadm      \
 479         libvscan        \
 480         libwanboot      \
 481         libwanbootutil  \
 482         libwrap         \
 483         libxcurses2     \
 484         libzfs          \
 485         libzfs_core     \
 486         libzfs_jni      \
 487         libzoneinfo     \
 488         libzonestat     \
 489         lvm             \
 490         mpapi           \
 491         passwdutil      \
 492         pkcs11          \
 493         policykit       \
 494         scsi            \
 495         smbsrv          \
 496         smhba           \
 497         udapl           \
 498         $($(MACH)_HDRSUBDIRS)
 499 
 500 i386_HDRSUBDIRS=        \
 501         libfdisk        \
 502         libsaveargs
 503 
 504 sparc_HDRSUBDIRS=       \
 505         libds           \
 506         libdscp         \
 507         libpri          \
 508         libv12n         \
 509         storage
 510 
 511 all :=          TARGET= all
 512 check :=        TARGET= check
 513 clean :=        TARGET= clean
 514 clobber :=      TARGET= clobber
 515 install :=      TARGET= install
 516 install_h :=    TARGET= install_h
 517 lint :=         TARGET= lint
 518 _dc :=          TARGET= _dc
 519 _msg :=         TARGET= _msg
 520 
 521 .KEEP_STATE:
 522 
 523 #
 524 # For the all and install targets, we clearly must respect library
 525 # dependencies so that the libraries link correctly.  However, for
 526 # the remaining targets (check, clean, clobber, install_h, lint, _dc
 527 # and _msg), libraries do not have any dependencies on one another
 528 # and thus respecting dependencies just slows down the build.
 529 # As such, for these rules, we use pattern replacement to explicitly
 530 # avoid triggering the dependency information.  Note that for clean,
 531 # clobber and lint, we must use $(NOWAIT_SUBDIRS) rather than
 532 # $(SUBDIRS), to prevent `.WAIT' from expanding to `.WAIT-nodepend'.
 533 #
 534 
 535 all:                    $(SUBDIRS)
 536 
 537 install:                $(SUBDIRS) .WAIT install_extra
 538 
 539 # extra libraries kept in other source areas
 540 install_extra:
 541         @cd ../cmd/sgs; pwd; $(MAKE) install_lib
 542         @pwd
 543 
 544 clean clobber lint:     $(NOWAIT_SUBDIRS:%=%-nodepend)
 545 
 546 install_h check:        $(HDRSUBDIRS:%=%-nodepend)
 547 
 548 _msg:                   $(MSGSUBDIRS:%=%-nodepend) .WAIT _dc
 549 
 550 _dc:                    $(DCSUBDIRS:%=%-nodepend)
 551 
 552 # Library interdependencies are called out explicitly here.
 553 ../cmd/sgs/libconv: crt
 554 ../cmd/sgs/libdl: crt
 555 libc:           ../cmd/sgs/libconv ../cmd/sgs/libdl
 556 
 557 libm:           libc
 558 libmd:          libc
 559 libmp:          libc
 560 libnsl:         libc libmd libmp
 561 libnvpair:      libc libnsl
 562 libsocket:      libc libnsl
 563 
 564 basedeps:       libc libm libmd libmp libnsl libnvpair libsocket
 565 basedeps :=     TARGET=install
 566 
 567 # The following dependencies don't need to be listed below as they are built
 568 # before everything else:
 569 # libc libm libmd libmp libnsl libnvpair libsocket
 570 abi:            libctf libmapmalloc libproc
 571 auditd_plugins: libbsm libsecdb libgss libmtmalloc
 572 brand:          libzonecfg libmapmalloc
 573 cfgadm_plugins: libdevice libdevinfo libhotplug librcm hbaapi libkstat libscf
 574 fm:             libexacct libipmi libzfs scsi libdevinfo libdevid libcfgadm \
 575                 libcontract libsysevent ../cmd/sgs/libelf
 576 $(SPARC_BLD)fm: libpri
 577 gss_mechs/mech_dh: libgss
 578 gss_mechs/mech_dummy: libgss
 579 gss_mechs/mech_krb5: libgss libresolv2 pkcs11 libkstat
 580 gss_mechs/mech_spnego: gss_mechs/mech_krb5
 581 krb5:           gss_mechs/mech_krb5 libtecla libldap5
 582 libadt_jni:     libbsm
 583 libadutils:     libldap5 libresolv2
 584 libbe:          libzfs libinstzones libuuid libgen libdevinfo libefi libficl
 585 libbsm:         libinetutil libscf libsecdb libtsol
 586 libcfgadm:      libdevinfo
 587 libcmd:         libsum libast
 588 libcmdutils:    libavl
 589 libcpc:         libpctx
 590 libcrypt:       libgen
 591 libdevid:       libdevinfo
 592 libdevinfo:     libsec libgen
 593 libdhcpagent:   libdhcputil libuuid libdlpi libcontract
 594 libdhcputil:    libgen libinetutil libdlpi
 595 libdiskmgt:     libdevid libdevinfo libadm libefi libkstat libsysevent
 596 $(INTEL_BLD)libdiskmgt: libfdisk
 597 libdladm:       libdevinfo libinetutil libscf librcm libexacct libkstat \
 598                 libpool
 599 libdll:         libast
 600 libdlpi:        libinetutil libdladm
 601 libds:          libsysevent
 602 libdscfg:       libnsctl libunistat libadm
 603 libdtrace:      libproc libgen libctf libmapmalloc
 604 libdtrace_jni:  libuutil libdtrace
 605 libefi:         libuuid
 606 libelfsign:     libcryptoutil libkmf ../cmd/sgs/libelf
 607 libeti:         libcurses
 608 libexacct/demo: libexacct libproject
 609 libfakekernel:  libumem libcryptoutil
 610 libfcoe:        libdladm
 611 libficl:        libumem
 612 libfru:         libfruutils
 613 libfsmgt:       libkstat
 614 libgrubmgmt:    libdevinfo libzfs libfstyp libefi
 615 $(INTEL_BLD)libgrubmgmt: libfdisk
 616 libidmap:       libavl libuutil
 617 libinetsvc:     libscf
 618 libinstzones:   libzonecfg libcontract
 619 libipadm:       libinetutil libdlpi libdhcpagent libdladm libsecdb
 620 libipmp:        libinetutil
 621 libipsecutil:   libtecla libtsol
 622 libiscsit:      libstmf libuuid
 623 libkmf:         libcryptoutil pkcs11
 624 libkvm:         ../cmd/sgs/libelf
 625 libldap5:       libsasl
 626 libmapid:       libresolv2 libscf
 627 libndmp:        libscf
 628 libnisdb:       libldap5
 629 libnwam:        libscf libbsm libdladm
 630 libpcp:         libumem libdevinfo
 631 libpctx:        libproc
 632 libpkg:         libwanboot libscf libadm
 633 libpool:        libscf libexacct
 634 libpp:          libast
 635 libproc:        ../cmd/sgs/librtld_db ../cmd/sgs/libelf libctf
 636 $(INTEL_BLD)libproc: libsaveargs
 637 libproject:     libpool libproc libsecdb
 638 libprtdiag:     libkstat
 639 libprtdiag_psr: libprtdiag
 640 libraidcfg:     libdevinfo
 641 librdc:         libnsctl libunistat libdscfg
 642 librestart:     libuutil libscf libpool libproject libsecdb libsysevent
 643 libsasl:        libgss pkcs11
 644 libsaveargs:    libdisasm
 645 libscf:         libuutil libgen libsmbios
 646 libsec:         libavl libidmap
 647 libshare:       libscf libzfs libuuid libfsmgt libsecdb libumem libsmbfs
 648 libshell:       libast libcmd libdll libsecdb
 649 libsip:         libmd5
 650 libsldap:       libldap5 libscf
 651 libsmbfs:       libkrb5 libsec libidmap pkcs11
 652 libsrpt:        libstmf
 653 libstmf:        libscf
 654 libstmfproxy:   libstmf libpthread
 655 libsum:         libast
 656 libsun_ima:     libdevinfo libsysevent
 657 libsysevent:    libsecdb
 658 libtecla:       libcurses
 659 libtermcap:     libcurses
 660 libtnfctl:      ../cmd/sgs/libelf
 661 libtsalarm:     libpcp
 662 libtsnet:       libtsol libsecdb
 663 libtsol:        libsecdb
 664 libuuid:        libdlpi
 665 libv12n:        libds libuuid
 666 libvolmgt:      libadm
 667 libvrrpadm:     libdladm libscf
 668 libvscan:       libscf libsecdb
 669 libwanboot:     libresolv2 libdevinfo libinetutil libdhcputil
 670 libzfs:         libdevid libgen libuutil libadm libavl libefi libidmap \
 671                 libumem libtsol libzfs_core
 672 libzfs_jni:     libdiskmgt libzfs
 673 libzonecfg:     libuuid libsysevent libsec libbrand libpool libscf libproc \
 674                 libuutil libbsm libsecdb
 675 libzonestat:    libcmdutils libumem
 676 libzpool:       libavl libumem libcmdutils libsysevent
 677 lvm:            libadm libdevid libdevinfo libefi libgen libscf
 678 madv:           libgen
 679 mpapi:          libpthread libdevinfo libsysevent
 680 mpss:           libgen
 681 nsswitch:       libadutils libidmap libdns_sd libscf libldap5 libsldap
 682 pam_modules:    libproject passwdutil smbsrv libtsnet libpam libbsm libsecdb
 683 passwdutil:     libsldap
 684 pkcs11:         libcryptoutil libgen libuuid
 685 policykit:      libsecdb
 686 print:          libldap5 libmd5 libsendfile
 687 pylibbe:        libbe libzfs
 688 pysolaris:      libsec libidmap
 689 pyzfs:          libzfs
 690 raidcfg_plugins: libraidcfg librcm libcfgadm libpicl libpicltree
 691 rpcsec_gss:     libgss
 692 sasl_plugins:   pkcs11 libgss libsasl
 693 scsi:           libfru libumem libdevid libdevinfo
 694 smbsrv:         libxnet libpthread librt libshare libidmap pkcs11 libsqlite \
 695                 libcryptoutil libreparse libcmdutils libresolv2 libsmbfs \
 696                 libuuid libfakekernel libads libgss libldap5 krb5
 697 storage:        libdevice libdevinfo libdevid
 698 sun_fc:         libdevinfo libsysevent
 699 sun_sas:        libdevinfo libsysevent libkstat libdevid
 700 udapl:          libdevinfo libdladm
 701 
 702 #
 703 # The reason this rule checks for the existence of the
 704 # Makefile is that some of the directories do not exist
 705 # in certain situations (e.g., exportable source builds,
 706 # OpenSolaris).
 707 #
 708 $(SUBDIRS): FRC
 709         @if [ -f $@/Makefile  ]; then \
 710                 cd $@; pwd; $(MAKE) $(TARGET); \
 711         else \
 712                 true; \
 713         fi
 714 
 715 $(SUBDIRS:%=%-nodepend):
 716         @if [ -f $(@:%-nodepend=%)/Makefile  ]; then \
 717                 cd $(@:%-nodepend=%); pwd; $(MAKE) $(TARGET); \
 718         else \
 719                 true; \
 720         fi
 721 
 722 FRC: