meson: Determine custom_baud source file only once

Change-Id: I13221bdca7d14a483f416e81e3830a495659a85e
Signed-off-by: Peter Stuge <peter@stuge.se>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/70568
Original-Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Original-Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/73478
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/meson.build b/meson.build
index 3090808..7a91300 100644
--- a/meson.build
+++ b/meson.build
@@ -98,6 +98,12 @@
   add_project_arguments('-DIS_WINDOWS=0', language : 'c')
 endif
 
+if host_machine.system() == 'linux'
+  custom_baud_c = 'custom_baud_linux.c'
+else
+  custom_baud_c = 'custom_baud.c'
+endif
+
 systems_hwaccess   = [ 'linux', 'openbsd', 'freebsd', 'dragonfly', 'netbsd' ]
 systems_serial     = [ 'linux', 'openbsd', 'freebsd', 'dragonfly', 'netbsd', 'darwin' ]
 
@@ -174,7 +180,7 @@
   'buspirate_spi' : {
     'systems' : systems_serial,
     'groups'  : [ group_serial, group_external ],
-    'srcs'    : files('buspirate_spi.c', 'serial.c', (host_machine.system() == 'linux' ? 'custom_baud_linux.c' : 'custom_baud.c')),
+    'srcs'    : files('buspirate_spi.c', 'serial.c', custom_baud_c),
     'flags'   : [ '-DCONFIG_BUSPIRATE_SPI=1' ],
   },
   'ch341a_spi' : {
@@ -377,7 +383,7 @@
   'pony_spi' : {
     'systems' : systems_serial,
     'groups'  : [ group_serial, group_external ],
-    'srcs'    : files('pony_spi.c', 'serial.c', (host_machine.system() == 'linux' ? 'custom_baud_linux.c' : 'custom_baud.c')),
+    'srcs'    : files('pony_spi.c', 'serial.c', custom_baud_c),
     'flags'   : [ '-DCONFIG_PONY_SPI=1' ],
   },
   'rayer_spi' : {
@@ -405,7 +411,7 @@
   'serprog' : {
     'systems' : systems_serial,
     'groups'  : [ group_serial, group_external ],
-    'srcs'    : files('serprog.c', 'serial.c', (host_machine.system() == 'linux' ? 'custom_baud_linux.c' : 'custom_baud.c')),
+    'srcs'    : files('serprog.c', 'serial.c', custom_baud_c),
     'flags'   : [ '-DCONFIG_SERPROG=1' ],
   },
   'stlinkv3_spi' : {