2018-01-10 21:49:27 +03:00
#
# Default build rules for all user space components, every Makefile.am
# should include these rules and override or extend them as needed.
#
2021-01-22 23:54:34 +03:00
PHONY =
2019-10-02 20:39:48 +03:00
DEFAULT_INCLUDES = \
2020-06-20 05:08:59 +03:00
-include $(top_builddir)/zfs_config.h \
-I$(top_builddir)/include \
2019-10-02 20:39:48 +03:00
-I$(top_srcdir)/include \
-I$(top_srcdir)/module/icp/include \
-I$(top_srcdir)/lib/libspl/include
if BUILD_LINUX
DEFAULT_INCLUDES += \
-I$(top_srcdir)/lib/libspl/include/os/linux
endif
2010-08-26 22:22:58 +04:00
2020-04-14 21:36:28 +03:00
if BUILD_FREEBSD
DEFAULT_INCLUDES += \
-I$(top_srcdir)/lib/libspl/include/os/freebsd
endif
2010-08-26 22:22:58 +04:00
AM_LIBTOOLFLAGS = --silent
2018-01-10 21:49:27 +03:00
2020-06-17 02:46:04 +03:00
AM_CFLAGS = -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes
AM_CFLAGS += -fno-strict-aliasing
2019-04-14 21:04:54 +03:00
AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
2021-09-14 19:17:54 +03:00
AM_CFLAGS += $(IMPLICIT_FALLTHROUGH)
2018-01-10 21:49:27 +03:00
AM_CFLAGS += $(DEBUG_CFLAGS)
AM_CFLAGS += $(ASAN_CFLAGS)
2022-02-04 01:35:38 +03:00
AM_CFLAGS += $(UBSAN_CFLAGS)
2020-04-14 21:36:28 +03:00
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
if BUILD_FREEBSD
AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
AM_CFLAGS += -I/usr/include -I/usr/local/include
endif
2018-01-10 21:49:27 +03:00
AM_CPPFLAGS = -D_GNU_SOURCE
AM_CPPFLAGS += -D_REENTRANT
AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
Add defs for makefile installation dir vars
Add macro definitions to AM_CPPFLAGS to propagate makefile installation
directory variables for libexecdir, runstatedir, sbindir, and
sysconfdir.
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Installation-Directory-Variables.html
A corollary is that you should not use these variables except
in makefiles. For instance, instead of trying to evaluate
datadir in configure and hard-coding it in makefiles using e.g.,
'AC_DEFINE_UNQUOTED([DATADIR], ["$datadir"], [Data directory.])',
you should add -DDATADIR='$(datadir)' to your makefile's definition
of CPPFLAGS (AM_CPPFLAGS if you are also using Automake).
The runstatedir directory is for "installing data files which the
programs modify while they run, that pertain to one specific machine,
and which need not persist longer than the execution of the program".
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
It will be defined by autoconf 2.70 or later, and default to
"$(localstatedir)/run".
http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=a197431414088a417b407b9b20583b2e8f7363bd
Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2
2014-01-07 04:15:45 +04:00
AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
2021-02-18 08:30:45 +03:00
AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\"
2018-01-10 21:49:27 +03:00
AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
2017-09-23 04:49:57 +03:00
AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
2020-04-14 21:36:28 +03:00
if BUILD_LINUX
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
endif
if BUILD_FREEBSD
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\"
endif
2021-05-25 22:33:52 +03:00
AM_CPPFLAGS += -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))"
2021-05-22 18:19:14 +03:00
AM_CPPFLAGS += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
AM_CPPFLAGS += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
AM_CPPFLAGS += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
2018-01-10 21:49:27 +03:00
2022-02-04 01:35:38 +03:00
if ASAN_ENABLED
AM_CPPFLAGS += -DZFS_ASAN_ENABLED
endif
if UBSAN_ENABLED
AM_CPPFLAGS += -DZFS_UBSAN_ENABLED
endif
2018-01-10 21:49:27 +03:00
AM_LDFLAGS = $(DEBUG_LDFLAGS)
AM_LDFLAGS += $(ASAN_LDFLAGS)
2022-02-04 01:35:38 +03:00
AM_LDFLAGS += $(UBSAN_LDFLAGS)
2020-04-14 21:36:28 +03:00
if BUILD_FREEBSD
AM_LDFLAGS += -fstack-protector-strong -shared
AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
AM_LDFLAGS += -lm
endif