OSDN Git Service

Android: support building exfat-utils.
authorliminghao <liminghao@xiaomi.com>
Fri, 3 Mar 2017 06:23:53 +0000 (14:23 +0800)
committerrelan <relan@users.noreply.github.com>
Mon, 2 Apr 2018 17:44:32 +0000 (20:44 +0300)
Build mkexfatfs, exfatfsck, dumpexfat and exfatlabel for Android.

Signed-off-by: liminghao <liminghao@xiaomi.com>
Android.mk [new file with mode: 0644]
libexfat/exfat.h

diff --git a/Android.mk b/Android.mk
new file mode 100644 (file)
index 0000000..b6fd7d5
--- /dev/null
@@ -0,0 +1,205 @@
+#
+# Free exFAT implementation.
+# Copyright (C) 2017  liminghao
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+exfat_common_cflags := \
+    -std=gnu99 \
+    -D_FILE_OFFSET_BITS=64 \
+    -DPACKAGE='"exfat"' \
+    -DVERSION='"1.2.8"'
+
+########################################
+# static library: libexfat.a
+
+libexfat_src_files := \
+    libexfat/cluster.c \
+    libexfat/io.c \
+    libexfat/log.c \
+    libexfat/lookup.c \
+    libexfat/mount.c \
+    libexfat/node.c \
+    libexfat/time.c \
+    libexfat/utf.c \
+    libexfat/utils.c
+
+libexfat_headers := $(LOCAL_PATH)/libexfat
+
+## TARGET ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libexfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(libexfat_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(libexfat_headers)
+
+include $(BUILD_STATIC_LIBRARY)
+
+## HOST ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libexfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(libexfat_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(libexfat_headers)
+
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+
+########################################
+# executable: mkexfatfs
+
+mkexfatfs_src_files := \
+    mkfs/cbm.c \
+    mkfs/fat.c \
+    mkfs/main.c \
+    mkfs/mkexfat.c \
+    mkfs/rootdir.c \
+    mkfs/uct.c \
+    mkfs/uctc.c \
+    mkfs/vbr.c
+
+mkexfatfs_headers := \
+    $(libexfat_headers) \
+    $(LOCAL_PATH)/mkfs
+
+## TARGET ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := mkexfatfs
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(mkexfatfs_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(mkexfatfs_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_EXECUTABLE)
+
+## HOST ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := mkexfatfs
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(mkexfatfs_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(mkexfatfs_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_HOST_EXECUTABLE)
+
+########################################
+# executable: exfatfsck
+
+exfatfsck_src_files := fsck/main.c
+
+exfatfsck_headers := \
+    $(libexfat_headers) \
+    $(LOCAL_PATH)/fsck
+
+## TARGET ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := exfatfsck
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(exfatfsck_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(exfatfsck_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_EXECUTABLE)
+
+## HOST ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := exfatfsck
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(exfatfsck_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(exfatfsck_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_HOST_EXECUTABLE)
+
+########################################
+# executable: dumpexfat
+
+dumpexfat_src_files := dump/main.c
+
+dumpexfat_headers := \
+    $(libexfat_headers) \
+    $(LOCAL_PATH)/dump
+
+## TARGET ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := dumpexfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(dumpexfat_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(dumpexfat_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_EXECUTABLE)
+
+## HOST ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := dumpexfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(dumpexfat_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(dumpexfat_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_HOST_EXECUTABLE)
+
+########################################
+# executable: exfatlabel
+
+exfatlabel_src_files := label/main.c
+
+exfatlabel_headers := \
+    $(libexfat_headers) \
+    $(LOCAL_PATH)/label
+
+## TARGET ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := exfatlabel
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(exfatlabel_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(exfatlabel_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_EXECUTABLE)
+
+## HOST ##
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := exfatlabel
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(exfatlabel_src_files)
+LOCAL_CFLAGS := $(exfat_common_cflags)
+LOCAL_C_INCLUDES := $(exfatlabel_headers)
+LOCAL_STATIC_LIBRARIES := libexfat
+
+include $(BUILD_HOST_EXECUTABLE)
index e0d33e2..14a8058 100644 (file)
 #ifndef EXFAT_H_INCLUDED
 #define EXFAT_H_INCLUDED
 
+#ifndef ANDROID
+/* Android.mk is used instead of autotools when targeting Android */
 #include "config.h"
+#endif
 #include "compiler.h"
 #include "exfatfs.h"
 #include <stdio.h>