diff --git a/.gitignore b/.gitignore
index 5d6a78e..0c4d7c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+config-devices.*
+config-all-devices.*
 config-host.*
 config-target.*
 i386
diff --git a/Makefile b/Makefile
index 7664c83..acca106 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,13 @@ else
 DOCS=
 endif

+SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
+
+config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
+	$(call quiet-command,grep "=y$$" $(SUBDIR_DEVICES_MAK) | sort -u > $@,"  GEN  $@")
+
+include config-all-devices.mak
+
 build-all: config-host.h $(TOOLS) $(DOCS) recurse-all

 %.c %.h: config-host.h
@@ -42,7 +49,6 @@ subdir-%: config-host.h
 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
 $(filter %-user,$(SUBDIR_RULES)): libqemu_user.a

-
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 romsubdir-%:
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
diff --git a/Makefile.hw b/Makefile.hw
index 6472ec1..b48d1af 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -1,6 +1,7 @@
 # Makefile for qemu target independent devices.

 include ../config-host.mak
+include ../config-all-devices.mak
 include config.mak
 include $(SRC_PATH)/rules.mak

diff --git a/Makefile.target b/Makefile.target
index 2f75e6d..4ce6a3d 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -1,6 +1,7 @@
 # -*- Mode: makefile -*-

 include ../config-host.mak
+include config-devices.mak
 include config-target.mak
 include $(SRC_PATH)/rules.mak

diff --git a/configure b/configure
index 93bc4d0..27822f9 100755
--- a/configure
+++ b/configure
@@ -1772,11 +1772,16 @@ if test -f ${config_host_ld}~ ; then
   fi
 fi

+# Temporary all devices configuration
+rm -f config-all-devices.mak.temp
+touch config-all-devices.mak.temp
+
 for target in $target_list; do
 target_dir="$target"
 config_target_mak=$target_dir/config-target.mak
 target_arch2=`echo $target | cut -d '-' -f 1`
 target_bigendian="no"
+
 case "$target_arch2" in
   armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
   target_bigendian=yes
@@ -1816,6 +1821,11 @@ if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$targ
   mkdir -p $target_dir/nwfpe
 fi

+if test ! -f $target_dir/config-devices.mak ; then
+  cp $source_path/default-configs/${target}.mak $target_dir/config-devices.mak
+  cat $source_path/default-configs/${target}.mak >> config-all-devices.mak.temp
+fi
+
 #
 # don't use ln -sf as not all "ln -sf" over write the file/link
 #
@@ -2158,6 +2168,11 @@ echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak

 done # for target in $targets

+echo "# This is a generated config file from all the devices selected" > config-all-devices.mak
+echo "# Don't edit it" >> config-all-devices.mak
+grep "=y$" config-all-devices.mak.temp >> config-all-devices.mak
+rm config-all-devices.mak.temp
+
 # build tree in object directory if source path is different from current one
 if test "$source_path_used" = "yes" ; then
     DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
