Merge "android: split private zlib into its own library"
diff --git a/Makefile.common b/Makefile.common
index 786a7f1..16d5b64 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -94,6 +94,27 @@
 
 common_LOCAL_SRC_FILES += $(ZLIB_SOURCES)
 
+## one for 32-bit
+$(call start-emulator-library, emulator-zlib)
+LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
+LOCAL_C_INCLUDES += $(common_LOCAL_C_INCLUDES)
+LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
+$(call gen-hw-config-defs)
+$(call end-emulator-library)
+
+ifdef EMULATOR_BUILD_64BITS
+  $(call start-emulator-library, emulator64-zlib)
+  LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
+  LOCAL_C_INCLUDES += $(common_LOCAL_C_INCLUDES)
+  LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
+  $(call gen-hw-config-defs)
+  $(call end-emulator-library)
+endif # EMULATOR_BUILD_64BITS
+
+common_LOCAL_CFLAGS =
+common_LOCAL_SRC_FILES =
+common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
+
 ###########################################################
 # GLib sources
 #
diff --git a/Makefile.target b/Makefile.target
index cce444d..c0d7c91 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -365,6 +365,7 @@
     emulator-libjpeg \
     emulator-libelff \
     emulator-common \
+    emulator-zlib \
     $(SDL_STATIC_LIBRARIES)
 LOCAL_LDLIBS += $(common_LOCAL_LDLIBS)
 LOCAL_LDFLAGS += $(common_LOCAL_LDFLAGS)
@@ -401,6 +402,7 @@
       emulator64-libjpeg \
       emulator64-libelff \
       emulator64-common \
+      emulator64-zlib \
       $(SDL_STATIC_LIBRARIES_64)
   LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64
   LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
diff --git a/Makefile.tests b/Makefile.tests
index 611fbd9..83f1582 100644
--- a/Makefile.tests
+++ b/Makefile.tests
@@ -35,7 +35,9 @@
 LOCAL_LDLIBS += $(EMULATOR_GTEST_LDLIBS)
 LOCAL_SRC_FILES := $(EMULATOR_UNITTESTS_SOURCES)
 LOCAL_CFLAGS += -O0
-LOCAL_STATIC_LIBRARIES += emulator-common emulator-libgtest
+LOCAL_STATIC_LIBRARIES += emulator-common \
+  emulator-libgtest \
+  emulator-zlib
 $(call end-emulator-program)
 
 
@@ -46,6 +48,8 @@
   LOCAL_SRC_FILES := $(EMULATOR_UNITTESTS_SOURCES)
   LOCAL_CFLAGS += -O0 -m64
   LOCAL_LDLIBS += -m64
-  LOCAL_STATIC_LIBRARIES += emulator64-common emulator64-libgtest
+  LOCAL_STATIC_LIBRARIES += emulator64-common \
+    emulator64-libgtest \
+    emulator64-zlib
   $(call end-emulator-program)
 endif