New upstream version 18.08
[deb_dpdk.git] / kernel / freebsd / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2018 Intel Corporation
3
4 kmods = ['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.
12 kmod_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
19 built_kmods = []
20 foreach 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                 depends: built_kmods, # make each module depend on prev
31                 build_by_default: get_option('enable_kmods'))
32 endforeach