xref: /freebsd/sys/contrib/openzfs/module/Kbuild.in (revision cab6a39d7b343596a5823e65c0f7b426551ec22d)
1# When integrated in to a monolithic kernel the spl module must appear
2# first.  This ensures its module initialization function is run before
3# any of the other module initialization functions which depend on it.
4ZFS_MODULES += spl/
5ZFS_MODULES += avl/
6ZFS_MODULES += icp/
7ZFS_MODULES += lua/
8ZFS_MODULES += nvpair/
9ZFS_MODULES += unicode/
10ZFS_MODULES += zcommon/
11ZFS_MODULES += zfs/
12ZFS_MODULES += zstd/
13
14# The rest is only relevant when run by kbuild
15ifneq ($(KERNELRELEASE),)
16
17obj-$(CONFIG_ZFS) := $(ZFS_MODULES)
18
19ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
20ZFS_MODULE_CFLAGS += -Wmissing-prototypes
21ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@  @NO_FORMAT_ZERO_LENGTH@
22
23ifneq ($(KBUILD_EXTMOD),)
24zfs_include = @abs_top_srcdir@/include
25ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
26ZFS_MODULE_CFLAGS += -I@abs_top_builddir@/include
27else
28zfs_include = $(srctree)/include/zfs
29ZFS_MODULE_CFLAGS += -include $(zfs_include)/zfs_config.h
30endif
31
32ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/kernel
33ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/spl
34ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/zfs
35ZFS_MODULE_CFLAGS += -I$(zfs_include)
36ZFS_MODULE_CPPFLAGS += -D_KERNEL
37ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@
38
39ifneq ($(KBUILD_EXTMOD),)
40@CONFIG_QAT_TRUE@ZFS_MODULE_CFLAGS += -I@QAT_SRC@/include
41@CONFIG_QAT_TRUE@KBUILD_EXTRA_SYMBOLS += @QAT_SYMBOLS@
42endif
43
44subdir-asflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
45subdir-ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
46
47endif
48