Move list of source files used to build emulator core to a separate variable

Change-Id: Ibefc9c439c410ffec37467f75cdb70e55806d571
diff --git a/Makefile.android b/Makefile.android
index 7e3099f..10baf34 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -563,6 +563,69 @@
 
 include $(BUILD_HOST_STATIC_LIBRARY)
 
+##############################################################################
+# lists of source files used to build the emulator core
+#
+
+# block sources
+#
+CORE_BLOCK_SOURCES = block.c \
+                     block/qcow.c \
+                     block/qcow2.c \
+                     block/qcow2-refcount.c \
+                     block/qcow2-snapshot.c \
+                     block/qcow2-cluster.c \
+                     block/cloop.c \
+                     block/dmg.c \
+                     block/vvfat.c
+ifeq ($(HOST_OS),windows)
+  CORE_BLOCK_SOURCES += block/raw-win32.c
+else
+  CORE_BLOCK_SOURCES += block/raw-posix.c
+endif
+
+# hw sources
+#
+CORE_HW_SOURCES = hw/arm_boot.c \
+                  hw/android_arm.c
+
+# migration sources
+#
+CORE_MIGRATION_SOURCES = iolooper-select.c
+ifeq ($(HOST_OS),windows)
+  CORE_MIGRATION_SOURCES += migration-dummy-android.c
+else
+  CORE_MIGRATION_SOURCES += migration.c \
+                            migration-exec.c \
+                            migration-tcp-android.c
+endif
+
+# misc. sources
+#
+CORE_MISC_SOURCES =
+ifeq ($(HOST_ARCH),x86)
+    CORE_MISC_SOURCES += i386-dis.c
+endif
+ifeq ($(HOST_ARCH),x86_64)
+    CORE_MISC_SOURCES += i386-dis.c
+endif
+ifeq ($(HOST_ARCH),ppc)
+    CORE_MISC_SOURCES += ppc-dis.c
+endif
+
+ifeq ($(HOST_OS),linux)
+    CORE_MISC_SOURCES += usb-linux.c \
+                         qemu-thread.c
+else
+    CORE_MISC_SOURCES += usb-dummy-android.c
+endif
+
+ifeq ($(HOST_OS),windows)
+  CORE_MISC_SOURCES   += tap-win32.c
+endif
+
+CORE_SOURCES = $(CORE_BLOCK_SOURCES) $(CORE_HW_SOURCES)
+CORE_SOURCES += $(CORE_MIGRATION_SOURCES) $(CORE_MISC_SOURCES)
 
 ##############################################################################
 # now build the emulator itself
@@ -632,16 +695,8 @@
 # include other sources
 #
 VL_SOURCES := vl-android.c osdep.c cutils.c \
-              block.c readline.c monitor.c console.c loader.c sockets.c \
+              readline.c monitor.c console.c loader.c sockets.c \
               aes.c d3des.c \
-              block/qcow.c \
-              block/qcow2.c \
-              block/qcow2-refcount.c \
-              block/qcow2-snapshot.c \
-              block/qcow2-cluster.c \
-              block/cloop.c \
-              block/dmg.c \
-              block/vvfat.c \
               buffered_file.c \
               cbuffer.c \
               gdbstub.c \
@@ -708,40 +763,7 @@
               android/avd/hw-config.c \
               android/avd/info.c \
 
-VL_SOURCES += hw/arm_boot.c \
-              hw/android_arm.c \
-
 ifeq ($(HOST_OS),windows)
-  VL_SOURCES += block/raw-win32.c \
-                migration-dummy-android.c \
-                iolooper-select.c
-else
-  VL_SOURCES += block/raw-posix.c \
-                migration.c \
-                migration-exec.c \
-                migration-tcp-android.c \
-                iolooper-select.c
-endif
-
-ifeq ($(HOST_OS),linux)
-    VL_SOURCES += usb-linux.c \
-                  qemu-thread.c
-else
-    VL_SOURCES += usb-dummy-android.c
-endif
-
-ifeq ($(HOST_ARCH),x86)
-    VL_SOURCES += i386-dis.c
-endif
-ifeq ($(HOST_ARCH),x86_64)
-    VL_SOURCES += i386-dis.c
-endif
-ifeq ($(HOST_ARCH),ppc)
-    VL_SOURCES += ppc-dis.c
-endif
-
-ifeq ($(HOST_OS),windows)
-  VL_SOURCES   += tap-win32.c
   LOCAL_LDLIBS += -mno-cygwin -mwindows -mconsole
 endif
 
@@ -749,7 +771,7 @@
     LOCAL_LDLIBS += -L/usr/local/lib -lpthread -lX11 -lutil
 endif
 
-LOCAL_SRC_FILES += $(VL_SOURCES)
+LOCAL_SRC_FILES += $(VL_SOURCES) $(CORE_SOURCES)
 
 ifeq ($(HOST_OS),linux)
   LOCAL_LDLIBS += -lutil -lrt