CONFIG_DEFAULT_PROGRAMMER_NAME: Use programmer name instead of enum

CONFIG_DEFAULT_PROGRAMER_NAME replaces CONFIG_DEFAULT_PROGRAMMER.
It uses the name of the programmer for identification.
make CONFIG_DEFAULT_PROGRAMER_NAME=dummy and
meson -Ddefault_programmer_name=dummy will extend to
CONFIG_DEFAULT_PROGRAMER_NAME=&programmer_dummy in the code.

Change-Id: I976447787c6f6bfbdc0145d80d61e1ddcf97ac33
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/55123
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71380
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/meson.build b/meson.build
index 580dc53..9d35cc4 100644
--- a/meson.build
+++ b/meson.build
@@ -62,6 +62,8 @@
 config_serprog = get_option('config_serprog')
 config_usbblaster_spi = get_option('config_usbblaster_spi')
 config_stlinkv3_spi = get_option('config_stlinkv3_spi')
+config_default_programmer_name = get_option('default_programmer_name')
+config_default_programmer_args = get_option('default_programmer_args')
 
 cargs = []
 deps = []
@@ -381,6 +383,14 @@
   dependencies : deps
 )
 
+if config_default_programmer_name != ''
+  cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=&programmer_' + config_default_programmer_name
+else
+  cargs += '-DCONFIG_DEFAULT_PROGRAMMER_NAME=NULL'
+endif
+
+cargs += '-DCONFIG_DEFAULT_PROGRAMMER_ARGS="' + config_default_programmer_args + '"'
+
 # we can't just link_with libflashrom as we require all the internal symbols...
 executable(
   'flashrom',
@@ -397,8 +407,6 @@
   c_args : [
     cargs,
     '-DSTANDALONE',
-    '-DCONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_INVALID',
-    '-DCONFIG_DEFAULT_PROGRAMMER_ARGS=""',
   ],
   install : true,
   install_dir : sbindir,