summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen2016-06-07 00:31:58 -0500
committerDan Willemsen2016-07-12 18:37:08 -0500
commiteee8e7face19244897f533d5a5f7f95b30809494 (patch)
tree4f15b2b6170b4d8f528af08722b27c947812e315 /libcutils
parentb07df4dd3f27b6ec1ad4b377f8daa1df49cc72f2 (diff)
downloadplatform-system-core-eee8e7face19244897f533d5a5f7f95b30809494.tar.gz
platform-system-core-eee8e7face19244897f533d5a5f7f95b30809494.tar.xz
platform-system-core-eee8e7face19244897f533d5a5f7f95b30809494.zip
libcutils: Switch to Android.bp
Change-Id: If36cb30e8e4432f1a5c7f9a6d30a75c012a4c67c
Diffstat (limited to 'libcutils')
-rw-r--r--libcutils/Android.bp155
-rw-r--r--libcutils/Android.mk153
-rw-r--r--libcutils/tests/Android.bp72
-rw-r--r--libcutils/tests/Android.mk81
4 files changed, 227 insertions, 234 deletions
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
new file mode 100644
index 000000000..4f26034c3
--- /dev/null
+++ b/libcutils/Android.bp
@@ -0,0 +1,155 @@
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//
16
17// some files must not be compiled when building against Mingw
18// they correspond to features not used by our host development tools
19// which are also hard or even impossible to port to native Win32
20libcutils_nonwindows_sources = [
21 "fs.c",
22 "multiuser.c",
23 "socket_inaddr_any_server_unix.c",
24 "socket_local_client_unix.c",
25 "socket_local_server_unix.c",
26 "socket_loopback_client_unix.c",
27 "socket_loopback_server_unix.c",
28 "socket_network_client_unix.c",
29 "sockets_unix.cpp",
30 "str_parms.c",
31]
32
33cc_library {
34 name: "libcutils",
35 host_supported: true,
36 srcs: [
37 "config_utils.c",
38 "fs_config.c",
39 "canned_fs_config.c",
40 "hashmap.c",
41 "iosched_policy.c",
42 "load_file.c",
43 "native_handle.c",
44 "open_memstream.c",
45 "process_name.c",
46 "record_stream.c",
47 "sched_policy.c",
48 "sockets.cpp",
49 "strdup16to8.c",
50 "strdup8to16.c",
51 "strlcpy.c",
52 "threads.c",
53 ],
54
55 target: {
56 host: {
57 srcs: ["dlmalloc_stubs.c"],
58 },
59 not_windows: {
60 srcs: libcutils_nonwindows_sources + [
61 "ashmem-host.c",
62 "trace-host.c",
63 ],
64 },
65 windows: {
66 srcs: [
67 "socket_inaddr_any_server_windows.c",
68 "socket_network_client_windows.c",
69 "sockets_windows.cpp",
70 ],
71
72 enabled: true,
73 shared: {
74 enabled: false,
75 },
76 },
77
78 android: {
79 srcs: libcutils_nonwindows_sources + [
80 "android_reboot.c",
81 "ashmem-dev.c",
82 "debugger.c",
83 "klog.cpp",
84 "partition_utils.c",
85 "properties.c",
86 "qtaguid.c",
87 "trace-dev.c",
88 "uevent.c",
89 ],
90
91 // TODO: remove liblog as whole static library, once we don't have prebuilt that requires
92 // liblog symbols present in libcutils.
93 whole_static_libs: [
94 "liblog",
95 ],
96
97 static_libs: ["libdebuggerd_client"],
98 export_static_lib_headers: ["libdebuggerd_client"],
99
100 cflags: [
101 "-std=gnu90",
102 ],
103 },
104
105 android_arm: {
106 srcs: ["arch-arm/memset32.S"],
107 },
108 android_arm64: {
109 srcs: ["arch-arm64/android_memset.S"],
110 },
111
112 android_mips: {
113 srcs: ["arch-mips/android_memset.c"],
114 },
115 android_mips64: {
116 srcs: ["arch-mips/android_memset.c"],
117 },
118
119 android_x86: {
120 srcs: [
121 "arch-x86/android_memset16.S",
122 "arch-x86/android_memset32.S",
123 ],
124 },
125
126 android_x86_64: {
127 srcs: [
128 "arch-x86_64/android_memset16.S",
129 "arch-x86_64/android_memset32.S",
130 ],
131 },
132 },
133
134 shared_libs: ["liblog"],
135 product_variables: {
136 cpusets: {
137 cflags: ["-DUSE_CPUSETS"],
138 },
139 schedboost: {
140 cflags: ["-DUSE_SCHEDBOOST"],
141 },
142 },
143 cflags: [
144 "-Werror",
145 "-Wall",
146 "-Wextra",
147 ],
148
149 clang: true,
150 sanitize: {
151 misc_undefined: ["integer"],
152 },
153}
154
155subdirs = ["tests"]
diff --git a/libcutils/Android.mk b/libcutils/Android.mk
deleted file mode 100644
index c830182f9..000000000
--- a/libcutils/Android.mk
+++ /dev/null
@@ -1,153 +0,0 @@
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
19libcutils_common_sources := \
20 config_utils.c \
21 fs_config.c \
22 canned_fs_config.c \
23 hashmap.c \
24 iosched_policy.c \
25 load_file.c \
26 native_handle.c \
27 open_memstream.c \
28 process_name.c \
29 record_stream.c \
30 sched_policy.c \
31 sockets.cpp \
32 strdup16to8.c \
33 strdup8to16.c \
34 strlcpy.c \
35 threads.c \
36
37# some files must not be compiled when building against Mingw
38# they correspond to features not used by our host development tools
39# which are also hard or even impossible to port to native Win32
40libcutils_nonwindows_sources := \
41 fs.c \
42 multiuser.c \
43 socket_inaddr_any_server_unix.c \
44 socket_local_client_unix.c \
45 socket_local_server_unix.c \
46 socket_loopback_client_unix.c \
47 socket_loopback_server_unix.c \
48 socket_network_client_unix.c \
49 sockets_unix.cpp \
50 str_parms.c \
51
52libcutils_nonwindows_host_sources := \
53 ashmem-host.c \
54 trace-host.c \
55
56libcutils_windows_host_sources := \
57 socket_inaddr_any_server_windows.c \
58 socket_network_client_windows.c \
59 sockets_windows.cpp \
60
61# Shared and static library for host
62# Note: when linking this library on Windows, you must also link to Winsock2
63# using "LOCAL_LDLIBS_windows := -lws2_32".
64# ========================================================
65LOCAL_MODULE := libcutils
66LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c
67LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources)
68LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources)
69LOCAL_SRC_FILES_windows := $(libcutils_windows_host_sources)
70LOCAL_STATIC_LIBRARIES := liblog
71LOCAL_CFLAGS := -Werror -Wall -Wextra
72LOCAL_MULTILIB := both
73LOCAL_MODULE_HOST_OS := darwin linux windows
74include $(BUILD_HOST_STATIC_LIBRARY)
75
76include $(CLEAR_VARS)
77LOCAL_MODULE := libcutils
78LOCAL_SRC_FILES := $(libcutils_common_sources) dlmalloc_stubs.c
79LOCAL_SRC_FILES_darwin := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources)
80LOCAL_SRC_FILES_linux := $(libcutils_nonwindows_sources) $(libcutils_nonwindows_host_sources)
81LOCAL_SHARED_LIBRARIES := liblog
82LOCAL_CFLAGS := -Werror -Wall -Wextra
83LOCAL_MULTILIB := both
84include $(BUILD_HOST_SHARED_LIBRARY)
85
86
87
88# Shared and static library for target
89# ========================================================
90
91include $(CLEAR_VARS)
92LOCAL_MODULE := libcutils
93LOCAL_SRC_FILES := $(libcutils_common_sources) \
94 $(libcutils_nonwindows_sources) \
95 android_reboot.c \
96 ashmem-dev.c \
97 debugger.c \
98 klog.cpp \
99 partition_utils.c \
100 properties.c \
101 qtaguid.c \
102 trace-dev.c \
103 uevent.c \
104
105LOCAL_SRC_FILES_arm += arch-arm/memset32.S
106LOCAL_SRC_FILES_arm64 += arch-arm64/android_memset.S
107
108LOCAL_SRC_FILES_mips += arch-mips/android_memset.c
109LOCAL_SRC_FILES_mips64 += arch-mips/android_memset.c
110
111LOCAL_SRC_FILES_x86 += \
112 arch-x86/android_memset16.S \
113 arch-x86/android_memset32.S \
114
115LOCAL_SRC_FILES_x86_64 += \
116 arch-x86_64/android_memset16.S \
117 arch-x86_64/android_memset32.S \
118
119LOCAL_C_INCLUDES := $(libcutils_c_includes)
120LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := libdebuggerd_client
121LOCAL_STATIC_LIBRARIES := liblog libdebuggerd_client
122ifneq ($(ENABLE_CPUSETS),)
123LOCAL_CFLAGS += -DUSE_CPUSETS
124endif
125ifneq ($(ENABLE_SCHEDBOOST),)
126LOCAL_CFLAGS += -DUSE_SCHEDBOOST
127endif
128LOCAL_CFLAGS += -Werror -Wall -Wextra -std=gnu90
129LOCAL_CLANG := true
130LOCAL_SANITIZE := integer
131include $(BUILD_STATIC_LIBRARY)
132
133include $(CLEAR_VARS)
134LOCAL_MODULE := libcutils
135# TODO: remove liblog as whole static library, once we don't have prebuilt that requires
136# liblog symbols present in libcutils.
137LOCAL_WHOLE_STATIC_LIBRARIES := libcutils liblog
138LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := libdebuggerd_client
139LOCAL_STATIC_LIBRARIES := libdebuggerd_client
140LOCAL_SHARED_LIBRARIES := liblog
141ifneq ($(ENABLE_CPUSETS),)
142LOCAL_CFLAGS += -DUSE_CPUSETS
143endif
144ifneq ($(ENABLE_SCHEDBOOST),)
145LOCAL_CFLAGS += -DUSE_SCHEDBOOST
146endif
147LOCAL_CFLAGS += -Werror -Wall -Wextra
148LOCAL_C_INCLUDES := $(libcutils_c_includes)
149LOCAL_CLANG := true
150LOCAL_SANITIZE := integer
151include $(BUILD_SHARED_LIBRARY)
152
153include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/libcutils/tests/Android.bp b/libcutils/tests/Android.bp
new file mode 100644
index 000000000..530c74716
--- /dev/null
+++ b/libcutils/tests/Android.bp
@@ -0,0 +1,72 @@
1// Copyright (C) 2014 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
15cc_defaults {
16 name: "libcutils_test_default",
17 srcs: ["sockets_test.cpp"],
18
19 target: {
20 android: {
21 srcs: [
22 "MemsetTest.cpp",
23 "PropertiesTest.cpp",
24 "trace-dev_test.cpp",
25 ],
26 },
27
28 not_windows: {
29 srcs: ["test_str_parms.cpp"],
30 },
31 },
32
33 multilib: {
34 lib32: {
35 suffix: "32",
36 },
37 lib64: {
38 suffix: "64",
39 },
40 },
41}
42
43test_libraries = [
44 "libcutils",
45 "liblog",
46 "libbase",
47]
48
49cc_test {
50 name: "libcutils_test",
51 defaults: ["libcutils_test_default"],
52 host_supported: true,
53 shared_libs: test_libraries,
54}
55
56cc_test {
57 name: "libcutils_test_static",
58 defaults: ["libcutils_test_default"],
59 static_libs: ["libc"] + test_libraries,
60 stl: "libc++_static",
61
62 target: {
63 android: {
64 static_executable: true,
65 },
66 windows: {
67 host_ldlibs: ["-lws2_32"],
68
69 enabled: true,
70 },
71 },
72}
diff --git a/libcutils/tests/Android.mk b/libcutils/tests/Android.mk
deleted file mode 100644
index 52cf5f407..000000000
--- a/libcutils/tests/Android.mk
+++ /dev/null
@@ -1,81 +0,0 @@
1# Copyright (C) 2014 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
15LOCAL_PATH := $(call my-dir)
16
17test_src_files := \
18 sockets_test.cpp \
19
20test_src_files_nonwindows := \
21 test_str_parms.cpp \
22
23test_target_only_src_files := \
24 MemsetTest.cpp \
25 PropertiesTest.cpp \
26 trace-dev_test.cpp \
27
28test_libraries := libcutils liblog libbase
29
30
31#
32# Target.
33#
34
35include $(CLEAR_VARS)
36LOCAL_MODULE := libcutils_test
37LOCAL_SRC_FILES := $(test_src_files) $(test_target_only_src_files)
38LOCAL_SHARED_LIBRARIES := $(test_libraries)
39LOCAL_MULTILIB := both
40LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
41LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
42include $(BUILD_NATIVE_TEST)
43
44include $(CLEAR_VARS)
45LOCAL_MODULE := libcutils_test_static
46LOCAL_FORCE_STATIC_EXECUTABLE := true
47LOCAL_SRC_FILES := $(test_src_files) $(test_target_only_src_files)
48LOCAL_STATIC_LIBRARIES := libc $(test_libraries)
49LOCAL_CXX_STL := libc++_static
50LOCAL_MULTILIB := both
51LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
52LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
53include $(BUILD_NATIVE_TEST)
54
55
56#
57# Host.
58#
59
60include $(CLEAR_VARS)
61LOCAL_MODULE := libcutils_test
62LOCAL_SRC_FILES := $(test_src_files) $(test_src_files_nonwindows)
63LOCAL_SHARED_LIBRARIES := $(test_libraries)
64LOCAL_MULTILIB := both
65LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
66LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
67include $(BUILD_HOST_NATIVE_TEST)
68
69include $(CLEAR_VARS)
70LOCAL_MODULE := libcutils_test_static
71LOCAL_SRC_FILES := $(test_src_files)
72LOCAL_SRC_FILES_darwin := $(test_src_files_nonwindows)
73LOCAL_SRC_FILES_linux := $(test_src_files_nonwindows)
74LOCAL_STATIC_LIBRARIES := $(test_libraries)
75LOCAL_LDLIBS_windows := -lws2_32
76LOCAL_CXX_STL := libc++_static
77LOCAL_MULTILIB := both
78LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
79LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
80LOCAL_MODULE_HOST_OS := darwin linux windows
81include $(BUILD_HOST_NATIVE_TEST)