Fix potential use-after-frees in FreeBSD getpages and setattr VOPs
[zfs.git] / config / Rules.am
blob20779ba49259aa956438bb477313849f37dac980
2 # Default build rules for all user space components, every Makefile.am
3 # should include these rules and override or extend them as needed.
6 PHONY =
7 DEFAULT_INCLUDES = \
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
14 if BUILD_LINUX
15 DEFAULT_INCLUDES += \
16         -I$(top_srcdir)/lib/libspl/include/os/linux
17 endif
19 if BUILD_FREEBSD
20 DEFAULT_INCLUDES += \
21         -I$(top_srcdir)/lib/libspl/include/os/freebsd
22 endif
24 AM_LIBTOOLFLAGS = --silent
26 AM_CFLAGS  = -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes
27 AM_CFLAGS += -fno-strict-aliasing
28 AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
29 AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
30 AM_CFLAGS += $(DEBUG_CFLAGS)
31 AM_CFLAGS += $(ASAN_CFLAGS)
32 AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
33 if BUILD_FREEBSD
34 AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
35 AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
36 AM_CFLAGS += -I/usr/include -I/usr/local/include
37 endif
39 AM_CPPFLAGS  = -D_GNU_SOURCE
40 AM_CPPFLAGS += -D_REENTRANT
41 AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
42 AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
43 AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
44 AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
45 AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
46 AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
47 AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"
48 AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
49 AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
50 if BUILD_LINUX
51 AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
52 endif
53 if BUILD_FREEBSD
54 AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\"
55 endif
56 AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))"
57 AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
58 AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
59 AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
61 AM_LDFLAGS  = $(DEBUG_LDFLAGS)
62 AM_LDFLAGS += $(ASAN_LDFLAGS)
64 if BUILD_FREEBSD
65 AM_LDFLAGS += -fstack-protector-strong -shared
66 AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
67 AM_LDFLAGS += -lm
68 endif