xref: /dpdk/kernel/freebsd/meson.build (revision 68a03efeed657e6e05f281479b33b51102797e15)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2018 Intel Corporation
3
4kmods = ['contigmem', 'nic_uio']
5
6# for building kernel modules, we use kernel build system using make, as
7# with Linux. We have a skeleton BSDmakefile, which pulls many of its
8# values from the environment. Each module only has a single source file
9# right now, which allows us to simplify things. We pull in the sourcer
10# files from the individual meson.build files, and then use a custom
11# target to call make, passing in the values as env parameters.
12kmod_cflags = ['-I' + meson.build_root(),
13		'-I' + join_paths(meson.source_root(), 'config'),
14		'-include rte_config.h']
15
16# to avoid warnings due to race conditions with creating the dev_if.h, etc.
17# files, serialize the kernel module builds. Each module will depend on
18# previous ones
19built_kmods = []
20foreach k:kmods
21	subdir(k)
22	built_kmods += custom_target(k,
23		input: [files('BSDmakefile.meson'), sources],
24		output: k + '.ko',
25		command: ['make', '-f', '@INPUT0@',
26			'KMOD_OBJDIR=@OUTDIR@',
27			'KMOD_SRC=@INPUT1@',
28			'KMOD=' + k,
29			'KMOD_CFLAGS=' + ' '.join(kmod_cflags),
30			'CC=clang'],
31		depends: built_kmods, # make each module depend on prev
32		build_by_default: get_option('enable_kmods'),
33		install: get_option('enable_kmods'),
34		install_dir: '/boot/modules/')
35endforeach
36