Merge "fix BUILD_DEBUG_EMULATOR build"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 0bfecdc..b64769e 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -1,3 +1,6 @@
 # This empty file is here solely for the purpose of optimizing the Android build
 # Please keep it there, and empty, thanks :-)
 #
+
+$(call add-clean-step, rm -rf $(OUT_DIR)/host/linux-x86/obj/{SHARED,STATIC}_LIBRARIES/emulator*)
+$(call add-clean-step, rm -rf $(OUT_DIR)/host/linux-x86/obj/EXECUTABLES/emulator*)
diff --git a/Makefile.android b/Makefile.android
index d61264b..00faa1c 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -39,8 +39,9 @@
 # Overwrite configuration for debug builds.
 #
 ifeq ($(BUILD_DEBUG_EMULATOR),true)
-    MY_CFLAGS := $(CONFIG_INCLUDES) -O0 -g \
-                 -fno-PIC -falign-functions=0
+    MY_CFLAGS := $(CONFIG_INCLUDES)
+    MY_CFLAGS += -O0 -g
+    MY_CFLAGS += -fno-PIC -falign-functions=0
 endif
 
 MY_LDLIBS :=
diff --git a/distrib/libpng-1.2.19/sources.make b/distrib/libpng-1.2.19/sources.make
index f512f7b..4d11126 100644
--- a/distrib/libpng-1.2.19/sources.make
+++ b/distrib/libpng-1.2.19/sources.make
@@ -7,8 +7,10 @@
 # Enable MMX code path for x86, except on Darwin where it fails
 PNG_MMX := no
 ifeq ($(HOST_ARCH),x86)
+ifneq ($(BUILD_DEBUG_EMULATOR),true)
     PNG_MMX := yes
 endif
+endif
 ifeq ($(HOST_OS),darwin)
     PNG_MMX := no
 endif
@@ -20,4 +22,3 @@
 endif
 
 LIBPNG_SOURCES := $(LIBPNG_SOURCES:%=$(LIBPNG_DIR)/%)
-