1BASE_PATH := $(call my-dir) 2LOCAL_PATH:= $(call my-dir) 3 4include $(CLEAR_VARS) 5 6# We default to release for the Android build system. Developers debugging 7# code can build with "Debug" 8GYP_CONFIGURATION := Release 9 10LOCAL_MODULE_CLASS := STATIC_LIBRARIES 11LOCAL_MODULE := libsfntly 12LOCAL_MODULE_SUFFIX := .a 13LOCAL_MODULE_TAGS := optional 14 15LOCAL_CPP_EXTENSION := .cc 16LOCAL_GENERATED_SOURCES := 17 18LOCAL_SRC_FILES := \ 19 cpp/src/sfntly/data/byte_array.cc \ 20 cpp/src/sfntly/data/font_data.cc \ 21 cpp/src/sfntly/data/font_input_stream.cc \ 22 cpp/src/sfntly/data/font_output_stream.cc \ 23 cpp/src/sfntly/data/growable_memory_byte_array.cc \ 24 cpp/src/sfntly/data/memory_byte_array.cc \ 25 cpp/src/sfntly/data/readable_font_data.cc \ 26 cpp/src/sfntly/data/writable_font_data.cc \ 27 cpp/src/sfntly/font.cc \ 28 cpp/src/sfntly/font_factory.cc \ 29 cpp/src/sfntly/port/file_input_stream.cc \ 30 cpp/src/sfntly/port/lock.cc \ 31 cpp/src/sfntly/port/memory_input_stream.cc \ 32 cpp/src/sfntly/port/memory_output_stream.cc \ 33 cpp/src/sfntly/table/bitmap/big_glyph_metrics.cc \ 34 cpp/src/sfntly/table/bitmap/bitmap_glyph.cc \ 35 cpp/src/sfntly/table/bitmap/bitmap_glyph_info.cc \ 36 cpp/src/sfntly/table/bitmap/bitmap_size_table.cc \ 37 cpp/src/sfntly/table/bitmap/composite_bitmap_glyph.cc \ 38 cpp/src/sfntly/table/bitmap/ebdt_table.cc \ 39 cpp/src/sfntly/table/bitmap/eblc_table.cc \ 40 cpp/src/sfntly/table/bitmap/ebsc_table.cc \ 41 cpp/src/sfntly/table/bitmap/glyph_metrics.cc \ 42 cpp/src/sfntly/table/bitmap/index_sub_table.cc \ 43 cpp/src/sfntly/table/bitmap/index_sub_table_format1.cc \ 44 cpp/src/sfntly/table/bitmap/index_sub_table_format2.cc \ 45 cpp/src/sfntly/table/bitmap/index_sub_table_format3.cc \ 46 cpp/src/sfntly/table/bitmap/index_sub_table_format4.cc \ 47 cpp/src/sfntly/table/bitmap/index_sub_table_format5.cc \ 48 cpp/src/sfntly/table/bitmap/simple_bitmap_glyph.cc \ 49 cpp/src/sfntly/table/bitmap/small_glyph_metrics.cc \ 50 cpp/src/sfntly/table/byte_array_table_builder.cc \ 51 cpp/src/sfntly/table/core/cmap_table.cc \ 52 cpp/src/sfntly/table/core/font_header_table.cc \ 53 cpp/src/sfntly/table/core/horizontal_device_metrics_table.cc \ 54 cpp/src/sfntly/table/core/horizontal_header_table.cc \ 55 cpp/src/sfntly/table/core/horizontal_metrics_table.cc \ 56 cpp/src/sfntly/table/core/maximum_profile_table.cc \ 57 cpp/src/sfntly/table/core/name_table.cc \ 58 cpp/src/sfntly/table/core/os2_table.cc \ 59 cpp/src/sfntly/table/font_data_table.cc \ 60 cpp/src/sfntly/table/generic_table_builder.cc \ 61 cpp/src/sfntly/table/header.cc \ 62 cpp/src/sfntly/table/subtable.cc \ 63 cpp/src/sfntly/table/table.cc \ 64 cpp/src/sfntly/table/table_based_table_builder.cc \ 65 cpp/src/sfntly/table/truetype/glyph_table.cc \ 66 cpp/src/sfntly/table/truetype/loca_table.cc \ 67 cpp/src/sfntly/tag.cc \ 68 cpp/src/sample/chromium/font_subsetter.cc \ 69 cpp/src/sample/chromium/subsetter_impl.cc 70 71 72# Flags passed to both C and C++ files. 73MY_CFLAGS_Debug := \ 74 -fstack-protector \ 75 --param=ssp-buffer-size=4 \ 76 -Werror \ 77 -fno-exceptions \ 78 -fno-strict-aliasing \ 79 -Wall \ 80 -Wno-unused-parameter \ 81 -Wno-missing-field-initializers \ 82 -fvisibility=hidden \ 83 -pipe \ 84 -fPIC \ 85 -fno-tree-sra \ 86 -fuse-ld=gold \ 87 -Wno-psabi \ 88 -ffunction-sections \ 89 -funwind-tables \ 90 -g \ 91 -fstack-protector \ 92 -fno-short-enums \ 93 -finline-limit=64 \ 94 -Wa,--noexecstack \ 95 -U_FORTIFY_SOURCE \ 96 -Wno-extra \ 97 -Wno-ignored-qualifiers \ 98 -Wno-type-limits \ 99 -Os \ 100 -g \ 101 -fomit-frame-pointer \ 102 -fdata-sections \ 103 -ffunction-sections 104 105MY_DEFS_Debug := \ 106 '-DANGLE_DX11' \ 107 '-D_FILE_OFFSET_BITS=64' \ 108 '-DNO_TCMALLOC' \ 109 '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ 110 '-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \ 111 '-DDISABLE_NACL' \ 112 '-DCHROMIUM_BUILD' \ 113 '-DUSE_LIBJPEG_TURBO=1' \ 114 '-DUSE_PROPRIETARY_CODECS' \ 115 '-DENABLE_CONFIGURATION_POLICY' \ 116 '-DENABLE_GPU=1' \ 117 '-DUSE_OPENSSL=1' \ 118 '-DENABLE_EGLIMAGE=1' \ 119 '-DSFNTLY_NO_EXCEPTION' \ 120 '-DU_USING_ICU_NAMESPACE=0' \ 121 '-D__STDC_CONSTANT_MACROS' \ 122 '-D__STDC_FORMAT_MACROS' \ 123 '-DANDROID' \ 124 '-D__GNU_SOURCE=1' \ 125 '-DUSE_STLPORT=1' \ 126 '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ 127 '-DCHROME_BUILD_ID=""' \ 128 '-DDYNAMIC_ANNOTATIONS_ENABLED=1' \ 129 '-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \ 130 '-D_DEBUG' 131 132# Include paths placed before CFLAGS/CPPFLAGS 133LOCAL_C_INCLUDES_Debug := \ 134 $(LOCAL_PATH)/cpp/src \ 135 $(LOCAL_PATH) \ 136 external/icu/icu4c/source/common \ 137 external/icu/icu4c/source/i18n \ 138 frameworks/wilhelm/include \ 139 140 141# Flags passed to only C++ (and not C) files. 142LOCAL_CPPFLAGS_Debug := \ 143 -fno-rtti \ 144 -fno-threadsafe-statics \ 145 -fvisibility-inlines-hidden \ 146 -Wsign-compare \ 147 -Wno-abi \ 148 -Wno-error=c++0x-compat \ 149 -Wno-non-virtual-dtor \ 150 -Wno-sign-promo 151 152 153# Flags passed to both C and C++ files. 154MY_CFLAGS_Release := \ 155 -fstack-protector \ 156 --param=ssp-buffer-size=4 \ 157 -Werror \ 158 -fno-exceptions \ 159 -fno-strict-aliasing \ 160 -Wall \ 161 -Wno-unused-parameter \ 162 -Wno-missing-field-initializers \ 163 -fvisibility=hidden \ 164 -pipe \ 165 -fPIC \ 166 -fno-tree-sra \ 167 -fuse-ld=gold \ 168 -Wno-psabi \ 169 -ffunction-sections \ 170 -funwind-tables \ 171 -g \ 172 -fstack-protector \ 173 -fno-short-enums \ 174 -finline-limit=64 \ 175 -Wa,--noexecstack \ 176 -U_FORTIFY_SOURCE \ 177 -Wno-extra \ 178 -Wno-ignored-qualifiers \ 179 -Wno-type-limits \ 180 -Os \ 181 -fno-ident \ 182 -fdata-sections \ 183 -ffunction-sections \ 184 -fomit-frame-pointer 185 186MY_DEFS_Release := \ 187 '-DANGLE_DX11' \ 188 '-D_FILE_OFFSET_BITS=64' \ 189 '-DNO_TCMALLOC' \ 190 '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ 191 '-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE' \ 192 '-DDISABLE_NACL' \ 193 '-DCHROMIUM_BUILD' \ 194 '-DUSE_LIBJPEG_TURBO=1' \ 195 '-DUSE_PROPRIETARY_CODECS' \ 196 '-DENABLE_CONFIGURATION_POLICY' \ 197 '-DENABLE_GPU=1' \ 198 '-DUSE_OPENSSL=1' \ 199 '-DENABLE_EGLIMAGE=1' \ 200 '-DSFNTLY_NO_EXCEPTION' \ 201 '-DU_USING_ICU_NAMESPACE=0' \ 202 '-D__STDC_CONSTANT_MACROS' \ 203 '-D__STDC_FORMAT_MACROS' \ 204 '-DANDROID' \ 205 '-D__GNU_SOURCE=1' \ 206 '-DUSE_STLPORT=1' \ 207 '-D_STLP_USE_PTR_SPECIALIZATIONS=1' \ 208 '-DCHROME_BUILD_ID=""' \ 209 '-DNDEBUG' \ 210 '-DNVALGRIND' \ 211 '-DDYNAMIC_ANNOTATIONS_ENABLED=0' \ 212 '-D_FORTIFY_SOURCE=2' 213 214 215# Include paths placed before CFLAGS/CPPFLAGS 216LOCAL_C_INCLUDES_Release := \ 217 $(LOCAL_PATH)/cpp/src \ 218 $(LOCAL_PATH) \ 219 external/icu/icu4c/source/common \ 220 external/icu/icu4c/source/i18n \ 221 frameworks/wilhelm/include \ 222 223 224# Flags passed to only C++ (and not C) files. 225LOCAL_CPPFLAGS_Release := \ 226 -fno-rtti \ 227 -fno-threadsafe-statics \ 228 -fvisibility-inlines-hidden \ 229 -Wsign-compare \ 230 -Wno-abi \ 231 -Wno-error=c++0x-compat \ 232 -Wno-non-virtual-dtor \ 233 -Wno-sign-promo 234 235LOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) $(MY_DEFS_$(GYP_CONFIGURATION)) 236LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION)) 237LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION)) 238### Rules for final target. 239 240LOCAL_LDFLAGS_Debug := \ 241 -Wl,-z,now \ 242 -Wl,-z,relro \ 243 -Wl,-z,noexecstack \ 244 -fPIC \ 245 -Wl,-z,relro \ 246 -Wl,-z,now \ 247 -fuse-ld=gold \ 248 -nostdlib \ 249 -Wl,--no-undefined \ 250 -Wl,--exclude-libs=ALL \ 251 -Wl,--icf=safe \ 252 -Wl,--gc-sections \ 253 -Wl,-O1 \ 254 -Wl,--as-needed 255 256 257LOCAL_LDFLAGS_Release := \ 258 -Wl,-z,now \ 259 -Wl,-z,relro \ 260 -Wl,-z,noexecstack \ 261 -fPIC \ 262 -Wl,-z,relro \ 263 -Wl,-z,now \ 264 -fuse-ld=gold \ 265 -nostdlib \ 266 -Wl,--no-undefined \ 267 -Wl,--exclude-libs=ALL \ 268 -Wl,--icf=safe \ 269 -Wl,-O1 \ 270 -Wl,--as-needed \ 271 -Wl,--gc-sections 272 273 274LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) 275 276LOCAL_STATIC_LIBRARIES := 277 278# Enable grouping to fix circular references 279LOCAL_GROUP_STATIC_LIBRARIES := true 280 281LOCAL_SHARED_LIBRARIES := \ 282 libstlport \ 283 libdl \ 284 285include external/stlport/libstlport.mk 286 287include $(BUILD_STATIC_LIBRARY) 288