xref: /freebsd/sys/contrib/openzfs/config/Rules.am (revision e2eeea75eb8b6dd50c1298067a0655880d186734)
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
6DEFAULT_INCLUDES = \
7	-include $(top_builddir)/zfs_config.h \
8	-I$(top_builddir)/include \
9	-I$(top_srcdir)/include \
10	-I$(top_srcdir)/module/icp/include \
11	-I$(top_srcdir)/lib/libspl/include
12
13if BUILD_LINUX
14DEFAULT_INCLUDES += \
15	-I$(top_srcdir)/lib/libspl/include/os/linux
16endif
17
18if BUILD_FREEBSD
19DEFAULT_INCLUDES += \
20	-I$(top_srcdir)/lib/libspl/include/os/freebsd
21endif
22
23AM_LIBTOOLFLAGS = --silent
24
25AM_CFLAGS  = -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes
26AM_CFLAGS += -fno-strict-aliasing
27AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
28AM_CFLAGS += $(DEBUG_CFLAGS)
29AM_CFLAGS += $(ASAN_CFLAGS)
30AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
31if BUILD_FREEBSD
32AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
33AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
34AM_CFLAGS += -I/usr/include -I/usr/local/include
35endif
36
37AM_CPPFLAGS  = -D_GNU_SOURCE
38AM_CPPFLAGS += -D_REENTRANT
39AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
40AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
41AM_CPPFLAGS += -DHAVE_LARGE_STACKS=1
42AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
43AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
44AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
45AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
46AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
47AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
48if BUILD_LINUX
49AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
50endif
51if BUILD_FREEBSD
52AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\"
53endif
54
55AM_LDFLAGS  = $(DEBUG_LDFLAGS)
56AM_LDFLAGS += $(ASAN_LDFLAGS)
57
58if BUILD_FREEBSD
59AM_LDFLAGS += -fstack-protector-strong -shared
60AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
61AM_LDFLAGS += -lm
62endif
63