xref: /src/sys/contrib/openzfs/lib/Makefile.am (revision 8a62a2a5659d1839d8799b4274c04469d7f17c78)
1# SPDX-License-Identifier: CDDL-1.0
2#
3# Shown below is a simplified dependency graph of the OpenZFS provided
4# libraries.  Administrative commands (`zfs`, `zpool`, etc) interface with
5# the kernel modules using the `libzfs.so` and `libzfs_core.so` libraries.
6# These libraries provide a stable ABI across OpenZFS point releases.
7#
8# The `libzpool.so` library is a user space build of the DMU and SPA layers
9# used to implement debugging tools (zdb) and code validation tools (ztest).
10# These library interfaces are subject to change at any time.
11#
12#
13# CMDS:   zhack/ztest/                zfs/zpool/zed/
14#        raidz_{test,bench}          zinject/zstream
15#                |         \_____          / |
16# LIBS:          |               \        /  |            libzfsbootenv*
17#                |--libzdb--zdb   \      /   |                  |
18#                |           |    |     /    |                  |
19#             libzpool-\     |    |    //-libzfs* --------------+
20#             | |    \  \    |    |   // / | \ \
21#    libicp --/ |     \  \   |    |  // /  |  \ \
22#               |      \ librange_tree /   |   \ \
23#    libzstd ---/       \  libbtree   /    |    \ \--------
24#                        \           /      \    \         \
25#                         \         /        \    \------  |
26#                          \       /          \          \ |
27#                           libzutil       libzfs_core*  | |
28#                            | | | \          |     |    | |
29#                            | | | |          |     |    | |
30#                            | | | |          |     |    | |
31#                            | | | \---- libnvpair* |    | |
32#                            | | |                  |    | |
33#    libefi -----------------/ | \------ libavl* --------/ |
34#                              |                    |      |
35#                              \-------- libspl ----+------/
36#
37#
38# NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries
39# These nine libraries are intermediary build components.
40#
41# * - A stable ABI is provided for these libraries;
42# when performing an ABI check the following options are applied:
43#
44# --no-unreferenced-symbols: Exclude symbols which are not referenced by
45# any debug information.
46#
47# --headers-dir1: Limit ABI checks to public OpenZFS headers, otherwise
48# changes in public system headers are also reported.
49#
50# --suppressions: Honor a suppressions file for each library to provide
51# a mechanism for suppressing harmless warnings.
52#
53
54noinst_LTLIBRARIES =
55lib_LTLIBRARIES =
56pkgconfig_DATA =
57include $(srcdir)/%D%/libavl/Makefile.am
58include $(srcdir)/%D%/libbtree/Makefile.am
59include $(srcdir)/%D%/libicp/Makefile.am
60include $(srcdir)/%D%/libnvpair/Makefile.am
61include $(srcdir)/%D%/librange_tree/Makefile.am
62include $(srcdir)/%D%/libspl/Makefile.am
63include $(srcdir)/%D%/libzdb/Makefile.am
64include $(srcdir)/%D%/libzfs_core/Makefile.am
65include $(srcdir)/%D%/libzfs/Makefile.am
66include $(srcdir)/%D%/libzfsbootenv/Makefile.am
67include $(srcdir)/%D%/libzpool/Makefile.am
68include $(srcdir)/%D%/libzstd/Makefile.am
69include $(srcdir)/%D%/libzutil/Makefile.am
70if BUILD_LINUX
71include $(srcdir)/%D%/libefi/Makefile.am
72endif
73
74
75PHONY += lib
76lib: $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES)
77
78
79PHONY += checkabi storeabi check_libabi_version allow_libabi_only_for_x86_64
80
81check_libabi_version:
82	if [ $$(abidw -v | $(SED) 's/[^0-9]//g') -lt 200 ]; then \
83		printf '%s\n' "" \
84		    "*** Please use libabigail 2.0.0 version or newer;" \
85		    "*** otherwise results are not consistent!" \
86		    "(or see https://github.com/openzfs/libabigail-docker)"; \
87		exit 1; \
88	fi
89
90allow_libabi_only_for_x86_64:
91	echo '*** ABI definitions provided apply only to x86_64:'
92	echo '*** not checking or storing ABI and assuming success.'
93
94if TARGET_CPU_X86_64
95# These should depend on $(lib_LTLIBRARIES), but this breaks on CI when bound into Docker
96checkabi: check_libabi_version
97	err=0; \
98	for lib in $(lib_LTLIBRARIES); do \
99		lib=$${lib%.la}; \
100		[ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \
101		echo $$lib:; \
102		abidiff --no-unreferenced-symbols \
103		    --headers-dir1 include \
104		    --suppressions $(srcdir)/lib/$$lib/$$lib.suppr \
105		    $(srcdir)/lib/$$lib/$$lib.abi .libs/$$lib.so || err=$$((err + 1)); \
106	done; \
107	exit $$err
108
109storeabi: check_libabi_version
110	for lib in $(lib_LTLIBRARIES); do \
111		lib=$${lib%.la}; \
112		[ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \
113		abidw --no-show-locs \
114		    --no-corpus-path \
115		    --no-comp-dir-path \
116		    --type-id-style hash \
117		    .libs/$$lib.so > $(srcdir)/lib/$$lib/$$lib.abi; \
118	done
119else
120checkabi: allow_libabi_only_for_x86_64
121storeabi: allow_libabi_only_for_x86_64
122endif
123