CI: Move perl script to dist_noinst_DATA
[zfs.git] / config / Rules.am
blob7c266964f3f3cc0864a330a22e3962373f993f43
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 AM_CPPFLAGS = \
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         -I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@
15 AM_LIBTOOLFLAGS = --silent
17 AM_CFLAGS  = -std=gnu99 -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wno-sign-compare -Wno-missing-field-initializers
18 AM_CFLAGS += -fno-strict-aliasing
19 AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
20 AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
21 AM_CFLAGS += $(DEBUG_CFLAGS)
22 AM_CFLAGS += $(ASAN_CFLAGS)
23 AM_CFLAGS += $(UBSAN_CFLAGS)
24 AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
25 if BUILD_FREEBSD
26 AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
27 AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
28 AM_CFLAGS += -I/usr/include -I/usr/local/include
29 endif
31 AM_CPPFLAGS += -D_GNU_SOURCE
32 AM_CPPFLAGS += -D_REENTRANT
33 AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
34 AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
35 AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
36 AM_CPPFLAGS += -DZFSEXECDIR=\"$(zfsexecdir)\"
37 AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
38 AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
39 AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
40 AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"
41 AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
42 AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
43 AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\"
45 AM_CPPFLAGS_NOCHECK  = -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))"
46 AM_CPPFLAGS_NOCHECK += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
47 AM_CPPFLAGS_NOCHECK += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
48 AM_CPPFLAGS_NOCHECK += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
49 AM_CPPFLAGS_NOCHECK += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)"
50 AM_CPPFLAGS_NOCHECK += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)"
51 AM_CPPFLAGS_NOCHECK += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)"
52 AM_CPPFLAGS_NOCHECK += -D"asctime(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime(__VA_ARGS__)"
53 AM_CPPFLAGS_NOCHECK += -D"asctime_r(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime_r(__VA_ARGS__)"
54 AM_CPPFLAGS_NOCHECK += -D"gmtime(...)=__attribute__((deprecated(\"gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!\"))) gmtime(__VA_ARGS__)"
55 AM_CPPFLAGS_NOCHECK += -D"localtime(...)=__attribute__((deprecated(\"localtime(3) isn't thread-safe. Use localtime_r(3) instead!\"))) localtime(__VA_ARGS__)"
56 AM_CPPFLAGS_NOCHECK += -D"strncpy(...)=__attribute__((deprecated(\"strncpy(3) is deprecated. Use strlcpy(3) instead!\"))) strncpy(__VA_ARGS__)"
58 AM_CPPFLAGS += $(AM_CPPFLAGS_NOCHECK)
60 if ASAN_ENABLED
61 AM_CPPFLAGS += -DZFS_ASAN_ENABLED
62 endif
64 if UBSAN_ENABLED
65 AM_CPPFLAGS += -DZFS_UBSAN_ENABLED
66 endif
68 AM_LDFLAGS  = $(DEBUG_LDFLAGS)
69 AM_LDFLAGS += $(ASAN_LDFLAGS)
70 AM_LDFLAGS += $(UBSAN_LDFLAGS)
72 if BUILD_FREEBSD
73 AM_LDFLAGS += -fstack-protector-strong -shared
74 AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
75 AM_LDFLAGS += -lm
76 endif
79 # If a target includes kernel code, generate warnings for large stack frames
80 KERNEL_CFLAGS       = $(FRAME_LARGER_THAN)
82 # See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54020
83 LIBRARY_CFLAGS      = -no-suppress
85 # Forcibly enable asserts/debugging for libzpool &al.
86 FORCEDEBUG_CPPFLAGS = -DDEBUG -UNDEBUG -DZFS_DEBUG