xref: /dpdk/kernel/linux/kni/meson.build (revision e16b972b)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2018 Luca Boccassi <[email protected]>
3
4# For SUSE build check function arguments of ndo_tx_timeout API
5# Ref: https://jira.devtools.intel.com/browse/DPDK-29263
6kmod_cflags = ''
7file_path = kernel_source_dir + '/include/linux/netdevice.h'
8run_cmd = run_command('grep', 'ndo_tx_timeout', file_path, check: false)
9
10if run_cmd.stdout().contains('txqueue') == true
11   kmod_cflags = '-DHAVE_ARG_TX_QUEUE'
12endif
13
14
15kni_mkfile = custom_target('rte_kni_makefile',
16        output: 'Makefile',
17        command: ['touch', '@OUTPUT@'])
18
19kni_sources = files(
20        'kni_misc.c',
21        'kni_net.c',
22        'Kbuild',
23)
24
25custom_target('rte_kni',
26        input: kni_sources,
27        output: 'rte_kni.ko',
28        command: ['make', '-j4', '-C', kernel_build_dir,
29            'M=' + meson.current_build_dir(),
30            'src=' + meson.current_source_dir(),
31            ' '.join(['MODULE_CFLAGS=', kmod_cflags,'-include '])
32            + dpdk_source_root + '/config/rte_config.h' +
33            ' -I' + dpdk_source_root + '/lib/eal/include' +
34            ' -I' + dpdk_source_root + '/lib/kni' +
35            ' -I' + dpdk_build_root +
36            ' -I' + meson.current_source_dir(),
37            'modules'] + cross_args,
38        depends: kni_mkfile,
39        install: install,
40        install_dir: kernel_install_dir,
41        build_by_default: get_option('enable_kmods'))
42