meson: inline output file names

Before 7d247d3cb8, 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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-07-25 12:33:13 +02:00
parent 92716a079f
commit 0e031d5e0b
3 changed files with 14 additions and 28 deletions
+6 -12
View 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)