diff --git a/default-configs/alpha-linux-user.mak b/default-configs/alpha-linux-user.mak
new file mode 100644
index 0000000..7956e29
--- /dev/null
+++ b/default-configs/alpha-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for alpha-linux-user
diff --git a/default-configs/arm-linux-user.mak b/default-configs/arm-linux-user.mak
new file mode 100644
index 0000000..413361a
--- /dev/null
+++ b/default-configs/arm-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for arm-linux-user
diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
new file mode 100644
index 0000000..372a549
--- /dev/null
+++ b/default-configs/arm-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for arm-softmmu
diff --git a/default-configs/armeb-linux-user.mak b/default-configs/armeb-linux-user.mak
new file mode 100644
index 0000000..bf2ffe7
--- /dev/null
+++ b/default-configs/armeb-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for armeb-linux-user
diff --git a/default-configs/cris-linux-user.mak b/default-configs/cris-linux-user.mak
new file mode 100644
index 0000000..e3aec7b
--- /dev/null
+++ b/default-configs/cris-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for cris-linux-user
diff --git a/default-configs/cris-softmmu.mak b/default-configs/cris-softmmu.mak
new file mode 100644
index 0000000..3726699
--- /dev/null
+++ b/default-configs/cris-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for cris-softmmu
diff --git a/default-configs/i386-bsd-user.mak b/default-configs/i386-bsd-user.mak
new file mode 100644
index 0000000..af1b31a
--- /dev/null
+++ b/default-configs/i386-bsd-user.mak
@@ -0,0 +1 @@
+# Default configuration for i386-bsd-user
diff --git a/default-configs/i386-darwin-user.mak b/default-configs/i386-darwin-user.mak
new file mode 100644
index 0000000..19afd3d
--- /dev/null
+++ b/default-configs/i386-darwin-user.mak
@@ -0,0 +1 @@
+# Default configuration for i386-darwin-user
diff --git a/default-configs/i386-linux-user.mak b/default-configs/i386-linux-user.mak
new file mode 100644
index 0000000..8657e68
--- /dev/null
+++ b/default-configs/i386-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for i386-linux-user
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
new file mode 100644
index 0000000..15586a0
--- /dev/null
+++ b/default-configs/i386-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for i386-softmmu
diff --git a/default-configs/m68k-linux-user.mak b/default-configs/m68k-linux-user.mak
new file mode 100644
index 0000000..06cd5ed
--- /dev/null
+++ b/default-configs/m68k-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for m68k-linux-user
diff --git a/default-configs/m68k-softmmu.mak b/default-configs/m68k-softmmu.mak
new file mode 100644
index 0000000..572b868
--- /dev/null
+++ b/default-configs/m68k-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for m68k-softmmu
diff --git a/default-configs/microblaze-linux-user.mak b/default-configs/microblaze-linux-user.mak
new file mode 100644
index 0000000..566fdc0
--- /dev/null
+++ b/default-configs/microblaze-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for microblaze-linux-user
diff --git a/default-configs/microblaze-softmmu.mak b/default-configs/microblaze-softmmu.mak
new file mode 100644
index 0000000..c42009d
--- /dev/null
+++ b/default-configs/microblaze-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for microblaze-softmmu
diff --git a/default-configs/mips-linux-user.mak b/default-configs/mips-linux-user.mak
new file mode 100644
index 0000000..31df570
--- /dev/null
+++ b/default-configs/mips-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for mips-linux-user
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
new file mode 100644
index 0000000..a9e89ec
--- /dev/null
+++ b/default-configs/mips-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for mips-softmmu
diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak
new file mode 100644
index 0000000..4211452
--- /dev/null
+++ b/default-configs/mips64-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for mips64-softmmu
diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak
new file mode 100644
index 0000000..8ca46a2
--- /dev/null
+++ b/default-configs/mips64el-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for mips64el-softmmu
diff --git a/default-configs/mipsel-linux-user.mak b/default-configs/mipsel-linux-user.mak
new file mode 100644
index 0000000..4d0e4af
--- /dev/null
+++ b/default-configs/mipsel-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for mipsel-linux-user
diff --git a/default-configs/mipsel-softmmu.mak b/default-configs/mipsel-softmmu.mak
new file mode 100644
index 0000000..fe8af41
--- /dev/null
+++ b/default-configs/mipsel-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for mipsel-softmmu
diff --git a/default-configs/ppc-darwin-user.mak b/default-configs/ppc-darwin-user.mak
new file mode 100644
index 0000000..117f176
--- /dev/null
+++ b/default-configs/ppc-darwin-user.mak
@@ -0,0 +1 @@
+# Default configuration for ppc-darwin-user
diff --git a/default-configs/ppc-linux-user.mak b/default-configs/ppc-linux-user.mak
new file mode 100644
index 0000000..6273df2
--- /dev/null
+++ b/default-configs/ppc-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for ppc-linux-user
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
new file mode 100644
index 0000000..ba80ba2
--- /dev/null
+++ b/default-configs/ppc-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for ppc-softmmu
diff --git a/default-configs/ppc64-linux-user.mak b/default-configs/ppc64-linux-user.mak
new file mode 100644
index 0000000..422d3fb
--- /dev/null
+++ b/default-configs/ppc64-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for ppc64-linux-user
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
new file mode 100644
index 0000000..0b72c70
--- /dev/null
+++ b/default-configs/ppc64-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for ppc64-softmmu
diff --git a/default-configs/ppc64abi32-linux-user.mak b/default-configs/ppc64abi32-linux-user.mak
new file mode 100644
index 0000000..1c657ec
--- /dev/null
+++ b/default-configs/ppc64abi32-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for ppc64abi32-linux-user
diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak
new file mode 100644
index 0000000..951bfa0
--- /dev/null
+++ b/default-configs/ppcemb-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for ppcemb-softmmu
diff --git a/default-configs/sh4-linux-user.mak b/default-configs/sh4-linux-user.mak
new file mode 100644
index 0000000..a469e19
--- /dev/null
+++ b/default-configs/sh4-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for sh4-linux-user
diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.mak
new file mode 100644
index 0000000..4466835
--- /dev/null
+++ b/default-configs/sh4-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for sh4-softmmu
diff --git a/default-configs/sh4eb-linux-user.mak b/default-configs/sh4eb-linux-user.mak
new file mode 100644
index 0000000..be08ca1
--- /dev/null
+++ b/default-configs/sh4eb-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for sh4eb-linux-user
diff --git a/default-configs/sh4eb-softmmu.mak b/default-configs/sh4eb-softmmu.mak
new file mode 100644
index 0000000..2f60e53
--- /dev/null
+++ b/default-configs/sh4eb-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for sh4eb-softmmu
diff --git a/default-configs/sparc-bsd-user.mak b/default-configs/sparc-bsd-user.mak
new file mode 100644
index 0000000..21e0950
--- /dev/null
+++ b/default-configs/sparc-bsd-user.mak
@@ -0,0 +1 @@
+# Default configuration for sparc-bsd-user
diff --git a/default-configs/sparc-linux-user.mak b/default-configs/sparc-linux-user.mak
new file mode 100644
index 0000000..9c716d1
--- /dev/null
+++ b/default-configs/sparc-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for sparc-linux-user
diff --git a/default-configs/sparc-softmmu.mak b/default-configs/sparc-softmmu.mak
new file mode 100644
index 0000000..2e0e621
--- /dev/null
+++ b/default-configs/sparc-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for sparc-softmmu
diff --git a/default-configs/sparc32plus-linux-user.mak b/default-configs/sparc32plus-linux-user.mak
new file mode 100644
index 0000000..432e880
--- /dev/null
+++ b/default-configs/sparc32plus-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for sparc32plus-linux-user
diff --git a/default-configs/sparc64-bsd-user.mak b/default-configs/sparc64-bsd-user.mak
new file mode 100644
index 0000000..b8b9eea
--- /dev/null
+++ b/default-configs/sparc64-bsd-user.mak
@@ -0,0 +1 @@
+# Default configuration for sparc64-bsd-user
diff --git a/default-configs/sparc64-linux-user.mak b/default-configs/sparc64-linux-user.mak
new file mode 100644
index 0000000..bf1bdd6
--- /dev/null
+++ b/default-configs/sparc64-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for sparc64-linux-user
diff --git a/default-configs/sparc64-softmmu.mak b/default-configs/sparc64-softmmu.mak
new file mode 100644
index 0000000..fead2ea
--- /dev/null
+++ b/default-configs/sparc64-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for sparc64-softmmu
diff --git a/default-configs/x86_64-bsd-user.mak b/default-configs/x86_64-bsd-user.mak
new file mode 100644
index 0000000..73e5d34
--- /dev/null
+++ b/default-configs/x86_64-bsd-user.mak
@@ -0,0 +1 @@
+# Default configuration for x86_64-bsd-user
diff --git a/default-configs/x86_64-linux-user.mak b/default-configs/x86_64-linux-user.mak
new file mode 100644
index 0000000..bec1d9e
--- /dev/null
+++ b/default-configs/x86_64-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for x86_64-linux-user
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
new file mode 100644
index 0000000..ec98af2
--- /dev/null
+++ b/default-configs/x86_64-softmmu.mak
@@ -0,0 +1 @@
+# Default configuration for x86_64-softmmu
