packaging: Enable LTO and set visibility to hidden
[platform/upstream/btrfs-progs.git] / Android.mk
1 LOCAL_PATH:= $(call my-dir)
2
3 #include $(call all-subdir-makefiles)
4
5 CFLAGS := -g -O1 -Wall -D_FORTIFY_SOURCE=2 -include config.h \
6         -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC
7
8 LDFLAGS := -static -rdynamic
9
10 LIBS := -luuid   -lblkid   -lz   -llzo2 -L. -lpthread
11 LIBBTRFS_LIBS := $(LIBS)
12
13 STATIC_CFLAGS := $(CFLAGS) -ffunction-sections -fdata-sections
14 STATIC_LDFLAGS := -static -Wl,--gc-sections
15 STATIC_LIBS := -luuid   -lblkid -luuid -lz   -llzo2 -L. -pthread
16
17 btrfs_shared_libraries := libext2_uuid \
18                         libext2_blkid
19
20 objects := ctree.c disk-io.c kernel-lib/radix-tree.c extent-tree.c print-tree.c \
21           root-tree.c dir-item.c file-item.c inode-item.c inode-map.c \
22           extent-cache.c extent_io.c volumes.c utils.c repair.c \
23           qgroup.c free-space-cache.c kernel-lib/list_sort.c props.c \
24           kernel-shared/ulist.c qgroup-verify.c backref.c string-table.c task-utils.c \
25           inode.c file.c find-root.c free-space-tree.c help.c send-dump.c \
26           fsfeatures.c kernel-lib/tables.c kernel-lib/raid56.c transaction.c
27 cmds_objects := cmds-subvolume.c cmds-filesystem.c cmds-device.c cmds-scrub.c \
28                cmds-inspect.c cmds-balance.c cmds-send.c cmds-receive.c \
29                cmds-quota.c cmds-qgroup.c cmds-replace.c cmds-check.c \
30                cmds-restore.c cmds-rescue.c chunk-recover.c super-recover.c \
31                cmds-property.c cmds-fi-usage.c cmds-inspect-dump-tree.c \
32                cmds-inspect-dump-super.c cmds-inspect-tree-stats.c cmds-fi-du.c \
33                mkfs/common.c
34 libbtrfs_objects := send-stream.c send-utils.c kernel-lib/rbtree.c btrfs-list.c \
35                    kernel-lib/crc32c.c messages.c \
36                    uuid-tree.c utils-lib.c rbtree-utils.c
37 libbtrfs_headers := send-stream.h send-utils.h send.h kernel-lib/rbtree.h btrfs-list.h \
38                    kernel-lib/crc32c.h kernel-lib/list.h kerncompat.h \
39                    kernel-lib/radix-tree.h kernel-lib/sizes.h kernel-lib/raid56.h \
40                    extent-cache.h extent_io.h ioctl.h ctree.h btrfsck.h version.h
41 blkid_objects := partition/ superblocks/ topology/
42
43
44 # external/e2fsprogs/lib is needed for uuid/uuid.h
45 common_C_INCLUDES := $(LOCAL_PATH) external/e2fsprogs/lib/ external/lzo/include/ external/zlib/
46
47 #----------------------------------------------------------
48 include $(CLEAR_VARS)
49 LOCAL_SRC_FILES := $(libbtrfs_objects)
50 LOCAL_CFLAGS := $(STATIC_CFLAGS)
51 LOCAL_MODULE := libbtrfs
52 LOCAL_C_INCLUDES := $(common_C_INCLUDES)
53 include $(BUILD_STATIC_LIBRARY)
54
55 #----------------------------------------------------------
56 include $(CLEAR_VARS)
57 LOCAL_MODULE := btrfs
58 #LOCAL_FORCE_STATIC_EXECUTABLE := true
59 LOCAL_SRC_FILES := \
60                 $(objects) \
61                 $(cmds_objects) \
62                 btrfs.c \
63                 help.c \
64
65 LOCAL_C_INCLUDES := $(common_C_INCLUDES)
66 LOCAL_CFLAGS := $(STATIC_CFLAGS)
67 #LOCAL_LDLIBS := $(LIBBTRFS_LIBS)
68 #LOCAL_LDFLAGS := $(STATIC_LDFLAGS)
69 LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries)
70 LOCAL_STATIC_LIBRARIES := libbtrfs liblzo-static libz
71 LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
72
73 LOCAL_EXPORT_C_INCLUDES := $(common_C_INCLUDES)
74 #LOCAL_MODULE_TAGS := optional
75 include $(BUILD_EXECUTABLE)
76
77 #----------------------------------------------------------
78 include $(CLEAR_VARS)
79 LOCAL_MODULE := mkfs.btrfs
80 LOCAL_SRC_FILES := \
81                 $(objects) \
82                 mkfs/common.c \
83                 mkfs/main.c
84
85 LOCAL_C_INCLUDES := $(common_C_INCLUDES)
86 LOCAL_CFLAGS := $(STATIC_CFLAGS)
87 #LOCAL_LDLIBS := $(LIBBTRFS_LIBS)
88 #LOCAL_LDFLAGS := $(STATIC_LDFLAGS)
89 LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries)
90 LOCAL_STATIC_LIBRARIES := libbtrfs liblzo-static
91 LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
92
93 LOCAL_EXPORT_C_INCLUDES := $(common_C_INCLUDES)
94 #LOCAL_MODULE_TAGS := optional
95 include $(BUILD_EXECUTABLE)
96
97 #---------------------------------------------------------------
98 include $(CLEAR_VARS)
99 LOCAL_MODULE := btrfstune
100 LOCAL_SRC_FILES := \
101                 $(objects) \
102                 btrfstune.c
103
104 LOCAL_C_INCLUDES := $(common_C_INCLUDES)
105 LOCAL_CFLAGS := $(STATIC_CFLAGS)
106 LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries)
107 #LOCAL_LDLIBS := $(LIBBTRFS_LIBS)
108 #LOCAL_LDFLAGS := $(STATIC_LDFLAGS)
109 LOCAL_SHARED_LIBRARIES := $(btrfs_shared_libraries)
110 LOCAL_STATIC_LIBRARIES := libbtrfs liblzo-static
111 LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
112
113 LOCAL_EXPORT_C_INCLUDES := $(common_C_INCLUDES)
114 LOCAL_MODULE_TAGS := optional
115 include $(BUILD_EXECUTABLE)
116 #--------------------------------------------------------------