aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-06-14 18:40:59 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-06-14 18:40:59 +0000
commit5d3fcb963300a9e44ca461f0481cb8d727556553 (patch)
tree38755aadee781f6283a336fa9c8c871e6a9fb68f
parentddbab7116c790c99ff855c29637c19f712cb6b5b (diff)
downloadflashrom-5d3fcb963300a9e44ca461f0481cb8d727556553.tar.gz
flashrom-5d3fcb963300a9e44ca461f0481cb8d727556553.tar.bz2
flashrom-5d3fcb963300a9e44ca461f0481cb8d727556553.zip
Makefile: detect unsupported configuration options
Detect incompatible CONFIG_FOO=yes for the specified target and refuse to compile with a meaningful error message. Set the default for incompatible CONFIG_FOO to no. Just running "make" should result in a a build which compiles the common subset of available and working features. Corresponding to flashrom svn r1048. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Idwer Vollering <vidwer+lists.flashrom@gmail.com>
-rw-r--r--Makefile40
1 files changed, 35 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 2ff7e17e..723a15b8 100644
--- a/Makefile
+++ b/Makefile
@@ -53,9 +53,28 @@ EXEC_SUFFIX := .exe
CPPFLAGS += -I../libgetopt -I../libpci/include
# FIXME Check if we can achieve the same effect with -L../libgetopt -lgetopt
LIBS += ../libgetopt/libgetopt.a
-# 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 \
@@ -279,7 +298,7 @@ distclean: clean
strip: $(PROGRAM)$(EXEC_SUFFIX)
$(STRIP) $(STRIP_ARGS) $(PROGRAM)$(EXEC_SUFFIX)
-compiler:
+compiler: featuresavailable
@printf "Checking for a C compiler... "
@$(shell ( echo "int main(int argc, char **argv)"; \
echo "{ return 0; }"; ) > .test.c )
@@ -318,6 +337,17 @@ endif
.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
@echo "FEATURES := yes" > .features.tmp
@@ -375,6 +405,6 @@ tarball: export
djgpp-dos: clean
make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip WARNERROR=no OS_ARCH=DOS
-.PHONY: all clean distclean compiler pciutils features export tarball dos
+.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable
-include $(OBJS:.o=.d)