build: remove library special cases
[dpdk.git] / lib / librte_eal / meson.build
1 #   BSD LICENSE
2 #
3 #   Copyright(c) 2017 Intel Corporation.
4 #   All rights reserved.
5 #
6 #   Redistribution and use in source and binary forms, with or without
7 #   modification, are permitted provided that the following conditions
8 #   are met:
9 #
10 #     * Redistributions of source code must retain the above copyright
11 #       notice, this list of conditions and the following disclaimer.
12 #     * Redistributions in binary form must reproduce the above copyright
13 #       notice, this list of conditions and the following disclaimer in
14 #       the documentation and/or other materials provided with the
15 #       distribution.
16 #     * Neither the name of Intel Corporation nor the names of its
17 #       contributors may be used to endorse or promote products derived
18 #       from this software without specific prior written permission.
19 #
20 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 #   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 #   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 #   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 #   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 #   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 #   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 #   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 #   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 # Custom EAL processing. EAL is complicated enough that it can't just
33 # have a straight list of headers and source files.
34 # Initially pull in common settings
35 eal_inc = [global_inc]
36 subdir('common') # defines common_sources, common_objs, etc.
37
38 # Now do OS/exec-env specific settings, including building kernel modules
39 # The <exec-env>/eal/meson.build file should define env_sources, etc.
40 if host_machine.system() == 'linux'
41         dpdk_conf.set('RTE_EXEC_ENV_LINUXAPP', 1)
42         subdir('linuxapp/eal')
43         subdir('linuxapp/igb_uio')
44
45 elif host_machine.system() == 'freebsd'
46         dpdk_conf.set('RTE_EXEC_ENV_BSDAPP', 1)
47         subdir('bsdapp/eal')
48         kmods = ['contigmem', 'nic_uio']
49
50         # for building kernel modules, we use kernel build system using make, as
51         # with Linux. We have a skeleton BSDmakefile, which pulls many of its
52         # values from the environment. Each module only has a single source file
53         # right now, which allows us to simplify things. We pull in the sourcer
54         # files from the individual meson.build files, and then use a custom
55         # target to call make, passing in the values as env parameters.
56         kmod_cflags = ['-I' + meson.build_root(),
57                         '-I' + join_paths(meson.source_root(), 'config'),
58                         '-include rte_config.h']
59         foreach k:kmods
60                 subdir(join_paths('bsdapp', k))
61                 custom_target(k,
62                         input: [files('bsdapp/BSDmakefile.meson'), sources],
63                         output: k + '.ko',
64                         command: ['make', '-f', '@INPUT0@',
65                                 'KMOD_SRC=@INPUT1@',
66                                 'KMOD=' + k,
67                                 'VPATH=' + join_paths(meson.current_source_dir(), k),
68                                 'KMOD_CFLAGS=' + ' '.join(kmod_cflags)],
69                         build_by_default: get_option('enable_kmods'))
70         endforeach
71 else
72         error('unsupported system type @0@'.format(hostmachine.system()))
73 endif
74
75 version = 6  # the version of the EAL API
76 allow_experimental_apis = true
77 cflags += '-D_GNU_SOURCE'
78 sources = common_sources + env_sources
79 objs = common_objs + env_objs
80 headers = common_headers + env_headers
81 includes = eal_inc