xref: /freebsd/sys/contrib/openzfs/config/Rules.am (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
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 += $(IMPLICIT_FALLTHROUGH)
30AM_CFLAGS += $(DEBUG_CFLAGS)
31AM_CFLAGS += $(ASAN_CFLAGS)
32AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
33if BUILD_FREEBSD
34AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
35AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
36AM_CFLAGS += -I/usr/include -I/usr/local/include
37endif
38
39AM_CPPFLAGS  = -D_GNU_SOURCE
40AM_CPPFLAGS += -D_REENTRANT
41AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
42AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
43AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
44AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
45AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
46AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
47AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"
48AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
49AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
50if BUILD_LINUX
51AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
52endif
53if BUILD_FREEBSD
54AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\"
55endif
56AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))"
57AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
58AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
59AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
60
61AM_LDFLAGS  = $(DEBUG_LDFLAGS)
62AM_LDFLAGS += $(ASAN_LDFLAGS)
63
64if BUILD_FREEBSD
65AM_LDFLAGS += -fstack-protector-strong -shared
66AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
67AM_LDFLAGS += -lm
68endif
69