meson: use subdir_done() to reduce indent

This commit is contained in:
Yu Watanabe
2021-12-10 19:54:33 +09:00
parent ea5e55b311
commit 77a34a3751
4 changed files with 123 additions and 115 deletions
+60 -58
View File
@@ -1,61 +1,63 @@
# SPDX-License-Identifier: LGPL-2.1+
if conf.get('BPF_FRAMEWORK') == 1
clang_flags = [
'-Wno-compare-distinct-pointer-types',
'-O2',
'-target',
'bpf',
'-g',
'-c',
]
clang_arch_flag = '-D__@0@__'.format(host_machine.cpu_family())
if meson.version().version_compare('>= 0.58')
libbpf_include_dir = libbpf.get_variable('includedir')
else
libbpf_include_dir = libbpf.get_variable(pkgconfig : 'includedir')
endif
bpf_o_unstripped_cmd = [
clang,
clang_flags,
clang_arch_flag,
'-I.'
]
if not meson.is_cross_build()
target_triplet_cmd = run_command('gcc', '-dumpmachine', check: false)
if target_triplet_cmd.returncode() == 0
target_triplet = target_triplet_cmd.stdout().strip()
bpf_o_unstripped_cmd += [
'-isystem',
'/usr/include/@0@'.format(target_triplet)
]
endif
endif
bpf_o_unstripped_cmd += [
'-idirafter',
libbpf_include_dir,
'@INPUT@',
'-o',
'@OUTPUT@'
]
bpf_o_cmd = [
llvm_strip,
'-g',
'@INPUT@',
'-o',
'@OUTPUT@'
]
skel_h_cmd = [
bpftool,
'g',
's',
'@INPUT@'
]
if conf.get('BPF_FRAMEWORK') != 1
subdir_done()
endif
clang_flags = [
'-Wno-compare-distinct-pointer-types',
'-O2',
'-target',
'bpf',
'-g',
'-c',
]
clang_arch_flag = '-D__@0@__'.format(host_machine.cpu_family())
if meson.version().version_compare('>= 0.58')
libbpf_include_dir = libbpf.get_variable('includedir')
else
libbpf_include_dir = libbpf.get_variable(pkgconfig : 'includedir')
endif
bpf_o_unstripped_cmd = [
clang,
clang_flags,
clang_arch_flag,
'-I.'
]
if not meson.is_cross_build()
target_triplet_cmd = run_command('gcc', '-dumpmachine', check: false)
if target_triplet_cmd.returncode() == 0
target_triplet = target_triplet_cmd.stdout().strip()
bpf_o_unstripped_cmd += [
'-isystem',
'/usr/include/@0@'.format(target_triplet)
]
endif
endif
bpf_o_unstripped_cmd += [
'-idirafter',
libbpf_include_dir,
'@INPUT@',
'-o',
'@OUTPUT@'
]
bpf_o_cmd = [
llvm_strip,
'-g',
'@INPUT@',
'-o',
'@OUTPUT@'
]
skel_h_cmd = [
bpftool,
'g',
's',
'@INPUT@'
]
+21 -19
View File
@@ -1,22 +1,24 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('BPF_FRAMEWORK') == 1
restrict_fs_bpf_o_unstripped = custom_target(
'restrict-fs.bpf.unstripped.o',
input : 'restrict-fs.bpf.c',
output : 'restrict-fs.bpf.unstripped.o',
command : bpf_o_unstripped_cmd)
restrict_fs_bpf_o = custom_target(
'restrict-fs.bpf.o',
input : restrict_fs_bpf_o_unstripped,
output : 'restrict-fs.bpf.o',
command : bpf_o_cmd)
restrict_fs_skel_h = custom_target(
'restrict-fs.skel.h',
input : restrict_fs_bpf_o,
output : 'restrict-fs.skel.h',
command : skel_h_cmd,
capture : true)
if conf.get('BPF_FRAMEWORK') != 1
subdir_done()
endif
restrict_fs_bpf_o_unstripped = custom_target(
'restrict-fs.bpf.unstripped.o',
input : 'restrict-fs.bpf.c',
output : 'restrict-fs.bpf.unstripped.o',
command : bpf_o_unstripped_cmd)
restrict_fs_bpf_o = custom_target(
'restrict-fs.bpf.o',
input : restrict_fs_bpf_o_unstripped,
output : 'restrict-fs.bpf.o',
command : bpf_o_cmd)
restrict_fs_skel_h = custom_target(
'restrict-fs.skel.h',
input : restrict_fs_bpf_o,
output : 'restrict-fs.skel.h',
command : skel_h_cmd,
capture : true)
+21 -19
View File
@@ -1,22 +1,24 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('BPF_FRAMEWORK') == 1
restrict_ifaces_bpf_o_unstripped = custom_target(
'restrict-ifaces.bpf.unstripped.o',
input : 'restrict-ifaces.bpf.c',
output : 'restrict-ifaces.bpf.unstripped.o',
command : bpf_o_unstripped_cmd)
restrict_ifaces_bpf_o = custom_target(
'restrict-ifaces.bpf.o',
input : restrict_ifaces_bpf_o_unstripped,
output : 'restrict-ifaces.bpf.o',
command : bpf_o_cmd)
restrict_ifaces_skel_h = custom_target(
'restrict-ifaces.skel.h',
input : restrict_ifaces_bpf_o,
output : 'restrict-ifaces.skel.h',
command : skel_h_cmd,
capture : true)
if conf.get('BPF_FRAMEWORK') != 1
subdir_done()
endif
restrict_ifaces_bpf_o_unstripped = custom_target(
'restrict-ifaces.bpf.unstripped.o',
input : 'restrict-ifaces.bpf.c',
output : 'restrict-ifaces.bpf.unstripped.o',
command : bpf_o_unstripped_cmd)
restrict_ifaces_bpf_o = custom_target(
'restrict-ifaces.bpf.o',
input : restrict_ifaces_bpf_o_unstripped,
output : 'restrict-ifaces.bpf.o',
command : bpf_o_cmd)
restrict_ifaces_skel_h = custom_target(
'restrict-ifaces.skel.h',
input : restrict_ifaces_bpf_o,
output : 'restrict-ifaces.skel.h',
command : skel_h_cmd,
capture : true)
+21 -19
View File
@@ -1,22 +1,24 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('BPF_FRAMEWORK') == 1
socket_bind_bpf_o_unstripped = custom_target(
'socket-bind.bpf.unstripped.o',
input : 'socket-bind.bpf.c',
output : 'socket-bind.bpf.unstripped.o',
command : bpf_o_unstripped_cmd)
socket_bind_bpf_o = custom_target(
'socket-bind.bpf.o',
input : socket_bind_bpf_o_unstripped,
output : 'socket-bind.bpf.o',
command : bpf_o_cmd)
socket_bind_skel_h = custom_target(
'socket-bind.skel.h',
input : socket_bind_bpf_o,
output : 'socket-bind.skel.h',
command : skel_h_cmd,
capture : true)
if conf.get('BPF_FRAMEWORK') != 1
subdir_done()
endif
socket_bind_bpf_o_unstripped = custom_target(
'socket-bind.bpf.unstripped.o',
input : 'socket-bind.bpf.c',
output : 'socket-bind.bpf.unstripped.o',
command : bpf_o_unstripped_cmd)
socket_bind_bpf_o = custom_target(
'socket-bind.bpf.o',
input : socket_bind_bpf_o_unstripped,
output : 'socket-bind.bpf.o',
command : bpf_o_cmd)
socket_bind_skel_h = custom_target(
'socket-bind.skel.h',
input : socket_bind_bpf_o,
output : 'socket-bind.skel.h',
command : skel_h_cmd,
capture : true)