summaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-01-10 13:28:48 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-01-10 13:28:48 +0000
commit1a1415cc671f7f4f88c658d81536f60171859fe1 (patch)
treeae625d632bc396d0b1dba61edf1eb157fa15b4c0 /flashrom.c
parent643415bfdb160a1277ac490b85c7473ab2473495 (diff)
downloadflashrom-1a1415cc671f7f4f88c658d81536f60171859fe1.tar.gz
flashrom-1a1415cc671f7f4f88c658d81536f60171859fe1.tar.bz2
flashrom-1a1415cc671f7f4f88c658d81536f60171859fe1.zip
Refine selection of the default programmer
If neither internal (old default) nor dummy (safe default) programmer are selected, we must pick a sensible default programmer. Since there is no reason to prefer a particular external programmer, we abort compilation if more than one of them is selected. If only one is selected, it is clear that the user wants that one to become the default. This fixes single-programmer compilation. Corresponding to flashrom svn r858. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Sean Nelson <audiohacked@gmail.com>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/flashrom.c b/flashrom.c
index 8befab36c..db44c2f71 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -39,8 +39,37 @@ enum programmer programmer = PROGRAMMER_INTERNAL;
#elif DUMMY_SUPPORT == 1
enum programmer programmer = PROGRAMMER_DUMMY;
#else
-/* Activating the #error explodes on make dep. */
-//#error Neither internal nor dummy selected
+/* If neither internal nor dummy are selected, we must pick a sensible default.
+ * Since there is no reason to prefer a particular external programmer, we fail
+ * if more than one of them is selected. If only one is selected, it is clear
+ * that the user wants that one to become the default.
+ */
+#if NIC3COM_SUPPORT+GFXNVIDIA_SUPPORT+DRKAISER_SUPPORT+SATASII_SUPPORT+FT2232_SPI_SUPPORT+SERPROG_SUPPORT+BUSPIRATE_SPI_SUPPORT > 1
+#error Please enable either CONFIG_DUMMY or CONFIG_INTERNAL or disable support for all external programmers except one.
+#endif
+enum programmer programmer =
+#if NIC3COM_SUPPORT == 1
+ PROGRAMMER_NIC3COM
+#endif
+#if GFXNVIDIA_SUPPORT == 1
+ PROGRAMMER_GFXNVIDIA
+#endif
+#if DRKAISER_SUPPORT == 1
+ PROGRAMMER_DRKAISER
+#endif
+#if SATASII_SUPPORT == 1
+ PROGRAMMER_SATASII
+#endif
+#if FT2232_SPI_SUPPORT == 1
+ PROGRAMMER_FT2232SPI
+#endif
+#if SERPROG_SUPPORT == 1
+ PROGRAMMER_SERPROG
+#endif
+#if BUSPIRATE_SPI_SUPPORT == 1
+ PROGRAMMER_BUSPIRATESPI
+#endif
+;
#endif
char *programmer_param = NULL;