move kernel modules directories
[dpdk.git] / kernel / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 # Initially pull in common settings
5 #eal_inc = [global_inc]
6 #subdir('common') # defines common_sources, common_objs, etc.
7
8 # Now do OS/exec-env specific settings, including building kernel modules
9 # The <exec-env>/eal/meson.build file should define env_sources, etc.
10 if host_machine.system() == 'linux'
11         dpdk_conf.set('RTE_EXEC_ENV_LINUXAPP', 1)
12         subdir('linux/igb_uio')
13
14 elif host_machine.system() == 'freebsd'
15         dpdk_conf.set('RTE_EXEC_ENV_BSDAPP', 1)
16         kmods = ['contigmem', 'nic_uio']
17
18         # for building kernel modules, we use kernel build system using make, as
19         # with Linux. We have a skeleton BSDmakefile, which pulls many of its
20         # values from the environment. Each module only has a single source file
21         # right now, which allows us to simplify things. We pull in the sourcer
22         # files from the individual meson.build files, and then use a custom
23         # target to call make, passing in the values as env parameters.
24         kmod_cflags = ['-I' + meson.build_root(),
25                         '-I' + join_paths(meson.source_root(), 'config'),
26                         '-include rte_config.h']
27         foreach k:kmods
28                 subdir(join_paths('freebsd', k))
29                 custom_target(k,
30                         input: [files('freebsd/BSDmakefile.meson'), sources],
31                         output: k + '.ko',
32                         command: ['make', '-f', '@INPUT0@',
33                                 'KMOD_SRC=@INPUT1@',
34                                 'KMOD=' + k,
35                                 'KMOD_CFLAGS=' + ' '.join(kmod_cflags)],
36                         build_by_default: get_option('enable_kmods'))
37         endforeach
38 else
39         error('unsupported system type @0@'.format(hostmachine.system()))
40 endif
41
42 cflags += '-D_GNU_SOURCE'
43 sources = common_sources + env_sources
44 objs = common_objs + env_objs
45 headers = common_headers + env_headers
46 includes = eal_inc