]> git.proxmox.com Git - mirror_zfs.git/blame - config/Rules.am
Linux 6.6 compat: fsync_bdev() has been removed in favor of sync_blockdev()
[mirror_zfs.git] / config / Rules.am
CommitLineData
fed90353
BB
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
0e6c493f 6PHONY =
c8970f52 7AM_CPPFLAGS = \
109d2c93
AS
8 -include $(top_builddir)/zfs_config.h \
9 -I$(top_builddir)/include \
d31277ab
MM
10 -I$(top_srcdir)/include \
11 -I$(top_srcdir)/module/icp/include \
c8970f52
AZ
12 -I$(top_srcdir)/lib/libspl/include \
13 -I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@
9f0a21e6 14
c9c0d073 15AM_LIBTOOLFLAGS = --silent
fed90353 16
a926aab9 17AM_CFLAGS = -std=gnu99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wno-sign-compare -Wno-missing-field-initializers
ae7b167a 18AM_CFLAGS += -fno-strict-aliasing
d5d2ef2b 19AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
6954c22f 20AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
fed90353
BB
21AM_CFLAGS += $(DEBUG_CFLAGS)
22AM_CFLAGS += $(ASAN_CFLAGS)
63652e15 23AM_CFLAGS += $(UBSAN_CFLAGS)
9f0a21e6
MM
24AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
25if BUILD_FREEBSD
26AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
27AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
28AM_CFLAGS += -I/usr/include -I/usr/local/include
9f0a21e6 29endif
fed90353 30
c8970f52 31AM_CPPFLAGS += -D_GNU_SOURCE
fed90353
BB
32AM_CPPFLAGS += -D_REENTRANT
33AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
34AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
07917db9 35AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
b53077a9 36AM_CPPFLAGS += -DZFSEXECDIR=\"$(zfsexecdir)\"
07917db9
CD
37AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
38AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
39AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
658fb802 40AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"
fed90353 41AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
acf04442 42AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
c8970f52
AZ
43AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\"
44
45AM_CPPFLAGS_NOCHECK = -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))"
46AM_CPPFLAGS_NOCHECK += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
47AM_CPPFLAGS_NOCHECK += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
48AM_CPPFLAGS_NOCHECK += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
49AM_CPPFLAGS_NOCHECK += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)"
50AM_CPPFLAGS_NOCHECK += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)"
51AM_CPPFLAGS_NOCHECK += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)"
52AM_CPPFLAGS_NOCHECK += -D"asctime(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime(__VA_ARGS__)"
53AM_CPPFLAGS_NOCHECK += -D"asctime_r(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime_r(__VA_ARGS__)"
54AM_CPPFLAGS_NOCHECK += -D"gmtime(...)=__attribute__((deprecated(\"gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!\"))) gmtime(__VA_ARGS__)"
55AM_CPPFLAGS_NOCHECK += -D"localtime(...)=__attribute__((deprecated(\"localtime(3) isn't thread-safe. Use localtime_r(3) instead!\"))) localtime(__VA_ARGS__)"
7584fbe8
RY
56AM_CPPFLAGS_NOCHECK += -D"strncpy(...)=__attribute__((deprecated(\"strncpy(3) is deprecated. Use strlcpy(3) instead!\"))) strncpy(__VA_ARGS__)"
57
c8970f52 58AM_CPPFLAGS += $(AM_CPPFLAGS_NOCHECK)
fed90353 59
63652e15
DS
60if ASAN_ENABLED
61AM_CPPFLAGS += -DZFS_ASAN_ENABLED
62endif
63
64if UBSAN_ENABLED
65AM_CPPFLAGS += -DZFS_UBSAN_ENABLED
66endif
67
fed90353
BB
68AM_LDFLAGS = $(DEBUG_LDFLAGS)
69AM_LDFLAGS += $(ASAN_LDFLAGS)
63652e15 70AM_LDFLAGS += $(UBSAN_LDFLAGS)
9f0a21e6
MM
71
72if BUILD_FREEBSD
73AM_LDFLAGS += -fstack-protector-strong -shared
74AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
75AM_LDFLAGS += -lm
76endif
c8970f52
AZ
77
78
79# If a target includes kernel code, generate warnings for large stack frames
80KERNEL_CFLAGS = $(FRAME_LARGER_THAN)
81
82# See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020
83LIBRARY_CFLAGS = -no-suppress
84
85# Forcibly enable asserts/debugging for libzpool &al.
86FORCEDEBUG_CPPFLAGS = -DDEBUG -UNDEBUG -DZFS_DEBUG