1# 2# Copyright (C) 2008 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16LOCAL_PATH := $(my-dir) 17include $(CLEAR_VARS) 18 19ifeq ($(TARGET_CPU_SMP),true) 20 targetSmpFlag := -DANDROID_SMP=1 21else 22 targetSmpFlag := -DANDROID_SMP=0 23endif 24hostSmpFlag := -DANDROID_SMP=0 25 26commonSources := \ 27 hashmap.c \ 28 atomic.c.arm \ 29 native_handle.c \ 30 config_utils.c \ 31 cpu_info.c \ 32 load_file.c \ 33 open_memstream.c \ 34 strdup16to8.c \ 35 strdup8to16.c \ 36 record_stream.c \ 37 process_name.c \ 38 threads.c \ 39 sched_policy.c \ 40 iosched_policy.c \ 41 str_parms.c \ 42 43# some files must not be compiled when building against Mingw 44# they correspond to features not used by our host development tools 45# which are also hard or even impossible to port to native Win32 46WINDOWS_HOST_ONLY := 47ifeq ($(HOST_OS),windows) 48 ifeq ($(strip $(USE_CYGWIN)),) 49 WINDOWS_HOST_ONLY := 1 50 endif 51endif 52# USE_MINGW is defined when we build against Mingw on Linux 53ifneq ($(strip $(USE_MINGW)),) 54 WINDOWS_HOST_ONLY := 1 55endif 56 57ifneq ($(WINDOWS_HOST_ONLY),1) 58 commonSources += \ 59 fs.c \ 60 multiuser.c \ 61 socket_inaddr_any_server.c \ 62 socket_local_client.c \ 63 socket_local_server.c \ 64 socket_loopback_client.c \ 65 socket_loopback_server.c \ 66 socket_network_client.c \ 67 sockets.c \ 68 69 commonHostSources += \ 70 ashmem-host.c 71 72endif 73 74 75# Static library for host 76# ======================================================== 77LOCAL_MODULE := libcutils 78LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c 79LOCAL_STATIC_LIBRARIES := liblog 80LOCAL_CFLAGS += $(hostSmpFlag) 81ifneq ($(HOST_OS),windows) 82LOCAL_CFLAGS += -Werror 83endif 84LOCAL_MULTILIB := both 85LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 86include $(BUILD_HOST_STATIC_LIBRARY) 87 88 89# Tests for host 90# ======================================================== 91include $(CLEAR_VARS) 92LOCAL_MODULE := tst_str_parms 93LOCAL_CFLAGS += -DTEST_STR_PARMS 94ifneq ($(HOST_OS),windows) 95LOCAL_CFLAGS += -Werror 96endif 97LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c 98LOCAL_STATIC_LIBRARIES := liblog 99LOCAL_MODULE_TAGS := optional 100LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 101include $(BUILD_HOST_EXECUTABLE) 102 103 104# Shared and static library for target 105# ======================================================== 106 107include $(CLEAR_VARS) 108LOCAL_MODULE := libcutils 109LOCAL_SRC_FILES := $(commonSources) \ 110 android_reboot.c \ 111 ashmem-dev.c \ 112 debugger.c \ 113 klog.c \ 114 memory.c \ 115 partition_utils.c \ 116 properties.c \ 117 qtaguid.c \ 118 trace.c \ 119 uevent.c \ 120 121LOCAL_SRC_FILES_arm += \ 122 arch-arm/memset32.S \ 123 124LOCAL_SRC_FILES_arm64 += \ 125 arch-arm64/android_memset.S \ 126 127LOCAL_SRC_FILES_mips += \ 128 arch-mips/android_memset.c \ 129 130LOCAL_SRC_FILES_x86 += \ 131 arch-x86/android_memset16.S \ 132 arch-x86/android_memset32.S \ 133 134LOCAL_SRC_FILES_x86_64 += \ 135 arch-x86_64/android_memset16_SSE2-atom.S \ 136 arch-x86_64/android_memset32_SSE2-atom.S \ 137 138LOCAL_CFLAGS_arm += -DHAVE_MEMSET16 -DHAVE_MEMSET32 139LOCAL_CFLAGS_arm64 += -DHAVE_MEMSET16 -DHAVE_MEMSET32 140LOCAL_CFLAGS_mips += -DHAVE_MEMSET16 -DHAVE_MEMSET32 141LOCAL_CFLAGS_x86 += -DHAVE_MEMSET16 -DHAVE_MEMSET32 142LOCAL_CFLAGS_x86_64 += -DHAVE_MEMSET16 -DHAVE_MEMSET32 143 144LOCAL_C_INCLUDES := $(libcutils_c_includes) 145LOCAL_STATIC_LIBRARIES := liblog 146LOCAL_CFLAGS += $(targetSmpFlag) -Werror 147LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 148include $(BUILD_STATIC_LIBRARY) 149 150include $(CLEAR_VARS) 151LOCAL_MODULE := libcutils 152# TODO: remove liblog as whole static library, once we don't have prebuilt that requires 153# liblog symbols present in libcutils. 154LOCAL_WHOLE_STATIC_LIBRARIES := libcutils liblog 155LOCAL_SHARED_LIBRARIES := liblog 156LOCAL_CFLAGS += $(targetSmpFlag) -Werror 157LOCAL_C_INCLUDES := $(libcutils_c_includes) 158LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 159include $(BUILD_SHARED_LIBRARY) 160 161include $(CLEAR_VARS) 162LOCAL_MODULE := tst_str_parms 163LOCAL_CFLAGS += -DTEST_STR_PARMS -Werror 164LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c 165LOCAL_SHARED_LIBRARIES := liblog 166LOCAL_MODULE_TAGS := optional 167LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 168include $(BUILD_EXECUTABLE) 169 170include $(call all-makefiles-under,$(LOCAL_PATH)) 171