]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: use subdir_done() to reduce indent
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Dec 2021 10:50:16 +0000 (19:50 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Dec 2021 10:54:33 +0000 (19:54 +0900)
src/core/bpf/meson.build
src/core/bpf/restrict_fs/meson.build
src/core/bpf/restrict_ifaces/meson.build
src/core/bpf/socket_bind/meson.build

index ab1a7167a6c0dbfda01f6e26535fcfb355f8204a..cd0cd3230b4c8f89d2b793cf93c398fd841cd035 100644 (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
+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@'
+]
index dfe3f120337916d7fb936b6d75566d02a4ca26e9..69cde02a7b47d29eecf84ae875bd623887d30907 100644 (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)
+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)
index b7e2bc15197a58c7daedc37d3555322c8d2d949e..5f36178228644d22a9ea4da96a06af150ad28f89 100644 (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)
+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)
index 8211a7a5c91498f0f766ecdec1cebbe489a243da..05a2b9daf80344bd62549e108b3609977b3876b4 100644 (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)
+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)