1# Copyright (C) 2008 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15 16LOCAL_PATH:= $(call my-dir) 17 18# 19# Common definitions. 20# 21 22src_files := \ 23 cmemory.c cstring.c \ 24 cwchar.c locmap.c \ 25 lrucache.cpp \ 26 punycode.cpp putil.cpp \ 27 sharedobject.cpp \ 28 simplepatternformatter.cpp \ 29 uarrsort.c ubidi.c \ 30 ubidiln.c ubidi_props.c \ 31 ubidiwrt.c ucase.cpp \ 32 ucasemap.cpp ucat.c \ 33 uchar.c ucln_cmn.c \ 34 ucmndata.c \ 35 ucnv2022.cpp ucnv_bld.cpp \ 36 ucnvbocu.cpp ucnv.c \ 37 ucnv_cb.c ucnv_cnv.c \ 38 ucnvdisp.c ucnv_err.c \ 39 ucnv_ext.cpp ucnvhz.c \ 40 ucnv_io.cpp ucnvisci.c \ 41 ucnvlat1.c ucnv_lmb.c \ 42 ucnvmbcs.c ucnvscsu.c \ 43 ucnv_set.c ucnv_u16.c \ 44 ucnv_u32.c ucnv_u7.c \ 45 ucnv_u8.c \ 46 udatamem.c \ 47 udataswp.c uenum.c \ 48 uhash.c uinit.cpp \ 49 uinvchar.c uloc.cpp \ 50 umapfile.c umath.c \ 51 umutex.cpp unames.cpp \ 52 uresbund.cpp \ 53 ures_cnv.c uresdata.c \ 54 usc_impl.c uscript.c \ 55 uscript_props.cpp \ 56 ushape.cpp ustrcase.cpp \ 57 ustr_cnv.c ustrfmt.c \ 58 ustring.cpp ustrtrns.cpp \ 59 ustr_wcs.cpp utf_impl.c \ 60 utrace.c utrie.cpp \ 61 utypes.c wintz.c \ 62 utrie2_builder.cpp icuplug.c \ 63 propsvec.c ulist.c \ 64 uloc_tag.c ucnv_ct.c 65 66src_files += \ 67 bmpset.cpp unisetspan.cpp \ 68 brkeng.cpp brkiter.cpp \ 69 caniter.cpp chariter.cpp \ 70 dictbe.cpp locbased.cpp \ 71 locid.cpp locutil.cpp \ 72 normlzr.cpp parsepos.cpp \ 73 propname.cpp rbbi.cpp \ 74 rbbidata.cpp rbbinode.cpp \ 75 rbbirb.cpp rbbiscan.cpp \ 76 rbbisetb.cpp rbbistbl.cpp \ 77 rbbitblb.cpp resbund_cnv.cpp \ 78 resbund.cpp ruleiter.cpp \ 79 schriter.cpp serv.cpp \ 80 servlk.cpp servlkf.cpp \ 81 servls.cpp servnotf.cpp \ 82 servrbf.cpp servslkf.cpp \ 83 ubrk.cpp \ 84 uchriter.cpp uhash_us.cpp \ 85 uidna.cpp uiter.cpp \ 86 unifilt.cpp unifunct.cpp \ 87 uniset.cpp uniset_props.cpp \ 88 unistr_case.cpp unistr_cnv.cpp \ 89 unistr.cpp unistr_props.cpp \ 90 unormcmp.cpp unorm.cpp \ 91 uobject.cpp uset.cpp \ 92 usetiter.cpp uset_props.cpp \ 93 usprep.cpp ustack.cpp \ 94 ustrenum.cpp utext.cpp \ 95 util.cpp util_props.cpp \ 96 uvector.cpp uvectr32.cpp \ 97 errorcode.cpp \ 98 bytestream.cpp stringpiece.cpp \ 99 dtintrv.cpp \ 100 ucnvsel.cpp uvectr64.cpp \ 101 locavailable.cpp locdispnames.cpp \ 102 loclikely.cpp locresdata.cpp \ 103 normalizer2impl.cpp normalizer2.cpp \ 104 filterednormalizer2.cpp ucol_swp.cpp \ 105 uprops.cpp utrie2.cpp \ 106 charstr.cpp uts46.cpp \ 107 udata.cpp appendable.cpp bytestrie.cpp \ 108 bytestriebuilder.cpp bytestrieiterator.cpp \ 109 messagepattern.cpp patternprops.cpp stringtriebuilder.cpp \ 110 ucharstrie.cpp ucharstriebuilder.cpp ucharstrieiterator.cpp \ 111 dictionarydata.cpp \ 112 ustrcase_locale.cpp unistr_titlecase_brkiter.cpp \ 113 uniset_closure.cpp ucasemap_titlecase_brkiter.cpp \ 114 ustr_titlecase_brkiter.cpp unistr_case_locale.cpp \ 115 listformatter.cpp 116 117 118# This is the empty compiled-in icu data structure 119# that we need to satisfy the linker. 120src_files += ../stubdata/stubdata.c 121 122c_includes := \ 123 $(LOCAL_PATH) \ 124 $(LOCAL_PATH)/../i18n 125 126# We make the ICU data directory relative to $ANDROID_ROOT on Android, so both 127# device and sim builds can use the same codepath, and it's hard to break one 128# without noticing because the other still works. 129local_cflags := '-DICU_DATA_DIR_PREFIX_ENV_VAR="ANDROID_ROOT"' 130local_cflags += '-DICU_DATA_DIR="/usr/icu"' 131 132# bionic doesn't have <langinfo.h>. 133local_cflags += -DU_HAVE_NL_LANGINFO_CODESET=0 134 135local_cflags += -D_REENTRANT 136local_cflags += -DU_COMMON_IMPLEMENTATION 137 138local_cflags += -O3 -fvisibility=hidden 139 140# 141# Build for the target (device). 142# 143 144include $(CLEAR_VARS) 145LOCAL_SRC_FILES += $(src_files) 146LOCAL_C_INCLUDES += $(c_includes) $(optional_android_logging_includes) 147LOCAL_CFLAGS += $(local_cflags) -DPIC -fPIC 148LOCAL_SHARED_LIBRARIES += libdl $(optional_android_logging_libraries) 149LOCAL_MODULE_TAGS := optional 150LOCAL_MODULE := libicuuc 151LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk 152LOCAL_REQUIRED_MODULES += icu-data 153# Use "-include" to not fail apps_only build. 154-include abi/cpp/use_rtti.mk 155-include external/stlport/libstlport.mk 156include $(BUILD_SHARED_LIBRARY) 157 158# 159# Build for the host. 160# 161 162include $(CLEAR_VARS) 163LOCAL_SRC_FILES += $(src_files) 164LOCAL_C_INCLUDES += $(c_includes) $(optional_android_logging_includes) 165LOCAL_CFLAGS += $(local_cflags) 166LOCAL_SHARED_LIBRARIES += $(optional_android_logging_libraries) 167LOCAL_LDLIBS += -ldl -lm -lpthread 168LOCAL_MODULE_TAGS := optional 169LOCAL_MODULE := libicuuc-host 170LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk 171LOCAL_REQUIRED_MODULES += icu-data-host 172LOCAL_MULTILIB := both 173include $(BUILD_HOST_SHARED_LIBRARY) 174 175# 176# Build as a static library against the NDK 177# 178 179include $(CLEAR_VARS) 180LOCAL_SDK_VERSION := 9 181LOCAL_NDK_STL_VARIANT := stlport_static 182LOCAL_C_INCLUDES += $(c_includes) 183LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH) 184LOCAL_CPP_FEATURES := rtti 185LOCAL_CFLAGS += $(local_cflags) -DPIC -fPIC -frtti 186# Using -Os over -O3 actually cuts down the final executable size by a few dozen kilobytes 187LOCAL_CFLAGS += -Os 188LOCAL_EXPORT_CFLAGS += -DU_STATIC_IMPLEMENTATION=1 189LOCAL_MODULE_TAGS := optional 190LOCAL_MODULE := libicuuc_static 191LOCAL_SRC_FILES += $(src_files) 192LOCAL_REQUIRED_MODULES += icu-data 193include $(BUILD_STATIC_LIBRARY) 194