1# 2# Default build rules for all user space components, every Makefile.am 3# should include these rules and override or extend them as needed. 4# 5 6PHONY = 7AM_CPPFLAGS = \ 8 -include $(top_builddir)/zfs_config.h \ 9 -I$(top_builddir)/include \ 10 -I$(top_srcdir)/include \ 11 -I$(top_srcdir)/module/icp/include \ 12 -I$(top_srcdir)/lib/libspl/include \ 13 -I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@ \ 14 -I$(top_srcdir)/lib/libzpool/include 15 16AM_LIBTOOLFLAGS = --silent 17 18AM_CFLAGS = -std=gnu99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wno-sign-compare -Wno-missing-field-initializers 19AM_CFLAGS += -fno-strict-aliasing 20AM_CFLAGS += $(NO_OMIT_FRAME_POINTER) 21AM_CFLAGS += $(IMPLICIT_FALLTHROUGH) 22AM_CFLAGS += $(DEBUG_CFLAGS) 23AM_CFLAGS += $(ASAN_CFLAGS) 24AM_CFLAGS += $(UBSAN_CFLAGS) 25AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) 26AM_CFLAGS += $(NO_FORMAT_ZERO_LENGTH) 27AM_CFLAGS += $(NO_FORMAT_TRUNCATION) 28if BUILD_FREEBSD 29AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion 30AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h 31AM_CFLAGS += -I/usr/include -I/usr/local/include 32endif 33 34AM_CPPFLAGS += -D_GNU_SOURCE 35AM_CPPFLAGS += -D_REENTRANT 36AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64 37AM_CPPFLAGS += -D_LARGEFILE64_SOURCE 38AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\" 39AM_CPPFLAGS += -DZFSEXECDIR=\"$(zfsexecdir)\" 40AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\" 41AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\" 42AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\" 43AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\" 44AM_CPPFLAGS += $(DEBUG_CPPFLAGS) 45AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) 46AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\" 47 48if ASAN_ENABLED 49AM_CPPFLAGS += -DZFS_ASAN_ENABLED 50endif 51 52if UBSAN_ENABLED 53AM_CPPFLAGS += -DZFS_UBSAN_ENABLED 54endif 55 56AM_LDFLAGS = $(DEBUG_LDFLAGS) 57AM_LDFLAGS += $(ASAN_LDFLAGS) 58AM_LDFLAGS += $(UBSAN_LDFLAGS) 59 60if BUILD_FREEBSD 61AM_LDFLAGS += -fstack-protector-strong 62AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel 63AM_LDFLAGS += -lm 64endif 65 66 67# If a target includes kernel code, generate warnings for large stack frames 68KERNEL_CFLAGS = $(FRAME_LARGER_THAN) 69 70# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020 71LIBRARY_CFLAGS = -no-suppress 72 73# Forcibly enable asserts/debugging for libzpool &al. 74# Since ZFS_DEBUG can change shared data structures, all libzpool users must 75# be compiled with the same flags. 76# See https://github.com/openzfs/zfs/issues/16476 77LIBZPOOL_CPPFLAGS = -DDEBUG -UNDEBUG -DZFS_DEBUG 78