mirror_zfs/lib/Makefile.am
Brian Behlendorf 514498fef6
Simplify and document OpenZFS library dependencies
For those not already familiar with the code base it can be a
challenge to understand how the libraries are laid out.  This
has sometimes resulted in functionality being added in the
wrong place.  To help avoid that in the future this commit
documents the high-level dependencies for easy reference in
lib/Makefile.am.  It also simplifies a few things.

- Switched libzpool dependency on libzfs_core to libzutil.
  This change makes it clear libzpool should never depend
  on the ioctl() functionality provided by libzfs_core.

- Moved zfs_ioctl_fd() from libzutil to libzfs_core and
  renamed it lzc_ioctl_fd().  Normal access to the kmods
  should all be funneled through the libzfs_core library.
  The sole exception is the pool_active() which was updated
  to not use lzc_ioctl_fd() to remove the libzfs_core
  dependency.

- Removed libzfs_core dependency on libzutil.

- Removed the lib/libzfs/os/freebsd/libzfs_ioctl_compat.c
  source file which was all dead code.

- Removed libzfs_core dependency from mkbusy and ctime
  test utilities.  It was only needed for some trivial
  wrapper functions and that code is easy to replicate
  to shed the unneeded dependency.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Don Brady <don.brady@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #12602
2021-10-07 11:31:26 -06:00

83 lines
3.3 KiB
Makefile

#
# Shown below is a simplified dependency graph of the OpenZFS provided
# libraries. Administrative commands (`zfs`, `zpool`, etc) interface with
# the kernel modules using the `libzfs.so` and `libzfs_core.so` libraries.
# These libraries provide a stable ABI across OpenZFS point releases.
#
# The `libzpool.so` library is a user space build of the DMU and SPA layers
# used to implement debugging tools (zdb) and code validation tools (ztest).
# These library interfaces are subject to change at any time.
#
#
# CMDS: zhack/ztest/zdb/ zfs/zpool/zed/
# raidz_{test,bench} zinject/zstream
# | |
# LIBS: | | libzfsbootenv*
# | | |
# | | |
# libzpool libzfs* ----------------+
# | | | \ / | | |
# libicp --/ | | \ / | | \------- libshare
# | | \ / | |
# libzstd ---/ | \ / | \--------- libuutil
# | \ / \ | |
# libunicode --/ \ / \ | |
# \ / \ | |
# libzutil libzfs_core* | |
# | | | | \ | | | |
# | | | | | | | | |
# | | | | | | | | |
# libtpool -------------/ | | | \---- libnvpair* | | |
# | | | | | |
# libefi -----------------/ | \------ libavl* --------/ |
# | | |
# \-------- libspl ----+------/
#
# * - A stable ABI is provided for these libraries
#
#
# NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries
# These nine libraries are intermediary build components.
#
SUBDIRS = libavl libicp libshare libspl libtpool libzstd
CPPCHECKDIRS = libavl libicp libnvpair libshare libspl libtpool libunicode
CPPCHECKDIRS += libuutil libzfs libzfs_core libzfsbootenv libzpool libzutil
if BUILD_LINUX
SUBDIRS += libefi
CPPCHECKDIRS += libefi
endif
# libnvpair is installed as part of the final build product
# libzutil depends on it, so it must be compiled before libzutil
SUBDIRS += libnvpair
# libzutil depends on libefi if present
SUBDIRS += libzutil libunicode
# These five libraries, which are installed as the final build product,
# incorporate the eight convenience libraries given above.
DISTLIBS = libuutil libzfs_core libzfs libzpool libzfsbootenv
SUBDIRS += $(DISTLIBS)
DISTLIBS += libnvpair
# An ABI is stored for each of these libraries. Note that libzpool.so
# is only linked against by ztest and zdb and no stable ABI is provided.
ABILIBS = libnvpair libuutil libzfs_core libzfs libzfsbootenv
PHONY = checkabi storeabi cppcheck
checkabi: $(ABILIBS)
set -e ; for dir in $(ABILIBS) ; do \
$(MAKE) -C $$dir checkabi ; \
done
storeabi: $(ABILIBS)
set -e ; for dir in $(ABILIBS) ; do \
$(MAKE) -C $$dir storeabi ; \
done
cppcheck: $(CPPCHECKDIRS)
set -e ; for dir in $(CPPCHECKDIRS) ; do \
$(MAKE) -C $$dir cppcheck ; \
done