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