From 0e031d5e0bddc17cf912743ab07409b946977420 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 25 Jul 2025 11:37:29 +0200 Subject: [PATCH] meson: inline output file names 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 | 18 ++++++------------ src/shared/meson.build | 18 ++++++------------ src/udev/meson.build | 6 ++---- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/basic/meson.build b/src/basic/meson.build index d21c47af8b6..82f50d6d06f 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build @@ -129,25 +129,22 @@ foreach item : [ ['errno', [], '', [''], ], ] - 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) diff --git a/src/shared/meson.build b/src/shared/meson.build index 97e15a0a5d7..9466a1742e1 100644 --- a/src/shared/meson.build +++ b/src/shared/meson.build @@ -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@', ''], 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 diff --git a/src/udev/meson.build b/src/udev/meson.build index 7e49959bc5d..dc54d4e6887 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -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', -- 2.47.3