kernel/linux: fix modules install path
[dpdk.git] / kernel / linux / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2018 Intel Corporation
3
4 subdirs = ['igb_uio', 'kni']
5
6 # if we are cross-compiling we need kernel_dir specified
7 if get_option('kernel_dir') == '' and meson.is_cross_build()
8         warning('Need "kernel_dir" option for kmod compilation when cross-compiling')
9         subdir_done()
10 endif
11
12 kernel_dir = get_option('kernel_dir')
13 if kernel_dir == ''
14         # use default path for native builds
15         kernel_version = run_command('uname', '-r').stdout().strip()
16         kernel_dir = '/lib/modules/' + kernel_version
17 endif
18
19 # test running make in kernel directory, using "make kernelversion"
20 make_returncode = run_command('make', '-sC', kernel_dir + '/build',
21                 'kernelversion').returncode()
22 if make_returncode != 0
23         warning('Cannot compile kernel modules as requested - are kernel headers installed?')
24         subdir_done()
25 endif
26
27 # DO ACTUAL MODULE BUILDING
28 foreach d:subdirs
29         subdir(d)
30 endforeach