Adapt ext4_utils for windows.
This is not a full port of ext4_utils for windows.
Instead it merely enables use to use the library
for the 'create an empty fs image' functionality
as used by 'fastboot format'.
Change-Id: Ia1ffacd64e4233c4fbb369c4ac5927ccd72ac526
diff --git a/ext4_utils/Android.mk b/ext4_utils/Android.mk
index 9b0dc1b..f09197c 100644
--- a/ext4_utils/Android.mk
+++ b/ext4_utils/Android.mk
@@ -4,7 +4,7 @@
include $(CLEAR_VARS)
libext4_utils_src_files := \
- make_ext4fs.c \
+ make_ext4fs.c \
ext4fixup.c \
ext4_utils.c \
allocate.c \
@@ -15,8 +15,34 @@
indirect.c \
uuid.c \
sha1.c \
- sparse_crc32.c \
- wipe.c
+ sparse_crc32.c \
+ wipe.c
+
+# -- All host/targets including windows
+
+LOCAL_SRC_FILES := $(libext4_utils_src_files)
+LOCAL_MODULE := libext4_utils
+LOCAL_MODULE_TAGS := optional
+LOCAL_C_INCLUDES += external/zlib
+
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := make_ext4fs_main.c
+LOCAL_MODULE := make_ext4fs
+LOCAL_STATIC_LIBRARIES += libext4_utils libz
+ifeq ($(HOST_OS),windows)
+LOCAL_LDLIBS += -lws2_32
+endif
+
+include $(BUILD_HOST_EXECUTABLE)
+
+include $(CLEAR_VARS)
+
+# -- All host/targets excluding windows
+
+ifneq ($(HOST_OS),windows)
LOCAL_SRC_FILES := $(libext4_utils_src_files)
LOCAL_MODULE := libext4_utils
@@ -24,7 +50,6 @@
LOCAL_C_INCLUDES += external/zlib
LOCAL_SHARED_LIBRARIES := libz
-
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
@@ -38,14 +63,6 @@
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(libext4_utils_src_files)
-LOCAL_MODULE := libext4_utils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-
LOCAL_SRC_FILES := make_ext4fs_main.c
LOCAL_MODULE := make_ext4fs
LOCAL_MODULE_TAGS := optional
@@ -55,14 +72,6 @@
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := make_ext4fs_main.c
-LOCAL_MODULE := make_ext4fs
-LOCAL_STATIC_LIBRARIES += libext4_utils libz
-
-include $(BUILD_HOST_EXECUTABLE)
-
-include $(CLEAR_VARS)
-
LOCAL_SRC_FILES := ext2simg.c
LOCAL_MODULE := ext2simg
LOCAL_MODULE_TAGS := optional
@@ -160,3 +169,5 @@
LOCAL_IS_HOST_MODULE := true
include $(BUILD_PREBUILT)
+
+endif