Android.mk revision 02a7c3a7c3462250e853460190f3bd330105971b
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)
81ifneq ($(HOST_OS),windows)
82LOCAL_CFLAGS += -Werror
83endif
84include $(BUILD_HOST_STATIC_LIBRARY)
85
86
87# Static library for host, 64-bit
88# ========================================================
89include $(CLEAR_VARS)
90LOCAL_MODULE := lib64cutils
91LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c
92LOCAL_LDLIBS := -lpthread
93LOCAL_STATIC_LIBRARIES := lib64log
94LOCAL_CFLAGS += $(hostSmpFlag) -m64
95ifneq ($(HOST_OS),windows)
96LOCAL_CFLAGS += -Werror
97endif
98include $(BUILD_HOST_STATIC_LIBRARY)
99
100# Tests for host
101# ========================================================
102include $(CLEAR_VARS)
103LOCAL_MODULE := tst_str_parms
104LOCAL_CFLAGS += -DTEST_STR_PARMS
105ifneq ($(HOST_OS),windows)
106LOCAL_CFLAGS += -Werror
107endif
108LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c
109LOCAL_STATIC_LIBRARIES := liblog
110LOCAL_MODULE_TAGS := optional
111include $(BUILD_HOST_EXECUTABLE)
112
113
114# Shared and static library for target
115# ========================================================
116
117include $(CLEAR_VARS)
118LOCAL_MODULE := libcutils
119LOCAL_SRC_FILES := $(commonSources) \
120        android_reboot.c \
121        ashmem-dev.c \
122        debugger.c \
123        klog.c \
124        partition_utils.c \
125        properties.c \
126        qtaguid.c \
127        trace.c \
128        uevent.c
129
130ifeq ($(TARGET_ARCH),arm)
131    LOCAL_SRC_FILES += arch-arm/memset32.S
132else  # !arm
133    ifeq ($(TARGET_ARCH),x86)
134        LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
135        LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c
136    else # !x86
137        ifeq ($(TARGET_ARCH),mips)
138            LOCAL_SRC_FILES += arch-mips/android_memset.c
139        else # !mips
140            LOCAL_SRC_FILES += memory.c
141        endif # !mips
142    endif # !x86
143endif # !arm
144
145LOCAL_C_INCLUDES := $(libcutils_c_includes)
146LOCAL_STATIC_LIBRARIES := liblog
147LOCAL_CFLAGS += $(targetSmpFlag) -Werror
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)
158include $(BUILD_SHARED_LIBRARY)
159
160include $(CLEAR_VARS)
161LOCAL_MODULE := tst_str_parms
162LOCAL_CFLAGS += -DTEST_STR_PARMS -Werror
163LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c
164LOCAL_SHARED_LIBRARIES := liblog
165LOCAL_MODULE_TAGS := optional
166include $(BUILD_EXECUTABLE)
167
168include $(call all-makefiles-under,$(LOCAL_PATH))
169