Index: Makefile
===================================================================
--- Makefile	(revision 909)
+++ Makefile	(working copy)
@@ -26,6 +26,7 @@
 PREFIX  ?= /usr/local
 MANDIR  ?= $(PREFIX)/share/man
 CFLAGS  ?= -Os -Wall -Werror -Wshadow
+CPPFLAGS += -Iinclude
 EXPORTDIR ?= .
 
 OS_ARCH	= $(shell uname)
@@ -41,15 +42,30 @@
 LDFLAGS += -L/usr/local/lib
 endif
 
-CHIP_OBJS = jedec.o stm50flw0x0x.o w39v040c.o w39v080fa.o sharplhf00l04.o w29ee011.o \
-	sst28sf040.o m29f400bt.o 82802ab.o pm49fl00x.o \
-	sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o
+CHIP_OBJS = chips/flashchips.o \
+	chips/jedec.o \
+	chips/spi.o \
+	chips/82802ab.o \
+	chips/m29f400bt.o \
+	chips/pm49fl00x.o \
+	chips/sharplhf00l04.o \
+	chips/sst28sf040.o \
+	chips/sst49lfxxxc.o \
+	chips/sst_fwhub.o \
+	chips/stm50flw0x0x.o \
+	chips/w29ee011.o \
+	chips/w39v040c.o \
+	chips/w39v080fa.o
 
 LIB_OBJS = layout.o
 
-CLI_OBJS = flashrom.o cli_classic.o cli_output.o print.o
+CLI_OBJS = flashrom.o \
+	cli/cli_classic.o \
+	cli/cli_output.o \
+	cli/print.o
 
-PROGRAMMER_OBJS = udelay.o programmer.o
+PROGRAMMER_OBJS = programmer/udelay.o \
+	programmer/programmer.o
 
 all: pciutils features dep $(PROGRAM)
 
@@ -107,13 +123,21 @@
 
 ifeq ($(CONFIG_INTERNAL), yes)
 FEATURE_CFLAGS += -D'INTERNAL_SUPPORT=1'
-PROGRAMMER_OBJS += chipset_enable.o board_enable.o cbtable.o dmi.o it87spi.o ichspi.o sb600spi.o wbsio_spi.o internal.o
+PROGRAMMER_OBJS += programmer/chipset_enable.o \
+	programmer/board_enable.o \
+	programmer/cbtable.o \
+	programmer/dmi.o \
+	programmer/it87spi.o \
+	programmer/ichspi.o \
+	programmer/sb600spi.o \
+	programmer/wbsio_spi.o \
+	programmer/internal.o
 NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_SERPROG), yes)
 FEATURE_CFLAGS += -D'SERPROG_SUPPORT=1'
-PROGRAMMER_OBJS += serprog.o
+PROGRAMMER_OBJS += programmer/serprog.o
 ifeq ($(OS_ARCH), SunOS)
 LIBS += -lsocket
 endif
@@ -121,30 +145,30 @@
 
 ifeq ($(CONFIG_BITBANG_SPI), yes)
 FEATURE_CFLAGS += -D'BITBANG_SPI_SUPPORT=1'
-PROGRAMMER_OBJS += bitbang_spi.o
+PROGRAMMER_OBJS += programmer/bitbang_spi.o
 endif
 
 ifeq ($(CONFIG_NIC3COM), yes)
 FEATURE_CFLAGS += -D'NIC3COM_SUPPORT=1'
-PROGRAMMER_OBJS += nic3com.o
+PROGRAMMER_OBJS += programmer/nic3com.o
 NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_GFXNVIDIA), yes)
 FEATURE_CFLAGS += -D'GFXNVIDIA_SUPPORT=1'
-PROGRAMMER_OBJS += gfxnvidia.o
+PROGRAMMER_OBJS += programmer/gfxnvidia.o
 NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_SATASII), yes)
 FEATURE_CFLAGS += -D'SATASII_SUPPORT=1'
-PROGRAMMER_OBJS += satasii.o
+PROGRAMMER_OBJS += programmer/satasii.o
 NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_ATAHPT), yes)
 FEATURE_CFLAGS += -D'ATAHPT_SUPPORT=1'
-PROGRAMMER_OBJS += atahpt.o
+PROGRAMMER_OBJS += programmer/atahpt.o
 NEED_PCI := yes
 endif
 
@@ -153,29 +177,29 @@
 # 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" "$(FTDILIBS)")
-PROGRAMMER_OBJS += ft2232_spi.o
+PROGRAMMER_OBJS += programmer/ft2232_spi.o
 endif
 
 ifeq ($(CONFIG_DUMMY), yes)
 FEATURE_CFLAGS += -D'DUMMY_SUPPORT=1'
-PROGRAMMER_OBJS += dummyflasher.o
+PROGRAMMER_OBJS += programmer/dummyflasher.o
 endif
 
 ifeq ($(CONFIG_DRKAISER), yes)
 FEATURE_CFLAGS += -D'DRKAISER_SUPPORT=1'
-PROGRAMMER_OBJS += drkaiser.o
+PROGRAMMER_OBJS += programmer/drkaiser.o
 NEED_PCI := yes
 endif
 
 ifeq ($(CONFIG_BUSPIRATESPI), yes)
 FEATURE_CFLAGS += -D'BUSPIRATE_SPI_SUPPORT=1'
-PROGRAMMER_OBJS += buspirate_spi.o
+PROGRAMMER_OBJS += programmer/buspirate_spi.o
 endif
 
 ifeq ($(CONFIG_DEDIPROG), yes)
 FEATURE_CFLAGS += -D'DEDIPROG_SUPPORT=1'
 FEATURE_LIBS += -lusb
-PROGRAMMER_OBJS += dediprog.o
+PROGRAMMER_OBJS += programmer/dediprog.o
 endif
 
 # Ugly, but there's no elif/elseif.
@@ -190,7 +214,9 @@
 ifeq ($(NEED_PCI), yes)
 LIBS += -lpci
 FEATURE_CFLAGS += -D'NEED_PCI=1'
-PROGRAMMER_OBJS += pcidev.o physmap.o hwaccess.o
+PROGRAMMER_OBJS += programmer/pcidev.o \
+	programmer/physmap.o \
+	programmer/hwaccess.o
 ifeq ($(OS_ARCH), NetBSD)
 LIBS += -lpciutils #		The libpci we want.
 LIBS += -l$(shell uname -p) #	For (i386|x86_64)_iopl(2).
@@ -199,7 +225,7 @@
 
 ifeq ($(CONFIG_PRINT_WIKI), yes)
 FEATURE_CFLAGS += -D'PRINT_WIKI_SUPPORT=1'
-CLI_OBJS += print_wiki.o
+CLI_OBJS += cli/print_wiki.o
 endif
 
 # We could use PULLED_IN_LIBS, but that would be ugly.
