Allow to exclude each of the external programmer drivers from being compiled in

Example make commandline if you want only internal programmers:
make CONFIG_FT2232SPI=no CONFIG_SERPROG=no CONFIG_NIC3COM=no
CONFIG_SATASII=no CONFIG_DRKAISER=no CONFIG_DUMMY=no

Of course, all of the CONFIG_* symbols can be mixed and matched as
needed. CONFIG_FT2232SPI is special because even if it is enabled, make
will check if the headers are available and skip it otherwise.

Corresponding to flashrom svn r724.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
diff --git a/Makefile b/Makefile
index 0a6eb79..1b50d87 100644
--- a/Makefile
+++ b/Makefile
@@ -49,8 +49,7 @@
 	sst49lfxxxc.o sst_fwhub.o layout.o cbtable.o flashchips.o physmap.o \
 	flashrom.o w39v080fa.o sharplhf00l04.o w29ee011.o spi.o it87spi.o \
 	ichspi.o w39v040c.o sb600spi.o wbsio_spi.o m29f002.o internal.o \
-	dummyflasher.o pcidev.o nic3com.o satasii.o ft2232_spi.o \
-	print.o drkaiser.o
+	pcidev.o print.o
 
 all: pciutils features dep $(PROGRAM)
 
@@ -67,7 +66,22 @@
 SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"'
 
 # Always enable serprog for now. Needs to be disabled on Windows.
-CONFIG_SERPROG = yes
+CONFIG_SERPROG ?= yes
+
+# Always enable 3Com NICs for now.
+CONFIG_NIC3COM ?= yes
+
+# Always enable SiI SATA controllers for now.
+CONFIG_SATASII ?= yes
+
+# Always enable FT2232 SPI dongles for now.
+CONFIG_FT2232SPI ?= yes
+
+# Always enable dummy tracing for now.
+CONFIG_DUMMY ?= yes
+
+# Always enable Dr. Kaiser for now.
+CONFIG_DRKAISER ?= yes
 
 ifeq ($(CONFIG_SERPROG), yes)
 FEATURE_CFLAGS += -D'SERPROG_SUPPORT=1'
@@ -77,9 +91,32 @@
 endif
 endif
 
-FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'FT2232_SPI_SUPPORT=1'")
+ifeq ($(CONFIG_NIC3COM), yes)
+FEATURE_CFLAGS += -D'NIC3COM_SUPPORT=1'
+OBJS += nic3com.o
+endif
 
+ifeq ($(CONFIG_SATASII), yes)
+FEATURE_CFLAGS += -D'SATASII_SUPPORT=1'
+OBJS += satasii.o
+endif
+
+ifeq ($(CONFIG_FT2232SPI), yes)
+# This is a totally ugly hack.
+FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'FT2232_SPI_SUPPORT=1'")
 FEATURE_LIBS += $(shell LC_ALL=C grep -q "FTDISUPPORT := yes" .features && printf "%s" "-lftdi")
+OBJS += ft2232_spi.o
+endif
+
+ifeq ($(CONFIG_DUMMY), yes)
+FEATURE_CFLAGS += -D'DUMMY_SUPPORT=1'
+OBJS += dummyflasher.o
+endif
+
+ifeq ($(CONFIG_DRKAISER), yes)
+FEATURE_CFLAGS += -D'DRKAISER_SUPPORT=1'
+OBJS += drkaiser.o
+endif
 
 $(PROGRAM): $(OBJS)
 	$(CC) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS) $(FEATURE_LIBS)