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