[flashrom] [PATCH] Override incompatible CONFIG_FOO for DOS

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Sat Jun 12 22:35:25 CEST 2010


On 05.06.2010 00:06, Carl-Daniel Hailfinger wrote:
> Override incompatible CONFIG_FOO settings for DOS. This allows you to
> specify CONFIG_FOO=yes for all drivers and still get only those which
> compile under DOS.
>   

Silently disabling explicitly requested features is a really bad idea.
This new patch instead warns the user if any impossible (i.e. not
compilable on this platform) features were specified. Such a warning
will look like this:

The following features are unavailable on your machine: CONFIG_NIC3COM=yes

If a user does not explicitly request an impossible feature, such a
feature will be automatically disabled, so just typing "make" will get
you the common subset of default and possible features.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: flashrom-dos_override_incompatible_config_foo/Makefile
===================================================================
--- flashrom-dos_override_incompatible_config_foo/Makefile	(Revision 1039)
+++ flashrom-dos_override_incompatible_config_foo/Makefile	(Arbeitskopie)
@@ -50,10 +50,29 @@
 endif
 ifeq ($(OS_ARCH), DOS)
 CPPFLAGS += -I../libgetopt -I../libpci/include
-# Bus Pirate and Serprog are not supported under DOS.
-CONFIG_BUSPIRATE_SPI = no
-CONFIG_SERPROG = no
+# Bus Pirate and Serprog are not supported under DOS (missing serial support).
+ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes
+else
+override CONFIG_BUSPIRATE_SPI = no
 endif
+ifeq ($(CONFIG_SERPROG), yes)
+UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
+else
+override CONFIG_SERPROG = no
+endif
+# Dediprog and FT2232 are not supported under DOS (missing USB support).
+ifeq ($(CONFIG_DEDIPROG), yes)
+UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes
+else
+override CONFIG_DEDIPROG = no
+endif
+ifeq ($(CONFIG_FT2232_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes
+else
+override CONFIG_FT2232_SPI = no
+endif
+endif
 
 CHIP_OBJS = jedec.o stm50flw0x0x.o w39v040c.o w39v080fa.o w29ee011.o \
 	sst28sf040.o m29f400bt.o 82802ab.o pm49fl00x.o \
@@ -316,8 +335,19 @@
 
 .features: features
 
+# If a user does not explicitly request a non-working feature, we should
+# silently disable it. However, if a non-working (does not compile) feature
+# is explicitly requested, we should bail out with a descriptive error message.
+ifeq ($(UNSUPPORTED_FEATURES), )
+featuresavailable:
+else
+featuresavailable:
+	@echo "The following features are unavailable on your machine: $(UNSUPPORTED_FEATURES)"
+	@false
+endif
+
 ifeq ($(CONFIG_FT2232_SPI), yes)
-features: compiler
+features: compiler featuresavailable
 	@echo "FEATURES := yes" > .features.tmp
 	@printf "Checking for FTDI support... "
 	@$(shell ( echo "#include <ftdi.h>";		   \
@@ -338,7 +368,7 @@
 	@$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
 	@rm -f .featuretest.c .featuretest
 else
-features: compiler
+features: compiler featuresavailable
 	@echo "FEATURES := yes" > .features.tmp
 	@printf "Checking for utsname support... "
 	@$(shell ( echo "#include <sys/utsname.h>";		   \


-- 
http://www.hailfinger.org/





More information about the flashrom mailing list