]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: inline output file names
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 25 Jul 2025 09:37:29 +0000 (11:37 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 25 Jul 2025 10:33:13 +0000 (12:33 +0200)
Before 7d247d3cb875e1778e6cc81dbf255b13092b29e0, we needed the file name
twice. But now we only need it once, so no need to overcomplicate things
by defining a variable with a single use.

When a variable is used, it's also easier to make a mistake and e.g.
accidentally reuse the variable later.

src/basic/meson.build
src/shared/meson.build
src/udev/meson.build

index d21c47af8b699182c2824797bd51dc351c1960f3..82f50d6d06f35f23d1b6ceef6d26d681b4dfcc82 100644 (file)
@@ -129,25 +129,22 @@ foreach item : [
         ['errno',      [],                 '',        ['<errno.h>'],            ],
 ]
 
-        fname = '@0@-list.txt'.format(item[0])
         generate_list = files('generate-@0@-list.sh'.format(item[0]))
         list_txt = custom_target(
                 input : [generate_list, item[1]],
-                output : fname,
+                output : '@0@-list.txt'.format(item[0]),
                 command : [env, 'bash', generate_list, cpp, system_include_args],
                 capture : true)
 
-        fname = '@0@-from-name.gperf'.format(item[0])
         gperf_file = custom_target(
                 input : list_txt,
-                output : fname,
+                output : '@0@-from-name.gperf'.format(item[0]),
                 command : [generate_gperfs, item[0], item[2], '@INPUT@'] + item[3],
                 capture : true)
 
-        fname = '@0@-from-name.inc'.format(item[0])
         target1 = custom_target(
                 input : gperf_file,
-                output : fname,
+                output : '@0@-from-name.inc'.format(item[0]),
                 command : [gperf,
                            '-L', 'ANSI-C', '-t', '--ignore-case',
                            '-N', 'lookup_@0@'.format(item[0]),
@@ -156,11 +153,10 @@ foreach item : [
                            '@INPUT@'],
                 capture : true)
 
-        fname = '@0@-to-name.inc'.format(item[0])
         awkscript = '@0@-to-name.awk'.format(item[0])
         target2 = custom_target(
                 input : [awkscript, list_txt],
-                output : fname,
+                output : '@0@-to-name.inc'.format(item[0]),
                 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
                 capture : true)
 
@@ -191,19 +187,17 @@ filesystems_gperf_h = custom_target(
         command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
 
 generate_filesystem_list = find_program('generate-filesystem-list.py')
-fname = 'filesystem-list.inc'
 filesystem_list_inc = custom_target(
         input : 'filesystems-gperf.gperf',
-        output : fname,
+        output : 'filesystem-list.inc',
         command : [generate_filesystem_list,
                    '@INPUT@'],
         capture : true)
 
 generate_filesystem_switch_case_inc = find_program('generate-filesystem-switch-case.py')
-fname = 'filesystem-switch-case.inc'
 filesystem_switch_case_inc = custom_target(
         input : 'filesystems-gperf.gperf',
-        output : fname,
+        output : 'filesystem-switch-case.inc',
         command : [generate_filesystem_switch_case_inc,
                    '@INPUT@'],
         capture : true)
index 97e15a0a5d73561ec3a04bd3f8964f6710fb7def..9466a1742e1d466e1ff2d7050a3c348aaa242909 100644 (file)
@@ -232,10 +232,9 @@ if get_option('tests') != 'false'
 endif
 
 generate_syscall_list = find_program('generate-syscall-list.py')
-fname = 'syscall-list.inc'
 syscall_list_inc = custom_target(
         input : syscall_list_txt,
-        output : fname,
+        output : 'syscall-list.inc',
         command : [generate_syscall_list,
                    '@INPUT@'],
         capture : true)
@@ -266,17 +265,15 @@ ip_protocol_list_txt = custom_target(
         command : [env, 'bash', generate_ip_protocol_list, cpp, system_include_args],
         capture : true)
 
-fname = 'ip-protocol-from-name.gperf'
 gperf_file = custom_target(
         input : ip_protocol_list_txt,
-        output : fname,
+        output : 'ip-protocol-from-name.gperf',
         command : [generate_gperfs, 'ip_protocol', 'IPPROTO_', '@INPUT@', '<netinet/in.h>'],
         capture : true)
 
-fname = 'ip-protocol-from-name.inc'
 target1 = custom_target(
         input : gperf_file,
-        output : fname,
+        output : 'ip-protocol-from-name.inc',
         command : [gperf,
                    '-L', 'ANSI-C', '-t', '--ignore-case',
                    '-N', 'lookup_ip_protocol',
@@ -285,11 +282,10 @@ target1 = custom_target(
                    '@INPUT@'],
         capture : true)
 
-fname = 'ip-protocol-to-name.inc'
 awkscript = 'ip-protocol-to-name.awk'
 target2 = custom_target(
         input : [awkscript, ip_protocol_list_txt],
-        output : fname,
+        output : 'ip-protocol-to-name.inc',
         command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
         capture : true)
 
@@ -297,10 +293,9 @@ generated_sources += [target1, target2]
 shared_sources += [target1, target2]
 
 ethtool_link_mode_py = files('ethtool-link-mode.py')
-fname = 'ethtool-link-mode.inc'
 ethtool_link_mode_inc = custom_target(
         input : [ethtool_link_mode_py, ethtool_link_mode_sources],
-        output : fname,
+        output : 'ethtool-link-mode.inc',
         command : [python, ethtool_link_mode_py, '--header', cpp, system_include_args],
         capture : true)
 
@@ -308,10 +303,9 @@ generated_sources += ethtool_link_mode_inc
 shared_sources += ethtool_link_mode_inc
 sources += shared_sources
 
-fname = 'ethtool-link-mode.xml'
 ethtool_link_mode_xml = custom_target(
         input : [ethtool_link_mode_py, ethtool_link_mode_sources],
-        output : fname,
+        output : 'ethtool-link-mode.xml',
         command : [python, ethtool_link_mode_py, '--xml', cpp, system_include_args],
         capture : true)
 man_page_depends += ethtool_link_mode_xml
index 7e49959bc5d1c0ea94ac47c608913280e5e856d3..dc54d4e68878c2f419043faaf053d40648073ffa 100644 (file)
@@ -69,17 +69,15 @@ keyboard_keys_list_txt = custom_target(
         capture : true)
 
 generate_keyboard_keys_gperf = files('generate-keyboard-keys-gperf.sh')
-fname = 'keyboard-keys-from-name.gperf'
 gperf_file = custom_target(
         input : [generate_keyboard_keys_gperf, keyboard_keys_list_txt],
-        output : fname,
+        output : 'keyboard-keys-from-name.gperf',
         command : [env, 'bash', '@INPUT@'],
         capture : true)
 
-fname = 'keyboard-keys-from-name.inc'
 keyboard_keys_from_name_inc = custom_target(
         input : gperf_file,
-        output : fname,
+        output : 'keyboard-keys-from-name.inc',
         command : [gperf,
                    '-L', 'ANSI-C', '-t',
                    '-N', 'keyboard_lookup_key',