Android.mk revision d3c8d5b8d4ade074129b65199a8048c81089ee0e
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	socket_inaddr_any_server.c \
31	socket_local_client.c \
32	socket_local_server.c \
33	socket_loopback_client.c \
34	socket_loopback_server.c \
35	socket_network_client.c \
36	sockets.c \
37	config_utils.c \
38	cpu_info.c \
39	load_file.c \
40	open_memstream.c \
41	strdup16to8.c \
42	strdup8to16.c \
43	record_stream.c \
44	process_name.c \
45	threads.c \
46	sched_policy.c \
47	iosched_policy.c \
48	str_parms.c \
49
50commonHostSources := \
51        ashmem-host.c
52
53# some files must not be compiled when building against Mingw
54# they correspond to features not used by our host development tools
55# which are also hard or even impossible to port to native Win32
56WINDOWS_HOST_ONLY :=
57ifeq ($(HOST_OS),windows)
58    ifeq ($(strip $(USE_CYGWIN)),)
59        WINDOWS_HOST_ONLY := 1
60    endif
61endif
62# USE_MINGW is defined when we build against Mingw on Linux
63ifneq ($(strip $(USE_MINGW)),)
64    WINDOWS_HOST_ONLY := 1
65endif
66
67ifneq ($(WINDOWS_HOST_ONLY),1)
68    commonSources += \
69        fs.c \
70        multiuser.c
71endif
72
73
74# Static library for host
75# ========================================================
76LOCAL_MODULE := libcutils
77LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
78LOCAL_LDLIBS := -lpthread
79LOCAL_STATIC_LIBRARIES := liblog
80LOCAL_CFLAGS += $(hostSmpFlag)
81include $(BUILD_HOST_STATIC_LIBRARY)
82
83
84# Static library for host, 64-bit
85# ========================================================
86include $(CLEAR_VARS)
87LOCAL_MODULE := lib64cutils
88LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
89LOCAL_LDLIBS := -lpthread
90LOCAL_STATIC_LIBRARIES := lib64log
91LOCAL_CFLAGS += $(hostSmpFlag) -m64
92include $(BUILD_HOST_STATIC_LIBRARY)
93
94# Tests for host
95# ========================================================
96include $(CLEAR_VARS)
97LOCAL_MODULE := tst_str_parms
98LOCAL_CFLAGS += -DTEST_STR_PARMS
99LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c
100LOCAL_STATIC_LIBRARIES := liblog
101LOCAL_MODULE_TAGS := optional
102include $(BUILD_HOST_EXECUTABLE)
103
104
105# Shared and static library for target
106# ========================================================
107
108include $(CLEAR_VARS)
109LOCAL_MODULE := libcutils
110LOCAL_SRC_FILES := $(commonSources) \
111        android_reboot.c \
112        ashmem-dev.c \
113        debugger.c \
114        klog.c \
115        partition_utils.c \
116        properties.c \
117        qtaguid.c \
118        trace.c \
119        uevent.c
120
121ifeq ($(TARGET_ARCH),arm)
122    LOCAL_SRC_FILES += arch-arm/memset32.S
123else  # !arm
124    ifeq ($(TARGET_ARCH),x86)
125        LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
126        LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c
127    else # !x86
128        ifeq ($(TARGET_ARCH),mips)
129            LOCAL_SRC_FILES += arch-mips/android_memset.c
130        else # !mips
131            LOCAL_SRC_FILES += memory.c
132        endif # !mips
133    endif # !x86
134endif # !arm
135
136LOCAL_C_INCLUDES := $(libcutils_c_includes)
137LOCAL_STATIC_LIBRARIES := liblog
138LOCAL_CFLAGS += $(targetSmpFlag)
139include $(BUILD_STATIC_LIBRARY)
140
141include $(CLEAR_VARS)
142LOCAL_MODULE := libcutils
143# TODO: remove liblog as whole static library, once we don't have prebuilt that requires
144# liblog symbols present in libcutils.
145LOCAL_WHOLE_STATIC_LIBRARIES := libcutils liblog
146LOCAL_SHARED_LIBRARIES := liblog
147LOCAL_CFLAGS += $(targetSmpFlag)
148LOCAL_C_INCLUDES := $(libcutils_c_includes)
149include $(BUILD_SHARED_LIBRARY)
150
151include $(CLEAR_VARS)
152LOCAL_MODULE := tst_str_parms
153LOCAL_CFLAGS += -DTEST_STR_PARMS
154LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c
155LOCAL_SHARED_LIBRARIES := liblog
156LOCAL_MODULE_TAGS := optional
157include $(BUILD_EXECUTABLE)
158
159include $(call all-makefiles-under,$(LOCAL_PATH))
160