diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml index abc0ff1191..8dafdcf07f 100644 --- a/.github/workflows/checkstyle.yaml +++ b/.github/workflows/checkstyle.yaml @@ -40,11 +40,11 @@ jobs: - name: CheckABI id: CheckABI run: | - docker run -v $(pwd):/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent checkabi + docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent checkabi - name: StoreABI if: failure() && steps.CheckABI.outcome == 'failure' run: | - docker run -v $(pwd):/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent storeabi + docker run -v $PWD:/source ghcr.io/openzfs/libabigail make -j$(nproc) --no-print-directory --silent storeabi - name: Prepare artifacts if: failure() && steps.CheckABI.outcome == 'failure' run: | diff --git a/Makefile.am b/Makefile.am index 8734431da8..24236cfe46 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ include $(top_srcdir)/config/Shellcheck.am +include $(top_srcdir)/config/Rules.am +include $(top_srcdir)/config/CppCheck.am ACLOCAL_AMFLAGS = -I config @@ -7,26 +9,24 @@ if BUILD_LINUX SUBDIRS += rpm endif +EXTRA_DIST = +CPPCHECKDIRS += cmd etc/systemd/system-generators if CONFIG_USER -SUBDIRS += man scripts lib tests cmd etc contrib +SUBDIRS += scripts . man tests cmd etc contrib +include $(srcdir)/%D%/lib/Makefile.am if BUILD_LINUX SUBDIRS += udev endif endif +CPPCHECKDIRS += module if CONFIG_KERNEL SUBDIRS += module extradir = $(prefix)/src/zfs-$(VERSION) extra_HEADERS = zfs.release.in zfs_config.h.in - -if BUILD_LINUX -kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION) -nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS) -endif endif -AUTOMAKE_OPTIONS = foreign -EXTRA_DIST = autogen.sh copy-builtin +EXTRA_DIST += autogen.sh copy-builtin EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am EXTRA_DIST += AUTHORS CODE_OF_CONDUCT.md COPYRIGHT LICENSE META NEWS NOTICE EXTRA_DIST += README.md RELEASES.md @@ -52,7 +52,7 @@ EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip GITREV = include/zfs_gitrev.h -PHONY = gitrev +PHONY += gitrev gitrev: $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV) @@ -117,14 +117,6 @@ filter_executable = -exec test -x '{}' \; -print SHELLCHECKDIRS = cmd contrib etc scripts tests SHELLCHECKSCRIPTS = autogen.sh -PHONY += checkabi storeabi - -checkabi: lib - $(MAKE) -C lib checkabi - -storeabi: lib - $(MAKE) -C lib storeabi - PHONY += mancheck mancheck: ${top_srcdir}/scripts/mancheck.sh ${top_srcdir}/man ${top_srcdir}/tests/test-runner/man @@ -152,17 +144,6 @@ zstdcheck: PHONY += lint lint: cppcheck paxcheck -CPPCHECKDIRS = cmd lib module -PHONY += cppcheck -cppcheck: $(CPPCHECKDIRS) - @if test -n "$(CPPCHECK)"; then \ - set -e ; for dir in $(CPPCHECKDIRS) ; do \ - $(MAKE) -C $$dir cppcheck ; \ - done \ - else \ - echo "skipping cppcheck because cppcheck is not installed"; \ - fi - PHONY += paxcheck paxcheck: @if type scanelf > /dev/null 2>&1; then \ diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 68f1e892d3..fbdeaee625 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,10 +1,12 @@ +PHONY = include $(top_srcdir)/config/Shellcheck.am +include $(top_srcdir)/config/CppCheck.am SUBDIRS = zfs zpool zdb zhack zinject zstream ztest SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path SUBDIRS += zpool_influxdb -CPPCHECKDIRS = zfs zpool zdb zhack zinject zstream ztest +CPPCHECKDIRS += zfs zpool zdb zhack zinject zstream ztest CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb # TODO: #12084: SHELLCHECKDIRS += vdev_id @@ -19,9 +21,3 @@ SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id SHELLCHECKDIRS += zed endif - -PHONY = cppcheck -cppcheck: $(CPPCHECKDIRS) - set -e ; for dir in $(CPPCHECKDIRS) ; do \ - $(MAKE) -C $$dir cppcheck ; \ - done diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am index 3957602d27..a1f902c1ce 100644 --- a/cmd/mount_zfs/Makefile.am +++ b/cmd/mount_zfs/Makefile.am @@ -13,10 +13,11 @@ mount_zfs_SOURCES = \ mount_zfs.c mount_zfs_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la mount_zfs_LDADD += $(LTLIBINTL) include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += mount.zfs diff --git a/cmd/raidz_test/Makefile.am b/cmd/raidz_test/Makefile.am index 983ff25dc9..86ac3cc945 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -1,10 +1,7 @@ include $(top_srcdir)/config/Rules.am -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -# Unconditionally enable ASSERTs -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CFLAGS += $(KERNEL_CFLAGS) +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) bin_PROGRAMS = raidz_test @@ -14,9 +11,10 @@ raidz_test_SOURCES = \ raidz_bench.c raidz_test_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la raidz_test_LDADD += -lm include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += raidz_test diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index c5858c2980..032132bc63 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/config/Rules.am -# Unconditionally enable debugging for zdb -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) sbin_PROGRAMS = zdb @@ -11,8 +10,9 @@ zdb_SOURCES = \ zdb.h zdb_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zdb diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index 7b662994d1..b509516f90 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -40,10 +40,10 @@ FMA_SRC = \ zed_SOURCES = $(ZED_SRC) $(FMA_SRC) zed_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la zed_LDADD += -lrt $(LIBATOMIC_LIBS) $(LIBUDEV_LIBS) $(LIBUUID_LIBS) zed_LDFLAGS = -pthread @@ -51,3 +51,4 @@ zed_LDFLAGS = -pthread EXTRA_DIST = agents/README.md include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zed diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index 1ead457f0f..ca5e823aa4 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -11,10 +11,10 @@ zfs_SOURCES = \ zfs_projectutil.h zfs_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la zfs_LDADD += $(LTLIBINTL) @@ -23,3 +23,4 @@ zfs_LDADD += -lgeom -ljail endif include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zfs diff --git a/cmd/zfs_ids_to_path/Makefile.am b/cmd/zfs_ids_to_path/Makefile.am index 5494267640..c57f1d9778 100644 --- a/cmd/zfs_ids_to_path/Makefile.am +++ b/cmd/zfs_ids_to_path/Makefile.am @@ -6,6 +6,7 @@ zfs_ids_to_path_SOURCES = \ zfs_ids_to_path.c zfs_ids_to_path_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libzfs.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zfs_ids_to_path diff --git a/cmd/zgenhostid/Makefile.am b/cmd/zgenhostid/Makefile.am index 4526a90a1d..96799a5a29 100644 --- a/cmd/zgenhostid/Makefile.am +++ b/cmd/zgenhostid/Makefile.am @@ -5,3 +5,4 @@ sbin_PROGRAMS = zgenhostid zgenhostid_SOURCES = zgenhostid.c include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zgenhostid diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am index 23f03ffd82..fa911e9e3c 100644 --- a/cmd/zhack/Makefile.am +++ b/cmd/zhack/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/config/Rules.am -# Unconditionally enable debugging for zhack -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) sbin_PROGRAMS = zhack @@ -9,8 +8,9 @@ zhack_SOURCES = \ zhack.c zhack_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zhack diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index 40f382c661..94a48f48b0 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -8,8 +8,9 @@ zinject_SOURCES = \ zinject.h zinject_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zinject diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 7ea7c5fc3f..12f2cd2262 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/config/Shellcheck.am AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) -DEFAULT_INCLUDES += -I$(srcdir) +AM_CPPFLAGS += -I$(srcdir) sbin_PROGRAMS = zpool @@ -24,11 +24,11 @@ zpool_SOURCES += os/linux/zpool_vdev_os.c endif zpool_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la \ - $(abs_top_builddir)/lib/libzutil/libzutil.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la \ + $(abs_top_builddir)/libzutil.la zpool_LDADD += $(LTLIBINTL) @@ -38,6 +38,7 @@ endif zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zpool zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolexecdir = $(zfsexecdir)/zpool.d diff --git a/cmd/zpool_influxdb/Makefile.am b/cmd/zpool_influxdb/Makefile.am index a59217570b..600108137d 100644 --- a/cmd/zpool_influxdb/Makefile.am +++ b/cmd/zpool_influxdb/Makefile.am @@ -6,8 +6,9 @@ zpool_influxdb_SOURCES = \ zpool_influxdb.c zpool_influxdb_LDADD = \ - $(top_builddir)/lib/libspl/libspl.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/libspl.la \ + $(top_builddir)/libnvpair.la \ + $(top_builddir)/libzfs.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zpool_influxdb diff --git a/cmd/zstream/Makefile.am b/cmd/zstream/Makefile.am index 8e813027fa..7749e94ba6 100644 --- a/cmd/zstream/Makefile.am +++ b/cmd/zstream/Makefile.am @@ -10,11 +10,12 @@ zstream_SOURCES = \ zstream_token.c zstream_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zstream install-exec-hook: cd $(DESTDIR)$(sbindir) && $(LN_S) -f zstream zstreamdump diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index d5e335e6d2..353e81eb72 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -1,13 +1,11 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(KERNEL_CFLAGS) + # Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 AM_CFLAGS += $(NO_FORMAT_TRUNCATION) -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -# Unconditionally enable ASSERTs -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG +AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) sbin_PROGRAMS = ztest @@ -15,11 +13,12 @@ ztest_SOURCES = \ ztest.c ztest_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la ztest_LDADD += -lm ztest_LDFLAGS = -pthread include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += ztest diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am index bb7e31a059..e51349b8c6 100644 --- a/cmd/zvol_id/Makefile.am +++ b/cmd/zvol_id/Makefile.am @@ -10,3 +10,4 @@ zvol_id_SOURCES = \ zvol_id_main.c include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zvol_id diff --git a/cmd/zvol_wait/Makefile.am b/cmd/zvol_wait/Makefile.am index e8b546a606..2e5bf33233 100644 --- a/cmd/zvol_wait/Makefile.am +++ b/cmd/zvol_wait/Makefile.am @@ -1,4 +1,3 @@ include $(top_srcdir)/config/Shellcheck.am dist_bin_SCRIPTS = zvol_wait - diff --git a/config/Abigail.am b/config/Abigail.am deleted file mode 100644 index d1038f0933..0000000000 --- a/config/Abigail.am +++ /dev/null @@ -1,52 +0,0 @@ -# -# When performing an ABI check the following options are applied: -# -# --no-unreferenced-symbols: Exclude symbols which are not referenced by -# any debug information. Without this _init() and _fini() are incorrectly -# reported on CentOS7 for libuutil.so. -# -# --headers-dir1: Limit ABI checks to public OpenZFS headers, otherwise -# changes in public system headers are also reported. -# -# --suppressions: Honor a suppressions file for each library to provide -# a mechanism for suppressing harmless warnings. -# - -PHONY += checkabi storeabi check_libabi_version allow_libabi_only_for_x86_64 - -check_libabi_version: - libabiversion=`abidw -v | $(SED) 's/[^0-9]//g'`; \ - if test $$libabiversion -lt "200"; then \ - /bin/echo -e "\n" \ - "*** Please use libabigail 2.0.0 version or newer;\n" \ - "*** otherwise results are not consistent!\n" \ - "(or see https://github.com/openzfs/libabigail-docker )\n"; \ - exit 1; \ - fi; - -allow_libabi_only_for_x86_64: - echo '*** ABI definitions provided apply only to x86_64 architecture' - echo '*** Skipping `checkabi`/`storeabi` target and assuming success.' - -if TARGET_CPU_X86_64 -checkabi: check_libabi_version - for lib in $(lib_LTLIBRARIES) ; do \ - abidiff --no-unreferenced-symbols \ - --headers-dir1 ../../include \ - --suppressions $${lib%.la}.suppr \ - $${lib%.la}.abi .libs/$${lib%.la}.so ; \ - done - -storeabi: check_libabi_version - cd .libs ; \ - for lib in $(lib_LTLIBRARIES) ; do \ - abidw --no-show-locs \ - --no-corpus-path \ - --no-comp-dir-path \ - --type-id-style hash \ - $${lib%.la}.so > ../$${lib%.la}.abi ; \ - done -else -checkabi: allow_libabi_only_for_x86_64 -storeabi: allow_libabi_only_for_x86_64 -endif diff --git a/config/CppCheck.am b/config/CppCheck.am index e53013bd01..3fa6bddda8 100644 --- a/config/CppCheck.am +++ b/config/CppCheck.am @@ -7,5 +7,15 @@ PHONY += cppcheck CPPCHECKFLAGS = --std=c99 --quiet --max-configs=1 --error-exitcode=2 CPPCHECKFLAGS += --inline-suppr -U_KERNEL -cppcheck: - $(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(DEFAULT_INCLUDES) $(SOURCES) +CPPCHECKDIRS = +CPPCHECKTARGETS = + +cppcheck-recursive-%: + $(MAKE) -C $(subst ^,/,$(subst cppcheck-recursive-,,$@)) cppcheck + +_CTGT = $(subst -,_,$(subst .,_,$(subst cppcheck-for-,,$@))) +cppcheck-for-%: + @[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)$(nodist_$(_CTGT)_SOURCES)" ] + $(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES) $(nodist_$(_CTGT)_SOURCES) + +cppcheck: $(addprefix cppcheck-for-,$(CPPCHECKTARGETS)) $(addprefix cppcheck-recursive-,$(subst /,^,$(CPPCHECKDIRS))) diff --git a/config/Rules.am b/config/Rules.am index e483b9ef80..07e72d33fd 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -4,22 +4,13 @@ # PHONY = -DEFAULT_INCLUDES = \ +AM_CPPFLAGS = \ -include $(top_builddir)/zfs_config.h \ -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/module/icp/include \ - -I$(top_srcdir)/lib/libspl/include - -if BUILD_LINUX -DEFAULT_INCLUDES += \ - -I$(top_srcdir)/lib/libspl/include/os/linux -endif - -if BUILD_FREEBSD -DEFAULT_INCLUDES += \ - -I$(top_srcdir)/lib/libspl/include/os/freebsd -endif + -I$(top_srcdir)/lib/libspl/include \ + -I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@ AM_LIBTOOLFLAGS = --silent @@ -37,7 +28,7 @@ AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h AM_CFLAGS += -I/usr/include -I/usr/local/include endif -AM_CPPFLAGS = -D_GNU_SOURCE +AM_CPPFLAGS += -D_GNU_SOURCE AM_CPPFLAGS += -D_REENTRANT AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64 AM_CPPFLAGS += -D_LARGEFILE64_SOURCE @@ -48,23 +39,20 @@ AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\" AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\" AM_CPPFLAGS += $(DEBUG_CPPFLAGS) AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) -if BUILD_LINUX -AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\" -endif -if BUILD_FREEBSD -AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\" -endif -AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))" -AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" -AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" -AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))" -AM_CPPFLAGS += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)" -AM_CPPFLAGS += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)" -AM_CPPFLAGS += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)" -AM_CPPFLAGS += -D"asctime(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime(__VA_ARGS__)" -AM_CPPFLAGS += -D"asctime_r(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime_r(__VA_ARGS__)" -AM_CPPFLAGS += -D"gmtime(...)=__attribute__((deprecated(\"gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!\"))) gmtime(__VA_ARGS__)" -AM_CPPFLAGS += -D"localtime(...)=__attribute__((deprecated(\"localtime(3) isn't thread-safe. Use localtime_r(3) instead!\"))) localtime(__VA_ARGS__)" +AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\" + +AM_CPPFLAGS_NOCHECK = -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))" +AM_CPPFLAGS_NOCHECK += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"asctime(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"asctime_r(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime_r(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"gmtime(...)=__attribute__((deprecated(\"gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!\"))) gmtime(__VA_ARGS__)" +AM_CPPFLAGS_NOCHECK += -D"localtime(...)=__attribute__((deprecated(\"localtime(3) isn't thread-safe. Use localtime_r(3) instead!\"))) localtime(__VA_ARGS__)" +AM_CPPFLAGS += $(AM_CPPFLAGS_NOCHECK) if ASAN_ENABLED AM_CPPFLAGS += -DZFS_ASAN_ENABLED @@ -83,3 +71,13 @@ AM_LDFLAGS += -fstack-protector-strong -shared AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel AM_LDFLAGS += -lm endif + + +# If a target includes kernel code, generate warnings for large stack frames +KERNEL_CFLAGS = $(FRAME_LARGER_THAN) + +# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 +LIBRARY_CFLAGS = -no-suppress + +# Forcibly enable asserts/debugging for libzpool &al. +FORCEDEBUG_CPPFLAGS = -DDEBUG -UNDEBUG -DZFS_DEBUG diff --git a/config/always-cppcheck.m4 b/config/always-cppcheck.m4 index c7c134a3e8..fa5a3398d9 100644 --- a/config/always-cppcheck.m4 +++ b/config/always-cppcheck.m4 @@ -3,4 +3,7 @@ dnl # Check if cppcheck is available. dnl # AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CPPCHECK], [ AC_CHECK_PROG([CPPCHECK], [cppcheck], [cppcheck]) + if test -z "$CPPCHECK"; then + CPPCHECK='@printf "skipping cppcheck because cppcheck is not installed\n"' + fi ]) diff --git a/config/always-system.m4 b/config/always-system.m4 index 3225a52af8..3a3d4212f8 100644 --- a/config/always-system.m4 +++ b/config/always-system.m4 @@ -8,18 +8,22 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SYSTEM], [ AC_DEFINE([SYSTEM_LINUX], [1], [True if ZFS is to be compiled for a Linux system]) ac_system="Linux" + ac_system_l="linux" ;; *freebsd*) AC_DEFINE([SYSTEM_FREEBSD], [1], [True if ZFS is to be compiled for a FreeBSD system]) ac_system="FreeBSD" + ac_system_l="freebsd" ;; *) ac_system="unknown" + ac_system_l="unknown" ;; esac AC_MSG_RESULT([$ac_system]) AC_SUBST([ac_system]) + AC_SUBST([ac_system_l]) AM_CONDITIONAL([BUILD_LINUX], [test "x$ac_system" = "xLinux"]) AM_CONDITIONAL([BUILD_FREEBSD], [test "x$ac_system" = "xFreeBSD"]) diff --git a/configure.ac b/configure.ac index 26cdc8c67f..981215995b 100644 --- a/configure.ac +++ b/configure.ac @@ -30,8 +30,8 @@ * CDDL HEADER END */ -AC_INIT(m4_esyscmd(grep ^Name: META | cut -d ':' -f 2 | tr -d ' \n'), - m4_esyscmd(grep ^Version: META | cut -d ':' -f 2 | tr -d ' \n')) +AC_INIT(m4_esyscmd(awk '/^Name:/ {printf $2}' META), + m4_esyscmd(awk '/^Version:/ {printf $2}' META)) AC_LANG(C) ZFS_AC_META AC_CONFIG_AUX_DIR([config]) @@ -39,7 +39,7 @@ AC_CONFIG_MACRO_DIR([config]) AC_CANONICAL_TARGET AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_INIT_AUTOMAKE([subdir-objects]) +AM_INIT_AUTOMAKE([subdir-objects foreign]) AC_CONFIG_HEADERS([zfs_config.h], [ (mv zfs_config.h zfs_config.h.tmp && awk -f ${ac_srcdir}/config/config.awk zfs_config.h.tmp >zfs_config.h && @@ -139,34 +139,9 @@ AC_CONFIG_FILES([ include/sys/lua/Makefile include/sys/sysevent/Makefile include/sys/zstd/Makefile - lib/Makefile - lib/libavl/Makefile - lib/libefi/Makefile - lib/libicp/Makefile - lib/libnvpair/Makefile - lib/libshare/Makefile - lib/libspl/Makefile - lib/libspl/include/Makefile - lib/libspl/include/os/Makefile - lib/libspl/include/os/freebsd/Makefile - lib/libspl/include/os/freebsd/sys/Makefile - lib/libspl/include/os/linux/Makefile - lib/libspl/include/os/linux/sys/Makefile - lib/libspl/include/rpc/Makefile - lib/libspl/include/sys/Makefile - lib/libspl/include/sys/dktp/Makefile - lib/libtpool/Makefile - lib/libunicode/Makefile - lib/libuutil/Makefile - lib/libzfs/Makefile lib/libzfs/libzfs.pc - lib/libzfsbootenv/Makefile lib/libzfsbootenv/libzfsbootenv.pc - lib/libzfs_core/Makefile lib/libzfs_core/libzfs_core.pc - lib/libzpool/Makefile - lib/libzstd/Makefile - lib/libzutil/Makefile man/Makefile module/Kbuild module/Makefile diff --git a/contrib/pam_zfs_key/Makefile.am b/contrib/pam_zfs_key/Makefile.am index f0f2550afc..bcb60b71ce 100644 --- a/contrib/pam_zfs_key/Makefile.am +++ b/contrib/pam_zfs_key/Makefile.am @@ -2,15 +2,15 @@ include $(top_srcdir)/config/Rules.am AM_CFLAGS += $(LIBCRYPTO_CFLAGS) -pammodule_LTLIBRARIES=pam_zfs_key.la +pammodule_LTLIBRARIES = pam_zfs_key.la pam_zfs_key_la_SOURCES = pam_zfs_key.c pam_zfs_key_la_LIBADD = \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libuutil.la \ + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libzfs_core.la pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared diff --git a/etc/systemd/Makefile.am b/etc/systemd/Makefile.am index 66232a5ff1..7b47b93fc1 100644 --- a/etc/systemd/Makefile.am +++ b/etc/systemd/Makefile.am @@ -1,4 +1 @@ -include $(top_srcdir)/config/Shellcheck.am - SUBDIRS = system system-generators -SHELLCHECKDIRS = system-generators diff --git a/etc/systemd/system-generators/Makefile.am b/etc/systemd/system-generators/Makefile.am index e5920bf392..ee51d1c75e 100644 --- a/etc/systemd/system-generators/Makefile.am +++ b/etc/systemd/system-generators/Makefile.am @@ -7,8 +7,9 @@ zfs_mount_generator_SOURCES = \ zfs-mount-generator.c zfs_mount_generator_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libzfs.la zfs_mount_generator_LDFLAGS = -pthread include $(top_srcdir)/config/CppCheck.am +CPPCHECKTARGETS += zfs-mount-generator diff --git a/lib/Makefile.am b/lib/Makefile.am index f07975cc03..499ebdaeba 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -33,50 +33,91 @@ # | | | # \-------- 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 +# * - A stable ABI is provided for these libraries; +# when performing an ABI check the following options are applied: +# +# --no-unreferenced-symbols: Exclude symbols which are not referenced by +# any debug information. Without this _init() and _fini() are incorrectly +# reported on CentOS7 for libuutil.so. +# +# --headers-dir1: Limit ABI checks to public OpenZFS headers, otherwise +# changes in public system headers are also reported. +# +# --suppressions: Honor a suppressions file for each library to provide +# a mechanism for suppressing harmless warnings. +# +noinst_LTLIBRARIES = +lib_LTLIBRARIES = +pkgconfig_DATA = +include $(srcdir)/%D%/libavl/Makefile.am +include $(srcdir)/%D%/libicp/Makefile.am +include $(srcdir)/%D%/libnvpair/Makefile.am +include $(srcdir)/%D%/libshare/Makefile.am +include $(srcdir)/%D%/libspl/Makefile.am +include $(srcdir)/%D%/libtpool/Makefile.am +include $(srcdir)/%D%/libunicode/Makefile.am +include $(srcdir)/%D%/libuutil/Makefile.am +include $(srcdir)/%D%/libzfs_core/Makefile.am +include $(srcdir)/%D%/libzfs/Makefile.am +include $(srcdir)/%D%/libzfsbootenv/Makefile.am +include $(srcdir)/%D%/libzpool/Makefile.am +include $(srcdir)/%D%/libzstd/Makefile.am +include $(srcdir)/%D%/libzutil/Makefile.am if BUILD_LINUX -SUBDIRS += libefi -CPPCHECKDIRS += libefi +include $(srcdir)/%D%/libefi/Makefile.am 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 +PHONY += lib +lib: $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES) -# 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 check_libabi_version allow_libabi_only_for_x86_64 -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 ; \ +check_libabi_version: + if [ $$(abidw -v | $(SED) 's/[^0-9]//g') -lt 200 ]; then \ + printf '%s\n' "" \ + "*** Please use libabigail 2.0.0 version or newer;" \ + "*** otherwise results are not consistent!" \ + "(or see https://github.com/openzfs/libabigail-docker)"; \ + exit 1; \ + fi + +allow_libabi_only_for_x86_64: + echo '*** ABI definitions provided apply only to x86_64:' + echo '*** not checking or storing ABI and assuming success.' + +if TARGET_CPU_X86_64 +# These should depend on $(lib_LTLIBRARIES), but this breaks on CI when bound into Docker +checkabi: check_libabi_version + err=0; \ + for lib in $(lib_LTLIBRARIES); do \ + lib=$${lib%.la}; \ + [ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \ + echo $$lib:; \ + abidiff --no-unreferenced-symbols \ + --headers-dir1 include \ + --suppressions $(srcdir)/lib/$$lib/$$lib.suppr \ + $(srcdir)/lib/$$lib/$$lib.abi .libs/$$lib.so || err=$$((err + 1)); \ + done; \ + exit $$err + +storeabi: check_libabi_version + for lib in $(lib_LTLIBRARIES); do \ + lib=$${lib%.la}; \ + [ -f $(srcdir)/lib/$$lib/$$lib.suppr ] || continue; \ + abidw --no-show-locs \ + --no-corpus-path \ + --no-comp-dir-path \ + --type-id-style hash \ + .libs/$$lib.so > $(srcdir)/lib/$$lib/$$lib.abi; \ done +else +checkabi: allow_libabi_only_for_x86_64 +storeabi: allow_libabi_only_for_x86_64 +endif diff --git a/lib/libavl/Makefile.am b/lib/libavl/Makefile.am index 3902190d1a..5eaf4c0872 100644 --- a/lib/libavl/Makefile.am +++ b/lib/libavl/Makefile.am @@ -1,19 +1,8 @@ -include $(top_srcdir)/config/Rules.am +libavl_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) +libavl_la_CFLAGS += -fvisibility=hidden -VPATH = $(top_srcdir)/module/avl/ - -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libavl.la - -KERNEL_C = \ - avl.c +noinst_LTLIBRARIES += libavl.la +CPPCHECKTARGETS += libavl.la nodist_libavl_la_SOURCES = \ - $(KERNEL_C) - -include $(top_srcdir)/config/CppCheck.am + module/avl/avl.c diff --git a/lib/libefi/Makefile.am b/lib/libefi/Makefile.am index f42b9d1a76..5c3e57346c 100644 --- a/lib/libefi/Makefile.am +++ b/lib/libefi/Makefile.am @@ -1,17 +1,11 @@ -include $(top_srcdir)/config/Rules.am +libefi_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libefi_la_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS) +libefi_la_CFLAGS += -fvisibility=hidden -AM_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +noinst_LTLIBRARIES += libefi.la +CPPCHECKTARGETS += libefi.la -noinst_LTLIBRARIES = libefi.la - -USER_C = \ - rdwr_efi.c - -libefi_la_SOURCES = $(USER_C) +libefi_la_SOURCES = \ + %D%/rdwr_efi.c libefi_la_LIBADD = $(LIBUUID_LIBS) $(ZLIB_LIBS) - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libicp/Makefile.am b/lib/libicp/Makefile.am index d81205fd27..00bfc5c36a 100644 --- a/lib/libicp/Makefile.am +++ b/lib/libicp/Makefile.am @@ -1,69 +1,51 @@ -include $(top_srcdir)/config/Rules.am +libicp_la_CCASFLAGS = $(AM_CCASFLAGS) +libicp_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) -VPATH = \ - $(top_srcdir)/module/icp \ - $(top_srcdir)/lib/libicp - -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libicp.la - -if TARGET_CPU_X86_64 -ASM_SOURCES_C = asm-x86_64/aes/aeskey.c -ASM_SOURCES_AS = \ - asm-x86_64/aes/aes_amd64.S \ - asm-x86_64/aes/aes_aesni.S \ - asm-x86_64/modes/gcm_pclmulqdq.S \ - asm-x86_64/modes/aesni-gcm-x86_64.S \ - asm-x86_64/modes/ghash-x86_64.S \ - asm-x86_64/sha2/sha256_impl.S \ - asm-x86_64/sha2/sha512_impl.S -else -ASM_SOURCES_C = -ASM_SOURCES_AS = -endif - -KERNEL_C = \ - spi/kcf_spi.c \ - api/kcf_ctxops.c \ - api/kcf_cipher.c \ - api/kcf_mac.c \ - algs/aes/aes_impl_aesni.c \ - algs/aes/aes_impl_generic.c \ - algs/aes/aes_impl_x86-64.c \ - algs/aes/aes_impl.c \ - algs/aes/aes_modes.c \ - algs/edonr/edonr.c \ - algs/modes/modes.c \ - algs/modes/cbc.c \ - algs/modes/gcm_generic.c \ - algs/modes/gcm_pclmulqdq.c \ - algs/modes/gcm.c \ - algs/modes/ctr.c \ - algs/modes/ccm.c \ - algs/modes/ecb.c \ - algs/sha2/sha2.c \ - algs/skein/skein.c \ - algs/skein/skein_block.c \ - algs/skein/skein_iv.c \ - illumos-crypto.c \ - io/aes.c \ - io/sha2_mod.c \ - io/skein_mod.c \ - core/kcf_sched.c \ - core/kcf_prov_lib.c \ - core/kcf_callprov.c \ - core/kcf_mech_tabs.c \ - core/kcf_prov_tabs.c \ - $(ASM_SOURCES_C) - -KERNEL_ASM = $(ASM_SOURCES_AS) +noinst_LTLIBRARIES += libicp.la +CPPCHECKTARGETS += libicp.la nodist_libicp_la_SOURCES = \ - $(KERNEL_C) \ - $(KERNEL_ASM) + module/icp/spi/kcf_spi.c \ + module/icp/api/kcf_ctxops.c \ + module/icp/api/kcf_cipher.c \ + module/icp/api/kcf_mac.c \ + module/icp/algs/aes/aes_impl_aesni.c \ + module/icp/algs/aes/aes_impl_generic.c \ + module/icp/algs/aes/aes_impl_x86-64.c \ + module/icp/algs/aes/aes_impl.c \ + module/icp/algs/aes/aes_modes.c \ + module/icp/algs/edonr/edonr.c \ + module/icp/algs/modes/modes.c \ + module/icp/algs/modes/cbc.c \ + module/icp/algs/modes/gcm_generic.c \ + module/icp/algs/modes/gcm_pclmulqdq.c \ + module/icp/algs/modes/gcm.c \ + module/icp/algs/modes/ctr.c \ + module/icp/algs/modes/ccm.c \ + module/icp/algs/modes/ecb.c \ + module/icp/algs/sha2/sha2.c \ + module/icp/algs/skein/skein.c \ + module/icp/algs/skein/skein_block.c \ + module/icp/algs/skein/skein_iv.c \ + module/icp/illumos-crypto.c \ + module/icp/io/aes.c \ + module/icp/io/sha2_mod.c \ + module/icp/io/skein_mod.c \ + module/icp/core/kcf_sched.c \ + module/icp/core/kcf_prov_lib.c \ + module/icp/core/kcf_callprov.c \ + module/icp/core/kcf_mech_tabs.c \ + module/icp/core/kcf_prov_tabs.c -include $(top_srcdir)/config/CppCheck.am +if TARGET_CPU_X86_64 +nodist_libicp_la_SOURCES += \ + module/icp/asm-x86_64/aes/aeskey.c +nodist_libicp_la_SOURCES += \ + module/icp/asm-x86_64/aes/aes_amd64.S \ + module/icp/asm-x86_64/aes/aes_aesni.S \ + module/icp/asm-x86_64/modes/gcm_pclmulqdq.S \ + module/icp/asm-x86_64/modes/aesni-gcm-x86_64.S \ + module/icp/asm-x86_64/modes/ghash-x86_64.S \ + module/icp/asm-x86_64/sha2/sha256_impl.S \ + module/icp/asm-x86_64/sha2/sha512_impl.S +endif diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index 021859e148..6d9345f528 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -1,42 +1,26 @@ -include $(top_srcdir)/config/Rules.am - -VPATH = \ - $(top_srcdir)/module/nvpair \ - $(top_srcdir)/lib/libnvpair - -# Includes kernel code, generate warnings for large stack frames -# and required CFLAGS for libtirpc -AM_CFLAGS += $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +libnvpair_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) +libnvpair_la_CFLAGS += $(LIBTIRPC_CFLAGS) +libnvpair_la_CFLAGS += -fvisibility=hidden # wchar_t is undefined-signedness, but we compare to >=0; this warns with unsigned wchar_t -libnvpair_json.$(OBJEXT): CFLAGS += -Wno-type-limits -libnvpair_json.l$(OBJEXT): CFLAGS += -Wno-type-limits +%D%/libnvpair_la-libnvpair_json.$(OBJEXT) : CFLAGS += -Wno-type-limits +%D%/libnvpair_la-libnvpair_json.l$(OBJEXT): CFLAGS += -Wno-type-limits -lib_LTLIBRARIES = libnvpair.la - -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - libnvpair.c \ - libnvpair_json.c \ - nvpair_alloc_system.c - -KERNEL_C = \ - nvpair_alloc_fixed.c \ - nvpair.c \ - fnvpair.c +lib_LTLIBRARIES += libnvpair.la +CPPCHECKTARGETS += libnvpair.la dist_libnvpair_la_SOURCES = \ - $(USER_C) + %D%/libnvpair.c \ + %D%/libnvpair_json.c \ + %D%/nvpair_alloc_system.c nodist_libnvpair_la_SOURCES = \ - $(KERNEL_C) + module/nvpair/nvpair_alloc_fixed.c \ + module/nvpair/nvpair.c \ + module/nvpair/fnvpair.c libnvpair_la_LIBADD = \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + libspl_assert.la libnvpair_la_LIBADD += $(LIBTIRPC_LIBS) $(LTLIBINTL) @@ -48,7 +32,4 @@ endif libnvpair_la_LDFLAGS += -version-info 3:0:0 -include $(top_srcdir)/config/CppCheck.am - -# Library ABI -EXTRA_DIST = libnvpair.abi libnvpair.suppr +EXTRA_DIST += $(addprefix %D%/,libnvpair.abi libnvpair.suppr) diff --git a/lib/libshare/Makefile.am b/lib/libshare/Makefile.am index 1527c70ba1..48d8cb8324 100644 --- a/lib/libshare/Makefile.am +++ b/lib/libshare/Makefile.am @@ -1,32 +1,27 @@ -include $(top_srcdir)/config/Rules.am +libshare_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libshare_la_CFLAGS += -fvisibility=hidden -DEFAULT_INCLUDES += -I$(srcdir) +libshare_la_CPPFLAGS = $(AM_CPPFLAGS) +libshare_la_CPPFLAGS += -I$(srcdir)/%D% -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +noinst_LTLIBRARIES += libshare.la +CPPCHECKTARGETS += libshare.la -noinst_LTLIBRARIES = libshare.la - -USER_C = \ - libshare_impl.h \ - libshare.c \ - nfs.c \ - nfs.h \ - smb.h +libshare_la_SOURCES = \ + %D%/libshare_impl.h \ + %D%/libshare.c \ + %D%/nfs.c \ + %D%/nfs.h \ + %D%/smb.h if BUILD_LINUX -USER_C += \ - os/linux/nfs.c \ - os/linux/smb.c +libshare_la_SOURCES += \ + %D%/os/linux/nfs.c \ + %D%/os/linux/smb.c endif if BUILD_FREEBSD -USER_C += \ - os/freebsd/nfs.c \ - os/freebsd/smb.c +libshare_la_SOURCES += \ + %D%/os/freebsd/nfs.c \ + %D%/os/freebsd/smb.c endif - -libshare_la_SOURCES = $(USER_C) - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am index c62554b14f..822bef7e7a 100644 --- a/lib/libspl/Makefile.am +++ b/lib/libspl/Makefile.am @@ -1,50 +1,45 @@ -include $(top_srcdir)/config/Rules.am +include $(srcdir)/%D%/include/Makefile.am -SUBDIRS = include +libspl_assert_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libspl_la_CFLAGS = $(libspl_assert_la_CFLAGS) -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libspl_assert.la libspl.la +noinst_LTLIBRARIES += libspl_assert.la libspl.la +CPPCHECKTARGETS += libspl_assert.la libspl.la libspl_assert_la_SOURCES = \ - assert.c + %D%/assert.c -USER_C = \ - libspl_impl.h \ - atomic.c \ - getexecname.c \ - list.c \ - mkdirp.c \ - page.c \ - strlcat.c \ - strlcpy.c \ - timestamp.c \ - include/sys/list.h \ - include/sys/list_impl.h +libspl_la_SOURCES = \ + %D%/libspl_impl.h \ + %D%/atomic.c \ + %D%/getexecname.c \ + %D%/list.c \ + %D%/mkdirp.c \ + %D%/page.c \ + %D%/strlcat.c \ + %D%/strlcpy.c \ + %D%/timestamp.c \ + %D%/include/sys/list.h \ + %D%/include/sys/list_impl.h if BUILD_LINUX -USER_C += \ - os/linux/getexecname.c \ - os/linux/gethostid.c \ - os/linux/getmntany.c \ - os/linux/zone.c +libspl_la_SOURCES += \ + %D%/os/linux/getexecname.c \ + %D%/os/linux/gethostid.c \ + %D%/os/linux/getmntany.c \ + %D%/os/linux/zone.c endif if BUILD_FREEBSD -USER_C += \ - os/freebsd/getexecname.c \ - os/freebsd/gethostid.c \ - os/freebsd/getmntany.c \ - os/freebsd/mnttab.c \ - os/freebsd/zone.c +libspl_la_SOURCES += \ + %D%/os/freebsd/getexecname.c \ + %D%/os/freebsd/gethostid.c \ + %D%/os/freebsd/getmntany.c \ + %D%/os/freebsd/mnttab.c \ + %D%/os/freebsd/zone.c endif -libspl_la_SOURCES = $(USER_C) - libspl_la_LIBADD = \ libspl_assert.la libspl_la_LIBADD += $(LIBATOMIC_LIBS) $(LIBCLOCK_GETTIME) - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index 601fbb77f6..e995ddf66b 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -1,22 +1,108 @@ -SUBDIRS = rpc sys os - libspldir = $(includedir)/libspl libspl_HEADERS = \ - assert.h \ - atomic.h \ - libdevinfo.h \ - libgen.h \ - libshare.h \ - limits.h \ - locale.h \ - statcommon.h \ - stdio.h \ - stdlib.h \ - string.h \ - stropts.h \ - thread.h \ - tzfile.h \ - ucred.h \ - umem.h \ - unistd.h \ - zone.h + %D%/assert.h \ + %D%/atomic.h \ + %D%/libdevinfo.h \ + %D%/libgen.h \ + %D%/libshare.h \ + %D%/limits.h \ + %D%/locale.h \ + %D%/statcommon.h \ + %D%/stdio.h \ + %D%/stdlib.h \ + %D%/string.h \ + %D%/stropts.h \ + %D%/thread.h \ + %D%/tzfile.h \ + %D%/ucred.h \ + %D%/umem.h \ + %D%/unistd.h \ + %D%/zone.h + +if BUILD_FREEBSD +libspl_HEADERS += \ + %D%/os/freebsd/fcntl.h +endif + + +libspl_rpcdir = $(libspldir)/rpc +libspl_rpc_HEADERS = \ + %D%/rpc/xdr.h + + +libspl_sysdir = $(libspldir)/sys +libspl_sys_HEADERS = \ + %D%/sys/acl.h \ + %D%/sys/acl_impl.h \ + %D%/sys/callb.h \ + %D%/sys/cmn_err.h \ + %D%/sys/cred.h \ + %D%/sys/debug.h \ + %D%/sys/dkio.h \ + %D%/sys/dklabel.h \ + %D%/sys/feature_tests.h \ + %D%/sys/int_limits.h \ + %D%/sys/int_types.h \ + %D%/sys/inttypes.h \ + %D%/sys/isa_defs.h \ + %D%/sys/kmem.h \ + %D%/sys/kstat.h \ + %D%/sys/list.h \ + %D%/sys/list_impl.h \ + %D%/sys/mhd.h \ + %D%/sys/mkdev.h \ + %D%/sys/policy.h \ + %D%/sys/poll.h \ + %D%/sys/priv.h \ + %D%/sys/processor.h \ + %D%/sys/sha2.h \ + %D%/sys/simd.h \ + %D%/sys/stack.h \ + %D%/sys/stdtypes.h \ + %D%/sys/string.h \ + %D%/sys/stropts.h \ + %D%/sys/sunddi.h \ + %D%/sys/systeminfo.h \ + %D%/sys/time.h \ + %D%/sys/trace_spl.h \ + %D%/sys/trace_zfs.h \ + %D%/sys/types.h \ + %D%/sys/types32.h \ + %D%/sys/tzfile.h \ + %D%/sys/uio.h \ + %D%/sys/va_list.h \ + %D%/sys/varargs.h \ + %D%/sys/vnode.h \ + %D%/sys/wmsum.h \ + %D%/sys/zone.h + +if BUILD_LINUX +libspl_sys_HEADERS += \ + %D%/os/linux/sys/byteorder.h \ + %D%/os/linux/sys/errno.h \ + %D%/os/linux/sys/mnttab.h \ + %D%/os/linux/sys/mount.h \ + %D%/os/linux/sys/param.h \ + %D%/os/linux/sys/stat.h \ + %D%/os/linux/sys/sysmacros.h \ + %D%/os/linux/sys/zfs_context_os.h +endif + +if BUILD_FREEBSD +libspl_sys_HEADERS += \ + %D%/os/freebsd/sys/byteorder.h \ + %D%/os/freebsd/sys/fcntl.h \ + %D%/os/freebsd/sys/file.h \ + %D%/os/freebsd/sys/mnttab.h \ + %D%/os/freebsd/sys/mount.h \ + %D%/os/freebsd/sys/param.h \ + %D%/os/freebsd/sys/stat.h \ + %D%/os/freebsd/sys/sysmacros.h \ + %D%/os/freebsd/sys/vfs.h \ + %D%/os/freebsd/sys/zfs_context_os.h +endif + + +libspl_sys_dktpdir = $(libspl_sysdir)/dktp +libspl_sys_dktp_HEADERS = \ + %D%/sys/dktp/fdisk.h diff --git a/lib/libspl/include/os/Makefile.am b/lib/libspl/include/os/Makefile.am deleted file mode 100644 index 7b362e02ad..0000000000 --- a/lib/libspl/include/os/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -if BUILD_FREEBSD -SUBDIRS = freebsd -endif - -if BUILD_LINUX -SUBDIRS = linux -endif diff --git a/lib/libspl/include/os/freebsd/Makefile.am b/lib/libspl/include/os/freebsd/Makefile.am deleted file mode 100644 index f06325ee3e..0000000000 --- a/lib/libspl/include/os/freebsd/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = sys - -libspldir = $(includedir)/libspl -libspl_HEADERS = \ - fcntl.h diff --git a/lib/libspl/include/os/freebsd/sys/Makefile.am b/lib/libspl/include/os/freebsd/sys/Makefile.am deleted file mode 100644 index 7a85460807..0000000000 --- a/lib/libspl/include/os/freebsd/sys/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -libspldir = $(includedir)/libspl/sys -libspl_HEADERS = \ - byteorder.h \ - fcntl.h \ - file.h \ - mnttab.h \ - mount.h \ - param.h \ - stat.h \ - sysmacros.h \ - vfs.h \ - zfs_context_os.h diff --git a/lib/libspl/include/os/linux/Makefile.am b/lib/libspl/include/os/linux/Makefile.am deleted file mode 100644 index 081839c48c..0000000000 --- a/lib/libspl/include/os/linux/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = sys diff --git a/lib/libspl/include/os/linux/sys/Makefile.am b/lib/libspl/include/os/linux/sys/Makefile.am deleted file mode 100644 index 1ec07a76d3..0000000000 --- a/lib/libspl/include/os/linux/sys/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -libspldir = $(includedir)/libspl/sys -libspl_HEADERS = \ - byteorder.h \ - errno.h \ - mnttab.h \ - mount.h \ - param.h \ - stat.h \ - sysmacros.h \ - zfs_context_os.h diff --git a/lib/libspl/include/rpc/Makefile.am b/lib/libspl/include/rpc/Makefile.am deleted file mode 100644 index 7fe1d7fea4..0000000000 --- a/lib/libspl/include/rpc/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -libspldir = $(includedir)/libspl/rpc -libspl_HEADERS = \ - xdr.h diff --git a/lib/libspl/include/sys/Makefile.am b/lib/libspl/include/sys/Makefile.am deleted file mode 100644 index 4315470b59..0000000000 --- a/lib/libspl/include/sys/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -SUBDIRS = dktp - -libspldir = $(includedir)/libspl/sys -libspl_HEADERS = \ - acl.h \ - acl_impl.h \ - callb.h \ - cmn_err.h \ - cred.h \ - debug.h \ - dkio.h \ - dklabel.h \ - feature_tests.h \ - int_limits.h \ - int_types.h \ - inttypes.h \ - isa_defs.h \ - kmem.h \ - kstat.h \ - list.h \ - list_impl.h \ - mhd.h \ - mkdev.h \ - policy.h \ - poll.h \ - priv.h \ - processor.h \ - sha2.h \ - simd.h \ - stack.h \ - stdtypes.h \ - string.h \ - stropts.h \ - sunddi.h \ - systeminfo.h \ - time.h \ - trace_spl.h \ - trace_zfs.h \ - types32.h \ - types.h \ - tzfile.h \ - uio.h \ - va_list.h \ - varargs.h \ - vnode.h \ - wmsum.h \ - zone.h diff --git a/lib/libspl/include/sys/dktp/Makefile.am b/lib/libspl/include/sys/dktp/Makefile.am deleted file mode 100644 index 4ad3695d8a..0000000000 --- a/lib/libspl/include/sys/dktp/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -libspldir = $(includedir)/libspl/sys/dktp -libspl_HEADERS = \ - fdisk.h - diff --git a/lib/libtpool/Makefile.am b/lib/libtpool/Makefile.am index b66f72eeb4..5a2b8a5701 100644 --- a/lib/libtpool/Makefile.am +++ b/lib/libtpool/Makefile.am @@ -1,19 +1,11 @@ -include $(top_srcdir)/config/Rules.am - -AM_CFLAGS += -fvisibility=hidden - +libtpool_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libtpool_la_CFLAGS += -fvisibility=hidden # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61118 -AM_CFLAGS += $(NO_CLOBBERED) +libtpool_la_CFLAGS += $(NO_CLOBBERED) -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +noinst_LTLIBRARIES += libtpool.la +CPPCHECKTARGETS += libtpool.la -noinst_LTLIBRARIES = libtpool.la - -USER_C = \ - thread_pool.c \ - thread_pool_impl.h - -libtpool_la_SOURCES = $(USER_C) - -include $(top_srcdir)/config/CppCheck.am +libtpool_la_SOURCES = \ + %D%/thread_pool.c \ + %D%/thread_pool_impl.h diff --git a/lib/libunicode/Makefile.am b/lib/libunicode/Makefile.am index 5b12b3e916..82fee01013 100644 --- a/lib/libunicode/Makefile.am +++ b/lib/libunicode/Makefile.am @@ -1,20 +1,8 @@ -include $(top_srcdir)/config/Rules.am +libunicode_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) -VPATH = $(top_srcdir)/module/unicode - -# Includes kernel code, generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -noinst_LTLIBRARIES = libunicode.la - -KERNEL_C = \ - u8_textprep.c \ - uconv.c +noinst_LTLIBRARIES += libunicode.la +CPPCHECKTARGETS += libunicode.la nodist_libunicode_la_SOURCES = \ - $(KERNEL_C) - -include $(top_srcdir)/config/CppCheck.am + module/unicode/u8_textprep.c \ + module/unicode/uconv.c diff --git a/lib/libuutil/Makefile.am b/lib/libuutil/Makefile.am index 6678a90b59..cb89d423dc 100644 --- a/lib/libuutil/Makefile.am +++ b/lib/libuutil/Makefile.am @@ -1,26 +1,20 @@ -include $(top_srcdir)/config/Rules.am +libuutil_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) $(LIBRARY_CFLAGS) -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +lib_LTLIBRARIES += libuutil.la +CPPCHECKTARGETS += libuutil.la -lib_LTLIBRARIES = libuutil.la - -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - uu_alloc.c \ - uu_avl.c \ - uu_ident.c \ - uu_list.c \ - uu_misc.c \ - uu_pname.c \ - uu_string.c - -libuutil_la_SOURCES = $(USER_C) +libuutil_la_SOURCES = \ + %D%/uu_alloc.c \ + %D%/uu_avl.c \ + %D%/uu_ident.c \ + %D%/uu_list.c \ + %D%/uu_misc.c \ + %D%/uu_pname.c \ + %D%/uu_string.c libuutil_la_LIBADD = \ - $(abs_top_builddir)/lib/libavl/libavl.la \ - $(abs_top_builddir)/lib/libspl/libspl.la + libavl.la \ + libspl.la libuutil_la_LIBADD += $(LTLIBINTL) @@ -32,7 +26,4 @@ endif libuutil_la_LDFLAGS += -version-info 3:0:0 -include $(top_srcdir)/config/CppCheck.am - -# Library ABI -EXTRA_DIST = libuutil.abi libuutil.suppr +EXTRA_DIST += $(addprefix %D%/,libuutil.abi libuutil.suppr) diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 14bb7df4d7..07414c4a30 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -1,81 +1,64 @@ -include $(top_srcdir)/config/Rules.am +libzfs_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzfs_la_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) +libzfs_la_CFLAGS += -fvisibility=hidden -VPATH = \ - $(top_srcdir)/module/icp \ - $(top_srcdir)/module/zcommon \ - $(top_srcdir)/lib/libzfs - -# Suppress unused but set variable warnings often due to ASSERTs -AM_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -pkgconfig_DATA = libzfs.pc - -lib_LTLIBRARIES = libzfs.la - -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - libzfs_impl.h \ - libzfs_changelist.c \ - libzfs_config.c \ - libzfs_crypto.c \ - libzfs_dataset.c \ - libzfs_diff.c \ - libzfs_import.c \ - libzfs_iter.c \ - libzfs_mount.c \ - libzfs_pool.c \ - libzfs_sendrecv.c \ - libzfs_status.c \ - libzfs_util.c +lib_LTLIBRARIES += libzfs.la +CPPCHECKTARGETS += libzfs.la +dist_libzfs_la_SOURCES = \ + %D%/libzfs_impl.h \ + %D%/libzfs_changelist.c \ + %D%/libzfs_config.c \ + %D%/libzfs_crypto.c \ + %D%/libzfs_dataset.c \ + %D%/libzfs_diff.c \ + %D%/libzfs_import.c \ + %D%/libzfs_iter.c \ + %D%/libzfs_mount.c \ + %D%/libzfs_pool.c \ + %D%/libzfs_sendrecv.c \ + %D%/libzfs_status.c \ + %D%/libzfs_util.c if BUILD_FREEBSD -USER_C += \ - os/freebsd/libzfs_compat.c \ - os/freebsd/libzfs_zmount.c +dist_libzfs_la_SOURCES += \ + %D%/os/freebsd/libzfs_compat.c \ + %D%/os/freebsd/libzfs_zmount.c endif if BUILD_LINUX -USER_C += \ - os/linux/libzfs_mount_os.c \ - os/linux/libzfs_pool_os.c \ - os/linux/libzfs_util_os.c +dist_libzfs_la_SOURCES += \ + %D%/os/linux/libzfs_mount_os.c \ + %D%/os/linux/libzfs_pool_os.c \ + %D%/os/linux/libzfs_util_os.c endif -KERNEL_C = \ - algs/sha2/sha2.c \ - cityhash.c \ - zfeature_common.c \ - zfs_comutil.c \ - zfs_deleg.c \ - zfs_fletcher.c \ - zfs_fletcher_aarch64_neon.c \ - zfs_fletcher_avx512.c \ - zfs_fletcher_intel.c \ - zfs_fletcher_sse.c \ - zfs_fletcher_superscalar.c \ - zfs_fletcher_superscalar4.c \ - zfs_namecheck.c \ - zfs_prop.c \ - zpool_prop.c \ - zprop_common.c - -dist_libzfs_la_SOURCES = \ - $(USER_C) - nodist_libzfs_la_SOURCES = \ - $(KERNEL_C) + module/icp/algs/sha2/sha2.c \ + \ + module/zcommon/cityhash.c \ + module/zcommon/zfeature_common.c \ + module/zcommon/zfs_comutil.c \ + module/zcommon/zfs_deleg.c \ + module/zcommon/zfs_fletcher.c \ + module/zcommon/zfs_fletcher_aarch64_neon.c \ + module/zcommon/zfs_fletcher_avx512.c \ + module/zcommon/zfs_fletcher_intel.c \ + module/zcommon/zfs_fletcher_sse.c \ + module/zcommon/zfs_fletcher_superscalar.c \ + module/zcommon/zfs_fletcher_superscalar4.c \ + module/zcommon/zfs_namecheck.c \ + module/zcommon/zfs_prop.c \ + module/zcommon/zpool_prop.c \ + module/zcommon/zprop_common.c + libzfs_la_LIBADD = \ - $(abs_top_builddir)/lib/libshare/libshare.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libzutil/libzutil.la \ - $(abs_top_builddir)/lib/libuutil/libuutil.la + libshare.la \ + libzfs_core.la \ + libnvpair.la \ + libzutil.la \ + libuutil.la libzfs_la_LIBADD += -lm $(LIBCRYPTO_LIBS) $(ZLIB_LIBS) $(LIBFETCH_LIBS) $(LTLIBINTL) @@ -91,10 +74,7 @@ endif libzfs_la_LDFLAGS += -version-info 5:0:1 -include $(top_srcdir)/config/CppCheck.am +pkgconfig_DATA += %D%/libzfs.pc -# Library ABI -EXTRA_DIST = libzfs.abi libzfs.suppr - -# Licensing data -EXTRA_DIST += THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip +EXTRA_DIST += $(addprefix %D%/,libzfs.abi libzfs.suppr) +EXTRA_DIST += $(addprefix %D%/,THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip) diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index b75ed464a9..9370da4e3e 100644 --- a/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am @@ -1,39 +1,31 @@ -include $(top_srcdir)/config/Rules.am +libzfs_core_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzfs_core_la_CFLAGS += -fvisibility=hidden -pkgconfig_DATA = libzfs_core.pc +lib_LTLIBRARIES += libzfs_core.la +CPPCHECKTARGETS += libzfs_core.la -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -lib_LTLIBRARIES = libzfs_core.la - -include $(top_srcdir)/config/Abigail.am - -USER_C = \ - libzfs_core.c +libzfs_core_la_SOURCES = \ + %D%/libzfs_core.c if BUILD_LINUX -USER_C += \ - os/linux/libzfs_core_ioctl.c +libzfs_core_la_SOURCES += \ + %D%/os/linux/libzfs_core_ioctl.c endif +libzfs_core_la_CPPFLAGS = $(AM_CPPFLAGS) if BUILD_FREEBSD -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/freebsd/zfs +libzfs_core_la_CPPFLAGS += -Iinclude/os/freebsd/zfs -USER_C += \ - os/freebsd/libzfs_core_ioctl.c +libzfs_core_la_SOURCES += \ + %D%/os/freebsd/libzfs_core_ioctl.c -VPATH += $(top_srcdir)/module/os/freebsd/zfs - -nodist_libzfs_core_la_SOURCES = zfs_ioctl_compat.c +nodist_libzfs_core_la_SOURCES = \ + module/os/freebsd/zfs/zfs_ioctl_compat.c endif -libzfs_core_la_SOURCES = $(USER_C) - libzfs_core_la_LIBADD = \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libspl/libspl.la + libnvpair.la \ + libspl.la libzfs_core_la_LIBADD += $(LTLIBINTL) @@ -49,7 +41,6 @@ endif libzfs_core_la_LDFLAGS += -version-info 3:0:0 -include $(top_srcdir)/config/CppCheck.am +pkgconfig_DATA += %D%/libzfs_core.pc -# Library ABI -EXTRA_DIST = libzfs_core.abi libzfs_core.suppr +EXTRA_DIST += $(addprefix %D%/,libzfs_core.abi libzfs_core.suppr) diff --git a/lib/libzfsbootenv/Makefile.am b/lib/libzfsbootenv/Makefile.am index a9f19ad5bb..7b87bfe678 100644 --- a/lib/libzfsbootenv/Makefile.am +++ b/lib/libzfsbootenv/Makefile.am @@ -1,33 +1,20 @@ -include $(top_srcdir)/config/Rules.am +libzfsbootenv_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzfsbootenv_la_CFLAGS += -fvisibility=hidden -pkgconfig_DATA = libzfsbootenv.pc +lib_LTLIBRARIES += libzfsbootenv.la +CPPCHECKTARGETS += libzfsbootenv.la -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -lib_LTLIBRARIES = libzfsbootenv.la - -include $(top_srcdir)/config/Abigail.am - -if BUILD_FREEBSD -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/freebsd/zfs -endif -if BUILD_LINUX -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/linux/zfs -endif - -USER_C = \ - lzbe_device.c \ - lzbe_pair.c \ - lzbe_util.c +libzfsbootenv_la_CPPFLAGS = $(AM_CPPFLAGS) +libzfsbootenv_la_CPPFLAGS += -I$(srcdir)/include/os/@ac_system_l@/zfs dist_libzfsbootenv_la_SOURCES = \ - $(USER_C) + %D%/lzbe_device.c \ + %D%/lzbe_pair.c \ + %D%/lzbe_util.c libzfsbootenv_la_LIBADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + libzfs.la \ + libnvpair.la libzfsbootenv_la_LDFLAGS = @@ -37,7 +24,6 @@ endif libzfsbootenv_la_LDFLAGS += -version-info 1:0:0 -include $(top_srcdir)/config/CppCheck.am +pkgconfig_DATA += %D%/libzfsbootenv.pc -# Library ABI -EXTRA_DIST = libzfsbootenv.abi libzfsbootenv.suppr +EXTRA_DIST += $(addprefix %D%/,libzfsbootenv.abi libzfsbootenv.suppr) diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index 63b36c6770..60eb307498 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -1,223 +1,196 @@ -include $(top_srcdir)/config/Rules.am +libzpool_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) +libzpool_la_CFLAGS += $(ZLIB_CFLAGS) -VPATH = \ - $(top_srcdir)/module/zfs \ - $(top_srcdir)/module/zcommon \ - $(top_srcdir)/module/lua \ - $(top_srcdir)/module/os/linux/zfs \ - $(top_srcdir)/lib/libzpool +libzpool_la_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) +libzpool_la_CPPFLAGS += -I$(srcdir)/include/os/@ac_system_l@/zfs +libzpool_la_CPPFLAGS += -DLIB_ZPOOL_BUILD -if BUILD_FREEBSD -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/freebsd/zfs -endif -if BUILD_LINUX -DEFAULT_INCLUDES += -I$(top_srcdir)/include/os/linux/zfs -endif - -# Unconditionally enable debugging for libzpool -AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG - -# Includes kernel code generate warnings for large stack frames -AM_CFLAGS += $(FRAME_LARGER_THAN) - -AM_CFLAGS += $(ZLIB_CFLAGS) - -AM_CFLAGS += -DLIB_ZPOOL_BUILD - -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress - -lib_LTLIBRARIES = libzpool.la - -USER_C = \ - kernel.c \ - taskq.c \ - util.c - -KERNEL_C = \ - zfeature_common.c \ - zfs_comutil.c \ - zfs_deleg.c \ - zfs_fletcher.c \ - zfs_fletcher_aarch64_neon.c \ - zfs_fletcher_avx512.c \ - zfs_fletcher_intel.c \ - zfs_fletcher_sse.c \ - zfs_fletcher_superscalar.c \ - zfs_fletcher_superscalar4.c \ - zfs_namecheck.c \ - zfs_prop.c \ - zpool_prop.c \ - zprop_common.c \ - abd.c \ - abd_os.c \ - aggsum.c \ - arc.c \ - arc_os.c \ - blkptr.c \ - bplist.c \ - bpobj.c \ - bptree.c \ - bqueue.c \ - btree.c \ - cityhash.c \ - dbuf.c \ - dbuf_stats.c \ - ddt.c \ - ddt_zap.c \ - dmu.c \ - dmu_diff.c \ - dmu_object.c \ - dmu_objset.c \ - dmu_recv.c \ - dmu_redact.c \ - dmu_send.c \ - dmu_traverse.c \ - dmu_tx.c \ - dmu_zfetch.c \ - dnode.c \ - dnode_sync.c \ - dsl_bookmark.c \ - dsl_crypt.c \ - dsl_dataset.c \ - dsl_deadlist.c \ - dsl_deleg.c \ - dsl_destroy.c \ - dsl_dir.c \ - dsl_pool.c \ - dsl_prop.c \ - dsl_scan.c \ - dsl_synctask.c \ - dsl_userhold.c \ - edonr_zfs.c \ - fm.c \ - gzip.c \ - hkdf.c \ - lz4.c \ - lz4_zfs.c \ - lzjb.c \ - metaslab.c \ - mmp.c \ - multilist.c \ - objlist.c \ - pathname.c \ - range_tree.c \ - refcount.c \ - rrwlock.c \ - sa.c \ - sha256.c \ - skein_zfs.c \ - spa.c \ - spa_boot.c \ - spa_checkpoint.c \ - spa_config.c \ - spa_errlog.c \ - spa_history.c \ - spa_log_spacemap.c \ - spa_misc.c \ - spa_stats.c \ - space_map.c \ - space_reftree.c \ - trace.c \ - txg.c \ - uberblock.c \ - unique.c \ - vdev.c \ - vdev_cache.c \ - vdev_draid.c \ - vdev_draid_rand.c \ - vdev_file.c \ - vdev_indirect.c \ - vdev_indirect_births.c \ - vdev_indirect_mapping.c \ - vdev_initialize.c \ - vdev_label.c \ - vdev_mirror.c \ - vdev_missing.c \ - vdev_queue.c \ - vdev_raidz.c \ - vdev_raidz_math.c \ - vdev_raidz_math_aarch64_neon.c \ - vdev_raidz_math_aarch64_neonx2.c \ - vdev_raidz_math_avx2.c \ - vdev_raidz_math_avx512bw.c \ - vdev_raidz_math_avx512f.c \ - vdev_raidz_math_powerpc_altivec.c \ - vdev_raidz_math_scalar.c \ - vdev_raidz_math_sse2.c \ - vdev_raidz_math_ssse3.c \ - vdev_rebuild.c \ - vdev_removal.c \ - vdev_root.c \ - vdev_trim.c \ - zap.c \ - zap_leaf.c \ - zap_micro.c \ - zcp.c \ - zcp_get.c \ - zcp_global.c \ - zcp_iter.c \ - zcp_set.c \ - zcp_synctask.c \ - zfeature.c \ - zfs_byteswap.c \ - zfs_debug.c \ - zfs_fm.c \ - zfs_fuid.c \ - zfs_racct.c \ - zfs_sa.c \ - zfs_ratelimit.c \ - zfs_rlock.c \ - zfs_znode.c \ - zil.c \ - zio.c \ - zio_checksum.c \ - zio_compress.c \ - zio_crypt.c \ - zio_inject.c \ - zle.c \ - zrlock.c \ - zthr.c - -LUA_C = \ - lapi.c \ - lauxlib.c \ - lbaselib.c \ - lcode.c \ - lcompat.c \ - lcorolib.c \ - lctype.c \ - ldebug.c \ - ldo.c \ - lfunc.c \ - lgc.c \ - llex.c \ - lmem.c \ - lobject.c \ - lopcodes.c \ - lparser.c \ - lstate.c \ - lstring.c \ - lstrlib.c \ - ltable.c \ - ltablib.c \ - ltm.c \ - lvm.c \ - lzio.c +lib_LTLIBRARIES += libzpool.la +CPPCHECKTARGETS += libzpool.la dist_libzpool_la_SOURCES = \ - $(USER_C) + %D%/kernel.c \ + %D%/taskq.c \ + %D%/util.c nodist_libzpool_la_SOURCES = \ - $(KERNEL_C) \ - $(LUA_C) + module/lua/lapi.c \ + module/lua/lauxlib.c \ + module/lua/lbaselib.c \ + module/lua/lcode.c \ + module/lua/lcompat.c \ + module/lua/lcorolib.c \ + module/lua/lctype.c \ + module/lua/ldebug.c \ + module/lua/ldo.c \ + module/lua/lfunc.c \ + module/lua/lgc.c \ + module/lua/llex.c \ + module/lua/lmem.c \ + module/lua/lobject.c \ + module/lua/lopcodes.c \ + module/lua/lparser.c \ + module/lua/lstate.c \ + module/lua/lstring.c \ + module/lua/lstrlib.c \ + module/lua/ltable.c \ + module/lua/ltablib.c \ + module/lua/ltm.c \ + module/lua/lvm.c \ + module/lua/lzio.c \ + \ + module/os/linux/zfs/abd_os.c \ + module/os/linux/zfs/arc_os.c \ + module/os/linux/zfs/trace.c \ + module/os/linux/zfs/vdev_file.c \ + module/os/linux/zfs/zfs_debug.c \ + module/os/linux/zfs/zfs_racct.c \ + module/os/linux/zfs/zfs_znode.c \ + module/os/linux/zfs/zio_crypt.c \ + \ + module/zcommon/cityhash.c \ + module/zcommon/zfeature_common.c \ + module/zcommon/zfs_comutil.c \ + module/zcommon/zfs_deleg.c \ + module/zcommon/zfs_fletcher.c \ + module/zcommon/zfs_fletcher_aarch64_neon.c \ + module/zcommon/zfs_fletcher_avx512.c \ + module/zcommon/zfs_fletcher_intel.c \ + module/zcommon/zfs_fletcher_sse.c \ + module/zcommon/zfs_fletcher_superscalar.c \ + module/zcommon/zfs_fletcher_superscalar4.c \ + module/zcommon/zfs_namecheck.c \ + module/zcommon/zfs_prop.c \ + module/zcommon/zpool_prop.c \ + module/zcommon/zprop_common.c \ + \ + module/zfs/abd.c \ + module/zfs/aggsum.c \ + module/zfs/arc.c \ + module/zfs/blkptr.c \ + module/zfs/bplist.c \ + module/zfs/bpobj.c \ + module/zfs/bptree.c \ + module/zfs/bqueue.c \ + module/zfs/btree.c \ + module/zfs/dbuf.c \ + module/zfs/dbuf_stats.c \ + module/zfs/ddt.c \ + module/zfs/ddt_zap.c \ + module/zfs/dmu.c \ + module/zfs/dmu_diff.c \ + module/zfs/dmu_object.c \ + module/zfs/dmu_objset.c \ + module/zfs/dmu_recv.c \ + module/zfs/dmu_redact.c \ + module/zfs/dmu_send.c \ + module/zfs/dmu_traverse.c \ + module/zfs/dmu_tx.c \ + module/zfs/dmu_zfetch.c \ + module/zfs/dnode.c \ + module/zfs/dnode_sync.c \ + module/zfs/dsl_bookmark.c \ + module/zfs/dsl_crypt.c \ + module/zfs/dsl_dataset.c \ + module/zfs/dsl_deadlist.c \ + module/zfs/dsl_deleg.c \ + module/zfs/dsl_destroy.c \ + module/zfs/dsl_dir.c \ + module/zfs/dsl_pool.c \ + module/zfs/dsl_prop.c \ + module/zfs/dsl_scan.c \ + module/zfs/dsl_synctask.c \ + module/zfs/dsl_userhold.c \ + module/zfs/edonr_zfs.c \ + module/zfs/fm.c \ + module/zfs/gzip.c \ + module/zfs/hkdf.c \ + module/zfs/lz4.c \ + module/zfs/lz4_zfs.c \ + module/zfs/lzjb.c \ + module/zfs/metaslab.c \ + module/zfs/mmp.c \ + module/zfs/multilist.c \ + module/zfs/objlist.c \ + module/zfs/pathname.c \ + module/zfs/range_tree.c \ + module/zfs/refcount.c \ + module/zfs/rrwlock.c \ + module/zfs/sa.c \ + module/zfs/sha256.c \ + module/zfs/skein_zfs.c \ + module/zfs/spa.c \ + module/zfs/spa_boot.c \ + module/zfs/spa_checkpoint.c \ + module/zfs/spa_config.c \ + module/zfs/spa_errlog.c \ + module/zfs/spa_history.c \ + module/zfs/spa_log_spacemap.c \ + module/zfs/spa_misc.c \ + module/zfs/spa_stats.c \ + module/zfs/space_map.c \ + module/zfs/space_reftree.c \ + module/zfs/txg.c \ + module/zfs/uberblock.c \ + module/zfs/unique.c \ + module/zfs/vdev.c \ + module/zfs/vdev_cache.c \ + module/zfs/vdev_draid.c \ + module/zfs/vdev_draid_rand.c \ + module/zfs/vdev_indirect.c \ + module/zfs/vdev_indirect_births.c \ + module/zfs/vdev_indirect_mapping.c \ + module/zfs/vdev_initialize.c \ + module/zfs/vdev_label.c \ + module/zfs/vdev_mirror.c \ + module/zfs/vdev_missing.c \ + module/zfs/vdev_queue.c \ + module/zfs/vdev_raidz.c \ + module/zfs/vdev_raidz_math.c \ + module/zfs/vdev_raidz_math_aarch64_neon.c \ + module/zfs/vdev_raidz_math_aarch64_neonx2.c \ + module/zfs/vdev_raidz_math_avx2.c \ + module/zfs/vdev_raidz_math_avx512bw.c \ + module/zfs/vdev_raidz_math_avx512f.c \ + module/zfs/vdev_raidz_math_powerpc_altivec.c \ + module/zfs/vdev_raidz_math_scalar.c \ + module/zfs/vdev_raidz_math_sse2.c \ + module/zfs/vdev_raidz_math_ssse3.c \ + module/zfs/vdev_rebuild.c \ + module/zfs/vdev_removal.c \ + module/zfs/vdev_root.c \ + module/zfs/vdev_trim.c \ + module/zfs/zap.c \ + module/zfs/zap_leaf.c \ + module/zfs/zap_micro.c \ + module/zfs/zcp.c \ + module/zfs/zcp_get.c \ + module/zfs/zcp_global.c \ + module/zfs/zcp_iter.c \ + module/zfs/zcp_set.c \ + module/zfs/zcp_synctask.c \ + module/zfs/zfeature.c \ + module/zfs/zfs_byteswap.c \ + module/zfs/zfs_fm.c \ + module/zfs/zfs_fuid.c \ + module/zfs/zfs_ratelimit.c \ + module/zfs/zfs_rlock.c \ + module/zfs/zfs_sa.c \ + module/zfs/zil.c \ + module/zfs/zio.c \ + module/zfs/zio_checksum.c \ + module/zfs/zio_compress.c \ + module/zfs/zio_inject.c \ + module/zfs/zle.c \ + module/zfs/zrlock.c \ + module/zfs/zthr.c libzpool_la_LIBADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libunicode/libunicode.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libzstd/libzstd.la \ - $(abs_top_builddir)/lib/libzutil/libzutil.la + libicp.la \ + libunicode.la \ + libnvpair.la \ + libzstd.la \ + libzutil.la libzpool_la_LIBADD += $(LIBCLOCK_GETTIME) $(ZLIB_LIBS) -ldl -lm @@ -234,8 +207,6 @@ endif libzpool_la_LDFLAGS += -version-info 5:0:0 if TARGET_CPU_POWERPC -vdev_raidz_math_powerpc_altivec.$(OBJEXT): CFLAGS += -maltivec -vdev_raidz_math_powerpc_altivec.l$(OBJEXT): CFLAGS += -maltivec +module/zfs/libzpool_la-vdev_raidz_math_powerpc_altivec.$(OBJEXT) : CFLAGS += -maltivec +module/zfs/libzpool_la-vdev_raidz_math_powerpc_altivec.l$(OBJEXT): CFLAGS += -maltivec endif - -include $(top_srcdir)/config/CppCheck.am diff --git a/lib/libzstd/Makefile.am b/lib/libzstd/Makefile.am index e7de3e979f..7298568626 100644 --- a/lib/libzstd/Makefile.am +++ b/lib/libzstd/Makefile.am @@ -1,44 +1,33 @@ -include $(top_srcdir)/config/Rules.am - -VPATH = $(top_srcdir)/module/zstd - +libzstd_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) # -fno-tree-vectorize is set for gcc in zstd/common/compiler.h # Set it for other compilers, too. -AM_CFLAGS += -fno-tree-vectorize -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +libzstd_la_CFLAGS += -fno-tree-vectorize -noinst_LTLIBRARIES = libzstd.la +noinst_LTLIBRARIES += libzstd.la +CPPCHECKTARGETS += libzstd.la -KERNEL_C = lib/common/entropy_common.c \ - lib/common/error_private.c \ - lib/common/fse_decompress.c \ - lib/common/pool.c \ - lib/common/zstd_common.c \ - lib/compress/fse_compress.c \ - lib/compress/hist.c \ - lib/compress/huf_compress.c \ - lib/compress/zstd_compress_literals.c \ - lib/compress/zstd_compress_sequences.c \ - lib/compress/zstd_compress_superblock.c \ - lib/compress/zstd_compress.c \ - lib/compress/zstd_double_fast.c \ - lib/compress/zstd_fast.c \ - lib/compress/zstd_lazy.c \ - lib/compress/zstd_ldm.c \ - lib/compress/zstd_opt.c \ - lib/decompress/huf_decompress.c \ - lib/decompress/zstd_ddict.c \ - lib/decompress/zstd_decompress.c \ - lib/decompress/zstd_decompress_block.c \ - zfs_zstd.c +nodist_libzstd_la_SOURCES = \ + module/zstd/lib/common/entropy_common.c \ + module/zstd/lib/common/error_private.c \ + module/zstd/lib/common/fse_decompress.c \ + module/zstd/lib/common/pool.c \ + module/zstd/lib/common/zstd_common.c \ + module/zstd/lib/compress/fse_compress.c \ + module/zstd/lib/compress/hist.c \ + module/zstd/lib/compress/huf_compress.c \ + module/zstd/lib/compress/zstd_compress_literals.c \ + module/zstd/lib/compress/zstd_compress_sequences.c \ + module/zstd/lib/compress/zstd_compress_superblock.c \ + module/zstd/lib/compress/zstd_compress.c \ + module/zstd/lib/compress/zstd_double_fast.c \ + module/zstd/lib/compress/zstd_fast.c \ + module/zstd/lib/compress/zstd_lazy.c \ + module/zstd/lib/compress/zstd_ldm.c \ + module/zstd/lib/compress/zstd_opt.c \ + module/zstd/lib/decompress/huf_decompress.c \ + module/zstd/lib/decompress/zstd_ddict.c \ + module/zstd/lib/decompress/zstd_decompress.c \ + module/zstd/lib/decompress/zstd_decompress_block.c \ + module/zstd/zfs_zstd.c -nodist_libzstd_la_SOURCES = $(KERNEL_C) - -%.$(OBJEXT): CFLAGS += -fno-tree-vectorize -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -Wp,-w -%.l$(OBJEXT): CFLAGS += -fno-tree-vectorize -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -Wp,-w - -zfs_zstd.$(OBJEXT): CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -zfs_zstd.l$(OBJEXT): CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h - -include $(top_srcdir)/config/CppCheck.am +libzstd_la_CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -fno-tree-vectorize -Wp,-w $(AM_CFLAGS) diff --git a/lib/libzutil/Makefile.am b/lib/libzutil/Makefile.am index 5a253c2afb..ecdf940508 100644 --- a/lib/libzutil/Makefile.am +++ b/lib/libzutil/Makefile.am @@ -1,47 +1,42 @@ -include $(top_srcdir)/config/Rules.am +libzutil_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS) +libzutil_la_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) +libzutil_la_CFLAGS += -fvisibility=hidden -AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) -AM_CFLAGS += -fvisibility=hidden -# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 -AM_CFLAGS += -no-suppress +libzutil_la_CPPFLAGS = $(AM_CPPFLAGS) +libzutil_la_CPPFLAGS += -I$(srcdir)/%D% -DEFAULT_INCLUDES += -I$(srcdir) +noinst_LTLIBRARIES += libzutil.la +CPPCHECKTARGETS += libzutil.la -noinst_LTLIBRARIES = libzutil.la - -USER_C = \ - zutil_device_path.c \ - zutil_import.c \ - zutil_import.h \ - zutil_nicenum.c \ - zutil_pool.c +libzutil_la_SOURCES = \ + %D%/zutil_device_path.c \ + %D%/zutil_import.c \ + %D%/zutil_import.h \ + %D%/zutil_nicenum.c \ + %D%/zutil_pool.c if BUILD_LINUX -USER_C += \ - os/linux/zutil_device_path_os.c \ - os/linux/zutil_import_os.c +libzutil_la_SOURCES += \ + %D%/os/linux/zutil_device_path_os.c \ + %D%/os/linux/zutil_import_os.c endif if BUILD_FREEBSD -USER_C += \ - os/freebsd/zutil_device_path_os.c \ - os/freebsd/zutil_import_os.c +libzutil_la_SOURCES += \ + %D%/os/freebsd/zutil_device_path_os.c \ + %D%/os/freebsd/zutil_import_os.c endif -libzutil_la_SOURCES = $(USER_C) - libzutil_la_LIBADD = \ - $(abs_top_builddir)/lib/libavl/libavl.la \ - $(abs_top_builddir)/lib/libtpool/libtpool.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libspl/libspl.la + libavl.la \ + libtpool.la \ + libnvpair.la \ + libspl.la if BUILD_LINUX libzutil_la_LIBADD += \ - $(abs_top_builddir)/lib/libefi/libefi.la \ + libefi.la \ -lrt endif libzutil_la_LIBADD += -lm $(LIBBLKID_LIBS) $(LIBUDEV_LIBS) - -include $(top_srcdir)/config/CppCheck.am diff --git a/module/Makefile.in b/module/Makefile.in index e6ca94b92c..5b71e1abf7 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -5,15 +5,17 @@ INSTALL_MOD_PATH ?= $(DESTDIR) all: modules distclean maintainer-clean: clean -install: modules_install -uninstall: modules_uninstall +install: modules_install data_install +uninstall: modules_uninstall data_uninstall check: .PHONY: all distclean maintainer-clean install uninstall check distdir \ modules modules-Linux modules-FreeBSD modules-unknown \ clean clean-Linux clean-FreeBSD \ modules_install modules_install-Linux modules_install-FreeBSD \ + data_install data_install-Linux data_install-FreeBSD \ modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD \ + data_uninstall data_uninstall-Linux data_uninstall-FreeBSD \ cppcheck cppcheck-Linux cppcheck-FreeBSD # For FreeBSD, use debug options from ./configure if not overridden. @@ -110,6 +112,15 @@ modules_install-FreeBSD: modules_install: modules_install-@ac_system@ +data_install-Linux: + @mkdir -p $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@ + cp ../zfs.release ../zfs_config.h @LINUX_SYMBOLS@ $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@ + +data_install-FreeBSD: + @ + +data_install: data_install-@ac_system@ + modules_uninstall-Linux: modules_uninstall-Linux-legacy @# Uninstall the kernel modules $(RM) $(addprefix $(KMODDIR)/$(INSTALL_MOD_DIR)/,zfs.ko spl.ko) @@ -119,6 +130,14 @@ modules_uninstall-FreeBSD: modules_uninstall: modules_uninstall-@ac_system@ +data_uninstall-Linux: + $(RM) $(addprefix $(DESTDIR)/@prefix@/src/zfs-@VERSION@/@LINUX_VERSION@/,zfs.release zfs_config.h @LINUX_SYMBOLS@) + +data_uninstall-FreeBSD: + @ + +data_uninstall: data_uninstall-@ac_system@ + cppcheck-Linux: @CPPCHECK@ -j@CPU_COUNT@ --std=c99 --quiet --force --error-exitcode=2 \ --inline-suppr \ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index fffeb6b212..775759187a 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -45,7 +45,7 @@ export ZPOOL_SCRIPT_DIR=$$CMD_DIR/zpool/zpool.d export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/zpool/zpool.d export ZPOOL_COMPAT_DIR=$$CMD_DIR/zpool/compatibility.d export CONTRIB_DIR=@abs_top_builddir@/contrib -export LIB_DIR=@abs_top_builddir@/lib +export LIB_DIR=@abs_top_builddir@/.libs export SYSCONF_DIR=@abs_top_builddir@/etc export INSTALL_UDEV_DIR=@udevdir@ diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index a86a6eb61a..93a047f22c 100755 --- a/scripts/zfs-helpers.sh +++ b/scripts/zfs-helpers.sh @@ -174,10 +174,8 @@ if [ "${INSTALL}" = "yes" ]; then # Ideally we would install these in the configured ${libdir}, which is # by default "/usr/local/lib and unfortunately not included in the # dynamic linker search path. - install "$(find "$LIB_DIR/libzfs_core" -type f -name 'libzfs_core.so*')" \ - "/lib/libzfs_core.so" - install "$(find "$LIB_DIR/libnvpair" -type f -name 'libnvpair.so*')" \ - "/lib/libnvpair.so" + install "$(find "$LIB_DIR" -type f -name 'libzfs_core.so*')" "/lib/libzfs_core.so" + install "$(find "$LIB_DIR" -type f -name 'libnvpair.so*')" "/lib/libnvpair.so" ldconfig else remove "$INSTALL_MOUNT_HELPER_DIR/mount.zfs" diff --git a/tests/zfs-tests/cmd/Makefile.am b/tests/zfs-tests/cmd/Makefile.am index c8be6f0559..266d2cdb9c 100644 --- a/tests/zfs-tests/cmd/Makefile.am +++ b/tests/zfs-tests/cmd/Makefile.am @@ -6,18 +6,17 @@ pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin pkgexec_PROGRAMS = badsend badsend_SOURCES = badsend.c badsend_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libnvpair.la pkgexec_PROGRAMS += btree_test btree_test_SOURCES = btree_test.c -# Unconditionally enable ASSERTs -btree_test_CPPFLAGS = $(AM_CPPFLAGS) -DDEBUG -UNDEBUG -DZFS_DEBUG +btree_test_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) btree_test_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libzfs_core.la pkgexec_PROGRAMS += chg_usr_exec @@ -40,8 +39,8 @@ pkgexec_PROGRAMS += draid draid_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) draid_SOURCES = draid.c draid_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzpool.la \ + $(abs_top_builddir)/libnvpair.la draid_LDADD += $(ZLIB_LIBS) @@ -67,8 +66,8 @@ if BUILD_LINUX libzfs_input_check_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/include/os/linux/zfs endif libzfs_input_check_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la @@ -99,8 +98,8 @@ endif pkgexec_PROGRAMS += nvlist_to_lua nvlist_to_lua_SOURCES = nvlist_to_lua.c nvlist_to_lua_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libnvpair.la pkgexec_PROGRAMS += rename_dir @@ -113,9 +112,9 @@ rm_lnkcnt_zero_file_LDADD = -lpthread pkgexec_PROGRAMS += send_doall send_doall_SOURCES = send_doall.c send_doall_LDADD = \ - $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la + $(abs_top_builddir)/libzfs_core.la \ + $(abs_top_builddir)/libzfs.la \ + $(abs_top_builddir)/libnvpair.la pkgexec_PROGRAMS += stride_dd stride_dd_SOURCES = stride_dd.c @@ -140,8 +139,8 @@ truncate_test_SOURCES = truncate_test.c pkgexec_PROGRAMS += ereports ereports_SOURCES = ereports.c ereports_LDADD = \ - $(abs_top_builddir)/lib/libnvpair/libnvpair.la \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libnvpair.la \ + $(abs_top_builddir)/libzfs.la pkgexec_PROGRAMS += zfs_diff-socket zfs_diff_socket_SOURCES = zfs_diff-socket.c @@ -155,14 +154,14 @@ skein_test_SOURCES = checksum/skein_test.c sha2_test_SOURCES = checksum/sha2_test.c edonr_test_SOURCES = checksum/edonr_test.c skein_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + $(abs_top_builddir)/libicp.la \ + $(abs_top_builddir)/libspl_assert.la sha2_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + $(abs_top_builddir)/libicp.la \ + $(abs_top_builddir)/libspl_assert.la edonr_test_LDADD = \ - $(abs_top_builddir)/lib/libicp/libicp.la \ - $(abs_top_builddir)/lib/libspl/libspl_assert.la + $(abs_top_builddir)/libicp.la \ + $(abs_top_builddir)/libspl_assert.la if BUILD_LINUX diff --git a/tests/zfs-tests/tests/functional/hkdf/Makefile.am b/tests/zfs-tests/tests/functional/hkdf/Makefile.am index 1d126c4a90..bb8a41f6c0 100644 --- a/tests/zfs-tests/tests/functional/hkdf/Makefile.am +++ b/tests/zfs-tests/tests/functional/hkdf/Makefile.am @@ -5,4 +5,4 @@ pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf pkgexec_PROGRAMS = hkdf_test hkdf_test_SOURCES = hkdf_test.c hkdf_test_LDADD = \ - $(abs_top_builddir)/lib/libzpool/libzpool.la + $(abs_top_builddir)/libzpool.la diff --git a/tests/zfs-tests/tests/functional/libzfs/Makefile.am b/tests/zfs-tests/tests/functional/libzfs/Makefile.am index 51482f4e63..f9cce0c6b2 100644 --- a/tests/zfs-tests/tests/functional/libzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/libzfs/Makefile.am @@ -11,4 +11,4 @@ dist_pkgdata_SCRIPTS = \ pkgexec_PROGRAMS = many_fds many_fds_SOURCES = many_fds.c many_fds_LDADD = \ - $(abs_top_builddir)/lib/libzfs/libzfs.la + $(abs_top_builddir)/libzfs.la