Internal (onboard) programming was the only feature which could not be disabled

Make various pieces of code conditional on support for internal
programming. Code shared between PCI device programmers and onboard
programming is now conditional as well.

It is now possible to build only with dummy support:
make CONFIG_INTERNAL=no CONFIG_NIC3COM=no CONFIG_SATASII=no
CONFIG_DRKAISER=no CONFIG_SERPROG=no CONFIG_FT2232SPI=no

This allows building for a specific use case only, and it also
facilitates porting to a new architecture because it is possible to
focus on highlevel code only.

Note: Either internal or dummy programmer needs to be compiled in due to
the current behaviour of always picking a default programmer if -p is
not specified. Picking an arbitrary external programmer as default  
wouldn't make sense.

Build and runtime tested in all 1024 possible build combinations. The
only failures are by design as mentioned above.

Corresponding to flashrom svn r797.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audiohacked@gmail.com>
diff --git a/Makefile b/Makefile
index ae06d7c..77731ed 100644
--- a/Makefile
+++ b/Makefile
@@ -43,13 +43,11 @@
 
 LIBS += -lpci
 
-OBJS = chipset_enable.o board_enable.o udelay.o jedec.o stm50flw0x0x.o \
-	sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o \
-	w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o \
-	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 \
-	pcidev.o print.o
+OBJS = jedec.o stm50flw0x0x.o w39v080fa.o sharplhf00l04.o w29ee011.o \
+	sst28sf040.o am29f040b.o mx29f002.o m29f400bt.o pm29f002.o w39v040c.o \
+	w49f002u.o 82802ab.o pm49fl00x.o sst49lf040.o en29f002a.o m29f002.o \
+	sst49lfxxxc.o sst_fwhub.o flashchips.o layout.o spi.o \
+	flashrom.o print.o physmap.o internal.o udelay.o
 
 all: pciutils features dep $(PROGRAM)
 
@@ -65,6 +63,9 @@
 
 SVNDEF := -D'FLASHROM_VERSION="$(VERSION)"'
 
+# Always enable internal/onboard support for now.
+CONFIG_INTERNAL ?= yes
+
 # Always enable serprog for now. Needs to be disabled on Windows.
 CONFIG_SERPROG ?= yes
 
@@ -95,6 +96,12 @@
 # Disable wiki printing by default. It is only useful if you have wiki access.
 CONFIG_PRINT_WIKI ?= no
 
+ifeq ($(CONFIG_INTERNAL), yes)
+FEATURE_CFLAGS += -D'INTERNAL_SUPPORT=1'
+OBJS += chipset_enable.o board_enable.o cbtable.o it87spi.o ichspi.o sb600spi.o wbsio_spi.o
+NEED_PCI := yes
+endif
+
 ifeq ($(CONFIG_SERPROG), yes)
 FEATURE_CFLAGS += -D'SERPROG_SUPPORT=1'
 OBJS += serprog.o
@@ -111,16 +118,19 @@
 ifeq ($(CONFIG_NIC3COM), yes)
 FEATURE_CFLAGS += -D'NIC3COM_SUPPORT=1'
 OBJS += nic3com.o
+NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_GFXNVIDIA), yes)
 FEATURE_CFLAGS += -D'GFXNVIDIA_SUPPORT=1'
 OBJS += gfxnvidia.o
+NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_SATASII), yes)
 FEATURE_CFLAGS += -D'SATASII_SUPPORT=1'
 OBJS += satasii.o
+NEED_PCI := yes
 endif
 
 FTDILIBS := $(shell pkg-config --libs libftdi 2>/dev/null || printf "%s" "-lftdi -lusb")
@@ -139,6 +149,7 @@
 ifeq ($(CONFIG_DRKAISER), yes)
 FEATURE_CFLAGS += -D'DRKAISER_SUPPORT=1'
 OBJS += drkaiser.o
+NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_BUSPIRATESPI), yes)
@@ -155,6 +166,11 @@
 endif
 endif
 
+ifeq ($(NEED_PCI), yes)
+FEATURE_CFLAGS += -D'NEED_PCI=1'
+OBJS += pcidev.o
+endif
+
 ifeq ($(CONFIG_PRINT_WIKI), yes)
 FEATURE_CFLAGS += -D'PRINT_WIKI_SUPPORT=1'
 OBJS += print_wiki.o