2025-12-20 16:45:07 +11:00
|
|
|
# SPDX-License-Identifier: CDDL-1.0
|
2018-01-10 10:49:27 -08:00
|
|
|
#
|
|
|
|
|
# Default build rules for all user space components, every Makefile.am
|
|
|
|
|
# should include these rules and override or extend them as needed.
|
|
|
|
|
#
|
|
|
|
|
|
2021-01-22 12:54:34 -08:00
|
|
|
PHONY =
|
2022-04-08 01:07:08 +02:00
|
|
|
AM_CPPFLAGS = \
|
2020-06-19 22:08:59 -04:00
|
|
|
-include $(top_builddir)/zfs_config.h \
|
|
|
|
|
-I$(top_builddir)/include \
|
2019-10-02 10:39:48 -07:00
|
|
|
-I$(top_srcdir)/include \
|
|
|
|
|
-I$(top_srcdir)/module/icp/include \
|
2022-04-08 01:07:08 +02:00
|
|
|
-I$(top_srcdir)/lib/libspl/include \
|
2025-05-31 06:38:20 +10:00
|
|
|
-I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@
|
2020-04-14 11:36:28 -07:00
|
|
|
|
2010-08-26 11:22:58 -07:00
|
|
|
AM_LIBTOOLFLAGS = --silent
|
2018-01-10 10:49:27 -08:00
|
|
|
|
2022-04-19 20:38:30 +02:00
|
|
|
AM_CFLAGS = -std=gnu99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wno-sign-compare -Wno-missing-field-initializers
|
2020-06-16 19:46:04 -04:00
|
|
|
AM_CFLAGS += -fno-strict-aliasing
|
2019-04-14 11:04:54 -07:00
|
|
|
AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
|
2021-09-14 09:17:54 -07:00
|
|
|
AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
|
2018-01-10 10:49:27 -08:00
|
|
|
AM_CFLAGS += $(DEBUG_CFLAGS)
|
|
|
|
|
AM_CFLAGS += $(ASAN_CFLAGS)
|
2022-02-03 23:35:38 +01:00
|
|
|
AM_CFLAGS += $(UBSAN_CFLAGS)
|
2024-02-19 21:13:59 +11:00
|
|
|
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS)
|
|
|
|
|
AM_CFLAGS += $(NO_FORMAT_ZERO_LENGTH)
|
|
|
|
|
AM_CFLAGS += $(NO_FORMAT_TRUNCATION)
|
2020-04-14 11:36:28 -07:00
|
|
|
if BUILD_FREEBSD
|
|
|
|
|
AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
|
|
|
|
|
AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
|
|
|
|
|
AM_CFLAGS += -I/usr/include -I/usr/local/include
|
|
|
|
|
endif
|
2018-01-10 10:49:27 -08:00
|
|
|
|
2022-04-08 01:07:08 +02:00
|
|
|
AM_CPPFLAGS += -D_GNU_SOURCE
|
2018-01-10 10:49:27 -08:00
|
|
|
AM_CPPFLAGS += -D_REENTRANT
|
|
|
|
|
AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
|
|
|
|
AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
|
2014-01-06 16:15:45 -08:00
|
|
|
AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
|
2023-09-21 08:36:26 -07:00
|
|
|
AM_CPPFLAGS += -DZFSEXECDIR=\"$(zfsexecdir)\"
|
2014-01-06 16:15:45 -08:00
|
|
|
AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
|
|
|
|
|
AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
|
|
|
|
|
AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
|
2021-02-18 05:30:45 +00:00
|
|
|
AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"
|
2018-01-10 10:49:27 -08:00
|
|
|
AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
|
2017-09-22 18:49:57 -07:00
|
|
|
AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
|
2022-04-08 01:07:08 +02:00
|
|
|
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\"
|
|
|
|
|
|
2022-02-03 23:35:38 +01:00
|
|
|
if ASAN_ENABLED
|
|
|
|
|
AM_CPPFLAGS += -DZFS_ASAN_ENABLED
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if UBSAN_ENABLED
|
|
|
|
|
AM_CPPFLAGS += -DZFS_UBSAN_ENABLED
|
|
|
|
|
endif
|
|
|
|
|
|
2018-01-10 10:49:27 -08:00
|
|
|
AM_LDFLAGS = $(DEBUG_LDFLAGS)
|
|
|
|
|
AM_LDFLAGS += $(ASAN_LDFLAGS)
|
2022-02-03 23:35:38 +01:00
|
|
|
AM_LDFLAGS += $(UBSAN_LDFLAGS)
|
2020-04-14 11:36:28 -07:00
|
|
|
|
|
|
|
|
if BUILD_FREEBSD
|
2024-08-10 07:34:04 +10:00
|
|
|
AM_LDFLAGS += -fstack-protector-strong
|
2020-04-14 11:36:28 -07:00
|
|
|
AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
|
|
|
|
|
AM_LDFLAGS += -lm
|
|
|
|
|
endif
|
2022-04-08 01:07:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# 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.
|
2024-08-27 09:44:53 +10:00
|
|
|
# Since ZFS_DEBUG can change shared data structures, all libzpool users must
|
|
|
|
|
# be compiled with the same flags.
|
|
|
|
|
# See https://github.com/openzfs/zfs/issues/16476
|
|
|
|
|
LIBZPOOL_CPPFLAGS = -DDEBUG -UNDEBUG -DZFS_DEBUG
|