1LOCAL_PATH:= $(call my-dir)
2
3# f2fs-tools depends on Linux kernel headers being in the system include path.
4ifeq ($(HOST_OS),linux)
5
6# The versions depend on $(LOCAL_PATH)/VERSION
7version_CFLAGS := -DF2FS_MAJOR_VERSION=1 -DF2FS_MINOR_VERSION=4 -DF2FS_TOOLS_VERSION=\"1.4.0\" -DF2FS_TOOLS_DATE=\"2014-10-18\"
8
9# external/e2fsprogs/lib is needed for uuid/uuid.h
10common_C_INCLUDES := $(LOCAL_PATH)/include external/e2fsprogs/lib/
11
12#----------------------------------------------------------
13include $(CLEAR_VARS)
14LOCAL_MODULE := libf2fs_fmt
15LOCAL_SRC_FILES := \
16	lib/libf2fs.c \
17	mkfs/f2fs_format.c \
18	mkfs/f2fs_format_utils.c \
19
20LOCAL_C_INCLUDES := $(common_C_INCLUDES)
21LOCAL_CFLAGS := $(version_CFLAGS)
22LOCAL_EXPORT_CFLAGS := $(version_CFLAGS)
23LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/mkfs
24include $(BUILD_STATIC_LIBRARY)
25
26#----------------------------------------------------------
27include $(CLEAR_VARS)
28LOCAL_MODULE := libf2fs_fmt_host
29LOCAL_SRC_FILES := \
30	lib/libf2fs.c \
31	mkfs/f2fs_format.c \
32	mkfs/f2fs_format_utils.c \
33
34LOCAL_C_INCLUDES := $(common_C_INCLUDES)
35LOCAL_CFLAGS := $(version_CFLAGS)
36LOCAL_EXPORT_CFLAGS := $(version_CFLAGS)
37LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/mkfs
38include $(BUILD_HOST_STATIC_LIBRARY)
39
40#----------------------------------------------------------
41include $(CLEAR_VARS)
42LOCAL_MODULE := libf2fs_fmt_host_dyn
43LOCAL_SRC_FILES := \
44	lib/libf2fs.c \
45	mkfs/f2fs_format.c \
46
47LOCAL_C_INCLUDES := $(common_C_INCLUDES)
48LOCAL_CFLAGS := $(version_CFLAGS)
49LOCAL_EXPORT_CFLAGS := $(version_CFLAGS)
50LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/mkfs
51LOCAL_STATIC_LIBRARIES := \
52     libf2fs_ioutils_host \
53     libext2_uuid-host \
54     libsparse_host \
55     libz
56# LOCAL_LDLIBS := -ldl
57include $(BUILD_HOST_SHARED_LIBRARY)
58
59#----------------------------------------------------------
60include $(CLEAR_VARS)
61# The LOCAL_MODULE name is referenced by the code. Don't change it.
62LOCAL_MODULE := mkfs.f2fs
63
64# mkfs.f2fs is used in recovery: must be static.
65LOCAL_FORCE_STATIC_EXECUTABLE := true
66
67LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
68
69LOCAL_SRC_FILES := \
70	lib/libf2fs_io.c \
71	mkfs/f2fs_format_main.c
72LOCAL_C_INCLUDES := $(common_C_INCLUDES)
73LOCAL_CFLAGS := $(version_CFLAGS)
74LOCAL_STATIC_LIBRARIES := libc libf2fs_fmt libext2_uuid_static
75LOCAL_MODULE_TAGS := optional
76include $(BUILD_EXECUTABLE)
77
78#----------------------------------------------------------
79include $(CLEAR_VARS)
80LOCAL_MODULE := make_f2fs
81
82LOCAL_SRC_FILES := \
83	lib/libf2fs_io.c \
84	mkfs/f2fs_format_main.c
85LOCAL_C_INCLUDES := $(common_C_INCLUDES)
86LOCAL_CFLAGS := $(version_CFLAGS)
87LOCAL_STATIC_LIBRARIES := libf2fs_fmt
88LOCAL_SHARED_LIBRARIES := libext2_uuid
89LOCAL_SYSTEM_SHARED_LIBRARIES := libc
90LOCAL_MODULE_TAGS := optional
91include $(BUILD_EXECUTABLE)
92
93#----------------------------------------------------------
94include $(CLEAR_VARS)
95# The LOCAL_MODULE name is referenced by the code. Don't change it.
96LOCAL_MODULE := fsck.f2fs
97LOCAL_SRC_FILES := \
98	fsck/dump.c \
99	fsck/fsck.c \
100	fsck/main.c \
101	fsck/mount.c \
102	lib/libf2fs.c \
103	lib/libf2fs_io.c \
104
105LOCAL_C_INCLUDES := $(common_C_INCLUDES)
106LOCAL_CFLAGS := $(version_CFLAGS)
107LOCAL_SHARED_LIBRARIES := libext2_uuid
108LOCAL_SYSTEM_SHARED_LIBRARIES := libc
109LOCAL_MODULE_TAGS := optional
110include $(BUILD_EXECUTABLE)
111
112#----------------------------------------------------------
113include $(CLEAR_VARS)
114LOCAL_MODULE := fsck.f2fs
115LOCAL_SRC_FILES := \
116	fsck/dump.c \
117	fsck/fsck.c \
118	fsck/main.c \
119	fsck/mount.c \
120	lib/libf2fs.c \
121	lib/libf2fs_io.c \
122
123LOCAL_C_INCLUDES := $(common_C_INCLUDES)
124LOCAL_CFLAGS := $(version_CFLAGS)
125LOCAL_HOST_SHARED_LIBRARIES :=  libext2_uuid_host
126include $(BUILD_HOST_EXECUTABLE)
127
128endif
129