diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-12-10 11:50:16 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-12-10 11:54:33 +0100 |
commit | 77a34a375197649fa9c5d2ca3e6c97e6bfd6301c (patch) | |
tree | 1a39b913c1ee6cf96362a7b98c22245c30db7f89 /src | |
parent | network: rename SetupState to AdministrativeState (diff) | |
download | systemd-77a34a375197649fa9c5d2ca3e6c97e6bfd6301c.tar.xz systemd-77a34a375197649fa9c5d2ca3e6c97e6bfd6301c.zip |
meson: use subdir_done() to reduce indent
Diffstat (limited to 'src')
-rw-r--r-- | src/core/bpf/meson.build | 114 | ||||
-rw-r--r-- | src/core/bpf/restrict_fs/meson.build | 38 | ||||
-rw-r--r-- | src/core/bpf/restrict_ifaces/meson.build | 38 | ||||
-rw-r--r-- | src/core/bpf/socket_bind/meson.build | 38 |
4 files changed, 118 insertions, 110 deletions
diff --git a/src/core/bpf/meson.build b/src/core/bpf/meson.build index ab1a7167a6..cd0cd3230b 100644 --- a/src/core/bpf/meson.build +++ b/src/core/bpf/meson.build @@ -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 +if conf.get('BPF_FRAMEWORK') != 1 + subdir_done() +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 +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 += [ - '-idirafter', - libbpf_include_dir, - '@INPUT@', - '-o', - '@OUTPUT@' - ] - - bpf_o_cmd = [ - llvm_strip, - '-g', - '@INPUT@', - '-o', - '@OUTPUT@' - ] - - skel_h_cmd = [ - bpftool, - 'g', - 's', - '@INPUT@' - ] +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@' +] diff --git a/src/core/bpf/restrict_fs/meson.build b/src/core/bpf/restrict_fs/meson.build index dfe3f12033..69cde02a7b 100644 --- a/src/core/bpf/restrict_fs/meson.build +++ b/src/core/bpf/restrict_fs/meson.build @@ -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) +if conf.get('BPF_FRAMEWORK') != 1 + subdir_done() +endif - 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_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_skel_h = custom_target( - 'restrict-fs.skel.h', - input : restrict_fs_bpf_o, - output : 'restrict-fs.skel.h', - command : skel_h_cmd, - capture : true) -endif +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) diff --git a/src/core/bpf/restrict_ifaces/meson.build b/src/core/bpf/restrict_ifaces/meson.build index b7e2bc1519..5f36178228 100644 --- a/src/core/bpf/restrict_ifaces/meson.build +++ b/src/core/bpf/restrict_ifaces/meson.build @@ -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) +if conf.get('BPF_FRAMEWORK') != 1 + subdir_done() +endif - 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_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_skel_h = custom_target( - 'restrict-ifaces.skel.h', - input : restrict_ifaces_bpf_o, - output : 'restrict-ifaces.skel.h', - command : skel_h_cmd, - capture : true) -endif +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) diff --git a/src/core/bpf/socket_bind/meson.build b/src/core/bpf/socket_bind/meson.build index 8211a7a5c9..05a2b9daf8 100644 --- a/src/core/bpf/socket_bind/meson.build +++ b/src/core/bpf/socket_bind/meson.build @@ -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) +if conf.get('BPF_FRAMEWORK') != 1 + subdir_done() +endif - 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_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_skel_h = custom_target( - 'socket-bind.skel.h', - input : socket_bind_bpf_o, - output : 'socket-bind.skel.h', - command : skel_h_cmd, - capture : true) -endif +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) |