blob: 30050922b2b2163f953528b1727b54b79a15d4c2 [file] [log] [blame]
Serban Constantinescue2104882013-09-26 11:37:10 +01001LOCAL_PATH := $(call my-dir)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08002
Christopher Ferrisd7a63292013-10-03 13:26:22 -07003# Make everything depend on any changes to included makefiles.
Ying Wangf25d6772014-01-23 15:17:50 -08004libc_common_additional_dependencies := $(LOCAL_PATH)/Android.mk
5
6# Load config for TARGET_ARCH
7my_2nd_arch_prefix :=
8include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
9libc_common_additional_dependencies += \
10 $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
11
12
13ifdef TARGET_2ND_ARCH
14# Load config for TARGET_2ND_ARCH
15my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
16include $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
17my_2nd_arch_prefix :=
18libc_common_additional_dependencies += \
19 $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
20endif
21
22# crt obj files
23# ========================================================
24# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
25libc_crt_target_cflags := \
26 -I$(LOCAL_PATH)/include \
27 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
28
29my_2nd_arch_prefix :=
30include $(LOCAL_PATH)/crt.mk
31ifdef TARGET_2ND_ARCH
32my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
33include $(LOCAL_PATH)/crt.mk
34my_2nd_arch_prefix :=
35endif
Christopher Ferrisd7a63292013-10-03 13:26:22 -070036
Dima Zavinca122b02009-05-27 10:52:37 -070037# Define the common source files for all the libc instances
38# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080039libc_common_src_files := \
Ying Wang76c8b882014-02-12 16:40:55 -080040 bionic/bindresvport.c \
Ying Wang76c8b882014-02-12 16:40:55 -080041 bionic/daemon.c \
42 bionic/err.c \
43 bionic/ether_aton.c \
44 bionic/ether_ntoa.c \
Ying Wang76c8b882014-02-12 16:40:55 -080045 bionic/fts.c \
Ying Wang76c8b882014-02-12 16:40:55 -080046 bionic/gethostname.c \
Ying Wang76c8b882014-02-12 16:40:55 -080047 bionic/getpriority.c \
Ying Wang76c8b882014-02-12 16:40:55 -080048 bionic/if_indextoname.c \
49 bionic/if_nametoindex.c \
50 bionic/initgroups.c \
51 bionic/ioctl.c \
52 bionic/isatty.c \
Ying Wang76c8b882014-02-12 16:40:55 -080053 bionic/memmem.c \
Ying Wang76c8b882014-02-12 16:40:55 -080054 bionic/pathconf.c \
Ying Wang76c8b882014-02-12 16:40:55 -080055 bionic/pututline.c \
Ying Wang76c8b882014-02-12 16:40:55 -080056 bionic/sched_cpualloc.c \
57 bionic/sched_cpucount.c \
58 bionic/semaphore.c \
Ying Wang76c8b882014-02-12 16:40:55 -080059 bionic/sigblock.c \
60 bionic/siginterrupt.c \
Ying Wang76c8b882014-02-12 16:40:55 -080061 bionic/sigsetmask.c \
Ying Wang76c8b882014-02-12 16:40:55 -080062 bionic/system_properties_compat.c \
Elliott Hughesd18f4b22014-11-03 12:32:17 -080063 stdio/findfp.c \
Elliott Hughes27d276f2014-12-01 16:13:30 -080064 stdio/fread.c \
Elliott Hughesaa0ebda2014-02-11 19:57:06 -080065 stdio/snprintf.c\
66 stdio/sprintf.c \
Elliott Hugheseb847bc2013-10-09 15:50:50 -070067
Christopher Ferris59a13c12013-08-01 13:13:33 -070068# Fortify implementations of libc functions.
69libc_common_src_files += \
Nick Kralevich90201d52013-10-02 16:11:30 -070070 bionic/__FD_chk.cpp \
Christopher Ferris59a13c12013-08-01 13:13:33 -070071 bionic/__fgets_chk.cpp \
Christopher Ferris59a13c12013-08-01 13:13:33 -070072 bionic/__memmove_chk.cpp \
Nick Kralevichb036b5c2013-10-09 20:16:34 -070073 bionic/__read_chk.cpp \
Nick Kralevich60f4f9a2013-09-24 16:32:07 -070074 bionic/__recvfrom_chk.cpp \
Christopher Ferris950a58e2014-04-04 14:38:18 -070075 bionic/__stpcpy_chk.cpp \
76 bionic/__stpncpy_chk.cpp \
Christopher Ferris59a13c12013-08-01 13:13:33 -070077 bionic/__strchr_chk.cpp \
Christopher Ferris59a13c12013-08-01 13:13:33 -070078 bionic/__strlcat_chk.cpp \
79 bionic/__strlcpy_chk.cpp \
80 bionic/__strlen_chk.cpp \
81 bionic/__strncat_chk.cpp \
82 bionic/__strncpy_chk.cpp \
83 bionic/__strrchr_chk.cpp \
84 bionic/__umask_chk.cpp \
85 bionic/__vsnprintf_chk.cpp \
86 bionic/__vsprintf_chk.cpp \
87
Elliott Hughes29c7f0b2012-10-22 17:05:27 -070088libc_bionic_src_files := \
Elliott Hughes61e699a2013-06-12 14:05:46 -070089 bionic/abort.cpp \
Sreeram Ramachandran8f0cd8a2014-05-13 15:40:26 -070090 bionic/accept.cpp \
Sreeram Ramachandran903b7882014-05-19 13:39:57 -070091 bionic/accept4.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -070092 bionic/access.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -070093 bionic/assert.cpp \
Elliott Hughes5a817382014-03-12 16:12:57 -070094 bionic/atof.cpp \
Elliott Hughes11952072013-10-24 15:15:14 -070095 bionic/bionic_time_conversions.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -080096 bionic/brk.cpp \
Dan Albert7a7f9952014-06-02 11:33:04 -070097 bionic/c16rtomb.cpp \
98 bionic/c32rtomb.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -070099 bionic/chmod.cpp \
100 bionic/chown.cpp \
Elliott Hughes58d9e282014-04-22 17:41:00 -0700101 bionic/clearenv.cpp \
Elliott Hughescccfe1e2014-03-11 13:37:11 -0700102 bionic/clock.cpp \
Elliott Hughes36d61882013-11-19 13:31:58 -0800103 bionic/clone.cpp \
Calin Juravlef8408c52014-07-10 12:47:13 +0100104 bionic/__cmsg_nxthdr.cpp \
Sreeram Ramachandranceb5bd72014-05-12 11:19:16 -0700105 bionic/connect.cpp \
Dan Albertdfb5ce42014-07-09 22:51:34 +0000106 bionic/ctype.cpp \
David 'Digit' Turnerc30396f2012-10-29 15:32:54 +0100107 bionic/dirent.cpp \
Elliott Hughescac7b9d2013-10-23 09:48:29 -0700108 bionic/dup2.cpp \
109 bionic/epoll_create.cpp \
Elliott Hughes11952072013-10-24 15:15:14 -0700110 bionic/epoll_pwait.cpp \
Elliott Hughesaa0ebda2014-02-11 19:57:06 -0800111 bionic/epoll_wait.cpp \
Elliott Hughes2a0b8732013-10-08 18:50:24 -0700112 bionic/__errno.cpp \
Kito Cheng9b848242013-04-03 11:29:40 +0800113 bionic/eventfd_read.cpp \
114 bionic/eventfd_write.cpp \
Elliott Hughesbf425682013-10-24 16:29:40 -0700115 bionic/ffs.cpp \
Elliott Hughes53e43292014-02-24 18:00:43 -0800116 bionic/flockfile.cpp \
Elliott Hughes232163c2013-10-09 17:35:36 -0700117 bionic/fork.cpp \
Elliott Hughes02c78a32014-04-11 17:02:20 -0700118 bionic/fpclassify.cpp \
Elliott Hughesd0be7c82013-08-08 17:13:33 -0700119 bionic/futimens.cpp \
Nick Kralevich2c5153b2013-01-11 14:43:05 -0800120 bionic/getauxval.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700121 bionic/getcwd.cpp \
Elliott Hughes6209c812014-07-18 15:57:41 -0700122 bionic/getentropy_linux.c \
Elliott Hughes247dc912014-03-10 17:17:01 -0700123 bionic/getpgrp.cpp \
Elliott Hughes7086ad62014-06-19 16:39:01 -0700124 bionic/getpid.cpp \
Elliott Hughes5d9a7ba2014-05-30 19:00:03 -0700125 bionic/gettid.cpp \
Elliott Hughescac7b9d2013-10-23 09:48:29 -0700126 bionic/inotify_init.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700127 bionic/lchown.cpp \
Calin Juravlefe317a32014-02-21 15:11:03 +0000128 bionic/lfs64_support.cpp \
Elliott Hughes0990d4f2014-04-30 09:45:40 -0700129 bionic/__libc_current_sigrtmax.cpp \
130 bionic/__libc_current_sigrtmin.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800131 bionic/libc_init_common.cpp \
Elliott Hughes8f2a5a02013-03-15 15:30:25 -0700132 bionic/libc_logging.cpp \
Elliott Hughes58b57542012-10-29 14:27:10 -0700133 bionic/libgen.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700134 bionic/link.cpp \
Elliott Hughes5363a452014-04-08 14:34:12 -0700135 bionic/locale.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700136 bionic/lstat.cpp \
Dan Albert7a7f9952014-06-02 11:33:04 -0700137 bionic/mbrtoc16.cpp \
138 bionic/mbrtoc32.cpp \
139 bionic/mbstate.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700140 bionic/mkdir.cpp \
Elliott Hughes594b1a42013-10-22 10:54:11 -0700141 bionic/mkfifo.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700142 bionic/mknod.cpp \
Elliott Hugheseb664e22014-05-13 10:44:07 -0700143 bionic/mntent.cpp \
Sreeram Ramachandran8205a612014-05-13 17:24:03 -0700144 bionic/NetdClientDispatch.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700145 bionic/open.cpp \
Elliott Hughes11952072013-10-24 15:15:14 -0700146 bionic/pause.cpp \
Elliott Hughescac7b9d2013-10-23 09:48:29 -0700147 bionic/pipe.cpp \
Elliott Hughes11952072013-10-24 15:15:14 -0700148 bionic/poll.cpp \
Elliott Hughes00008262014-09-10 17:39:00 -0700149 bionic/posix_fadvise.cpp \
Elliott Hughesf64b8ea2014-02-03 16:20:46 -0800150 bionic/posix_fallocate.cpp \
Elliott Hughes4b558f52014-03-04 15:58:02 -0800151 bionic/posix_timers.cpp \
Elliott Hughesc3f11402013-10-30 14:40:09 -0700152 bionic/pthread_atfork.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000153 bionic/pthread_attr.cpp \
Elliott Hughesc3f11402013-10-30 14:40:09 -0700154 bionic/pthread_cond.cpp \
155 bionic/pthread_create.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800156 bionic/pthread_detach.cpp \
157 bionic/pthread_equal.cpp \
Elliott Hughesc3f11402013-10-30 14:40:09 -0700158 bionic/pthread_exit.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800159 bionic/pthread_getcpuclockid.cpp \
160 bionic/pthread_getschedparam.cpp \
Elliott Hughes27efc482014-09-11 16:11:43 -0700161 bionic/pthread_gettid_np.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800162 bionic/pthread_internals.cpp \
163 bionic/pthread_join.cpp \
Elliott Hughesc3f11402013-10-30 14:40:09 -0700164 bionic/pthread_key.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800165 bionic/pthread_kill.cpp \
Elliott Hughesc3f11402013-10-30 14:40:09 -0700166 bionic/pthread_mutex.cpp \
167 bionic/pthread_once.cpp \
168 bionic/pthread_rwlock.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800169 bionic/pthread_self.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000170 bionic/pthread_setname_np.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800171 bionic/pthread_setschedparam.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800172 bionic/pthread_sigmask.cpp \
Elliott Hughesc3f11402013-10-30 14:40:09 -0700173 bionic/ptrace.cpp \
Elliott Hughes2ea0a582014-07-25 17:24:00 -0700174 bionic/pty.cpp \
Chris Dearmand8a5a6f2012-12-07 18:41:10 -0800175 bionic/raise.cpp \
Elliott Hughes99ae0982014-07-14 11:57:03 -0700176 bionic/rand.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700177 bionic/readlink.cpp \
Elliott Hughesa38cb082014-02-17 12:33:16 -0800178 bionic/reboot.cpp \
Elliott Hughes247dc912014-03-10 17:17:01 -0700179 bionic/recv.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700180 bionic/rename.cpp \
181 bionic/rmdir.cpp \
Elliott Hughes701bec22013-02-25 13:14:31 -0800182 bionic/scandir.cpp \
Kito Cheng4ca685e2013-04-10 00:57:42 +0800183 bionic/sched_getaffinity.cpp \
Elliott Hughes887e1142014-01-02 12:05:50 -0800184 bionic/sched_getcpu.cpp \
Elliott Hughes247dc912014-03-10 17:17:01 -0700185 bionic/send.cpp \
Elliott Hughes232163c2013-10-09 17:35:36 -0700186 bionic/setegid.cpp \
Elliott Hughes4a9e8372012-11-30 11:58:57 -0800187 bionic/__set_errno.cpp \
Elliott Hughes232163c2013-10-09 17:35:36 -0700188 bionic/seteuid.cpp \
Elliott Hughes5a817382014-03-12 16:12:57 -0700189 bionic/setpgrp.cpp \
Elliott Hughesc7e9b232013-10-16 22:27:54 -0700190 bionic/sigaction.cpp \
191 bionic/sigaddset.cpp \
192 bionic/sigdelset.cpp \
193 bionic/sigemptyset.cpp \
194 bionic/sigfillset.cpp \
195 bionic/sigismember.cpp \
196 bionic/signal.cpp \
Elliott Hughesaa0ebda2014-02-11 19:57:06 -0800197 bionic/signalfd.cpp \
Elliott Hughes40d105c2013-10-16 12:53:58 -0700198 bionic/sigpending.cpp \
Elliott Hughes19e62322013-10-15 11:23:57 -0700199 bionic/sigprocmask.cpp \
Elliott Hughes1f5af922013-10-15 18:01:56 -0700200 bionic/sigsuspend.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800201 bionic/sigwait.cpp \
Sreeram Ramachandran903b7882014-05-19 13:39:57 -0700202 bionic/socket.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700203 bionic/stat.cpp \
Elliott Hughes06040fd2013-07-09 13:25:03 -0700204 bionic/statvfs.cpp \
Dan Albertdfb5ce42014-07-09 22:51:34 +0000205 bionic/strcoll_l.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700206 bionic/strerror.cpp \
207 bionic/strerror_r.cpp \
Dan Albertdfb5ce42014-07-09 22:51:34 +0000208 bionic/strftime_l.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700209 bionic/strsignal.cpp \
Elliott Hughes5a817382014-03-12 16:12:57 -0700210 bionic/strtold.cpp \
Dan Albertdfb5ce42014-07-09 22:51:34 +0000211 bionic/strtold_l.cpp \
212 bionic/strtoll_l.cpp \
213 bionic/strtoull_l.cpp \
214 bionic/strxfrm_l.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700215 bionic/stubs.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700216 bionic/symlink.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800217 bionic/sysconf.cpp \
Elliott Hughesb7661362014-07-21 16:35:24 -0700218 bionic/syslog.cpp \
Elliott Hughesaa0ebda2014-02-11 19:57:06 -0800219 bionic/sys_siglist.c \
220 bionic/sys_signame.c \
Elliott Hughes5a817382014-03-12 16:12:57 -0700221 bionic/system_properties.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700222 bionic/tdestroy.cpp \
Elliott Hughes8d4b5842014-03-11 16:06:23 -0700223 bionic/termios.cpp \
Elliott Hughes0468feb2014-06-20 22:49:20 -0700224 bionic/thread_private.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700225 bionic/tmpfile.cpp \
Elliott Hughes247dc912014-03-10 17:17:01 -0700226 bionic/umount.cpp \
Elliott Hughesf8fcfbc2013-10-22 13:28:46 -0700227 bionic/unlink.cpp \
228 bionic/utimes.cpp \
Elliott Hughes30021312014-07-15 16:53:13 -0700229 bionic/vdso.cpp \
Elliott Hughes17a8b0d2013-03-21 15:43:53 -0700230 bionic/wait.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700231 bionic/wchar.cpp \
Elliott Hughes5a0aa3d2014-04-30 22:03:12 -0700232 bionic/wctype.cpp \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700233
Dan Albert6df7b602014-08-15 14:20:04 -0700234libc_cxa_src_files := \
235 bionic/__cxa_guard.cpp \
236 bionic/__cxa_pure_virtual.cpp \
237 bionic/new.cpp \
238
Elliott Hughesf0777842013-03-01 16:59:46 -0800239libc_upstream_freebsd_src_files := \
Elliott Hughes57a88362014-03-10 16:23:09 -0700240 upstream-freebsd/lib/libc/gen/ldexp.c \
Elliott Hughesab61eb32013-11-20 16:09:06 -0800241 upstream-freebsd/lib/libc/gen/sleep.c \
242 upstream-freebsd/lib/libc/gen/usleep.c \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700243 upstream-freebsd/lib/libc/stdio/fclose.c \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700244 upstream-freebsd/lib/libc/stdio/flags.c \
245 upstream-freebsd/lib/libc/stdio/fopen.c \
Elliott Hughesaec2ffb2013-08-12 12:07:05 -0700246 upstream-freebsd/lib/libc/stdlib/abs.c \
Elliott Hughesd278b822013-06-25 14:48:10 -0700247 upstream-freebsd/lib/libc/stdlib/getopt_long.c \
Elliott Hughesaec2ffb2013-08-12 12:07:05 -0700248 upstream-freebsd/lib/libc/stdlib/imaxabs.c \
249 upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
250 upstream-freebsd/lib/libc/stdlib/labs.c \
251 upstream-freebsd/lib/libc/stdlib/llabs.c \
Elliott Hughes0b25f632013-04-11 18:08:34 -0700252 upstream-freebsd/lib/libc/stdlib/qsort.c \
Dan Albertb8425c52014-04-29 17:49:06 -0700253 upstream-freebsd/lib/libc/stdlib/quick_exit.c \
Elliott Hughesf0777842013-03-01 16:59:46 -0800254 upstream-freebsd/lib/libc/stdlib/realpath.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800255 upstream-freebsd/lib/libc/string/wcpcpy.c \
256 upstream-freebsd/lib/libc/string/wcpncpy.c \
257 upstream-freebsd/lib/libc/string/wcscasecmp.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800258 upstream-freebsd/lib/libc/string/wcscspn.c \
259 upstream-freebsd/lib/libc/string/wcsdup.c \
260 upstream-freebsd/lib/libc/string/wcslcat.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800261 upstream-freebsd/lib/libc/string/wcsncasecmp.c \
262 upstream-freebsd/lib/libc/string/wcsncat.c \
263 upstream-freebsd/lib/libc/string/wcsncmp.c \
264 upstream-freebsd/lib/libc/string/wcsncpy.c \
265 upstream-freebsd/lib/libc/string/wcsnlen.c \
266 upstream-freebsd/lib/libc/string/wcspbrk.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800267 upstream-freebsd/lib/libc/string/wcsspn.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800268 upstream-freebsd/lib/libc/string/wcstok.c \
269 upstream-freebsd/lib/libc/string/wmemchr.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800270 upstream-freebsd/lib/libc/string/wmemcpy.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800271 upstream-freebsd/lib/libc/string/wmemset.c \
Elliott Hughesf0777842013-03-01 16:59:46 -0800272
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700273libc_upstream_netbsd_src_files := \
Elliott Hughesa0beeea2014-06-12 11:48:04 -0700274 upstream-netbsd/common/lib/libc/stdlib/random.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800275 upstream-netbsd/lib/libc/gen/ftw.c \
276 upstream-netbsd/lib/libc/gen/nftw.c \
277 upstream-netbsd/lib/libc/gen/nice.c \
278 upstream-netbsd/lib/libc/gen/popen.c \
279 upstream-netbsd/lib/libc/gen/psignal.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800280 upstream-netbsd/lib/libc/gen/utime.c \
Elliott Hughes19f58ef2014-03-10 16:32:35 -0700281 upstream-netbsd/lib/libc/gen/utmp.c \
Elliott Hughesa210cae2014-06-30 12:03:43 -0700282 upstream-netbsd/lib/libc/inet/nsap_addr.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800283 upstream-netbsd/lib/libc/regex/regcomp.c \
284 upstream-netbsd/lib/libc/regex/regerror.c \
285 upstream-netbsd/lib/libc/regex/regexec.c \
286 upstream-netbsd/lib/libc/regex/regfree.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800287 upstream-netbsd/lib/libc/stdlib/bsearch.c \
288 upstream-netbsd/lib/libc/stdlib/div.c \
289 upstream-netbsd/lib/libc/stdlib/drand48.c \
290 upstream-netbsd/lib/libc/stdlib/erand48.c \
Elliott Hughesb9026412014-07-23 16:02:26 -0700291 upstream-netbsd/lib/libc/stdlib/insque.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800292 upstream-netbsd/lib/libc/stdlib/jrand48.c \
293 upstream-netbsd/lib/libc/stdlib/ldiv.c \
294 upstream-netbsd/lib/libc/stdlib/lldiv.c \
295 upstream-netbsd/lib/libc/stdlib/lrand48.c \
296 upstream-netbsd/lib/libc/stdlib/mrand48.c \
297 upstream-netbsd/lib/libc/stdlib/nrand48.c \
298 upstream-netbsd/lib/libc/stdlib/_rand48.c \
Elliott Hughesa0beeea2014-06-12 11:48:04 -0700299 upstream-netbsd/lib/libc/stdlib/rand_r.c \
Elliott Hughesb9026412014-07-23 16:02:26 -0700300 upstream-netbsd/lib/libc/stdlib/remque.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800301 upstream-netbsd/lib/libc/stdlib/seed48.c \
302 upstream-netbsd/lib/libc/stdlib/srand48.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800303 upstream-netbsd/lib/libc/string/memccpy.c \
304 upstream-netbsd/lib/libc/string/strcasestr.c \
305 upstream-netbsd/lib/libc/string/strcoll.c \
306 upstream-netbsd/lib/libc/string/strxfrm.c \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800307 upstream-netbsd/lib/libc/unistd/killpg.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700308
Elliott Hughes4bd97ce2014-04-10 17:48:14 -0700309libc_upstream_openbsd_gdtoa_src_files := \
Elliott Hughesd39f3f22014-04-21 17:13:46 -0700310 upstream-openbsd/android/gdtoa_support.cpp \
Elliott Hughes4bd97ce2014-04-10 17:48:14 -0700311 upstream-openbsd/lib/libc/gdtoa/dmisc.c \
312 upstream-openbsd/lib/libc/gdtoa/dtoa.c \
313 upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
314 upstream-openbsd/lib/libc/gdtoa/gethex.c \
315 upstream-openbsd/lib/libc/gdtoa/gmisc.c \
316 upstream-openbsd/lib/libc/gdtoa/hd_init.c \
317 upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
318 upstream-openbsd/lib/libc/gdtoa/hexnan.c \
319 upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
320 upstream-openbsd/lib/libc/gdtoa/misc.c \
321 upstream-openbsd/lib/libc/gdtoa/smisc.c \
322 upstream-openbsd/lib/libc/gdtoa/strtod.c \
323 upstream-openbsd/lib/libc/gdtoa/strtodg.c \
324 upstream-openbsd/lib/libc/gdtoa/strtof.c \
325 upstream-openbsd/lib/libc/gdtoa/strtord.c \
326 upstream-openbsd/lib/libc/gdtoa/sum.c \
327 upstream-openbsd/lib/libc/gdtoa/ulp.c \
328
329libc_upstream_openbsd_gdtoa_src_files_32 := \
330 $(libc_upstream_openbsd_gdtoa_src_files) \
331
332libc_upstream_openbsd_gdtoa_src_files_64 := \
333 $(libc_upstream_openbsd_gdtoa_src_files) \
334 upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
335
Elliott Hughes53e43292014-02-24 18:00:43 -0800336libc_upstream_openbsd_src_files := \
Elliott Hughes6209c812014-07-18 15:57:41 -0700337 upstream-openbsd/lib/libc/crypt/arc4random.c \
338 upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
Elliott Hughesaedb00d2014-03-03 14:38:20 -0800339 upstream-openbsd/lib/libc/gen/alarm.c \
Elliott Hughesf3c73902014-04-18 10:29:16 -0700340 upstream-openbsd/lib/libc/gen/ctype_.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800341 upstream-openbsd/lib/libc/gen/exec.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800342 upstream-openbsd/lib/libc/gen/fnmatch.c \
Elliott Hughes692207e2014-02-28 16:23:27 -0800343 upstream-openbsd/lib/libc/gen/ftok.c \
344 upstream-openbsd/lib/libc/gen/getprogname.c \
Elliott Hughesf3c73902014-04-18 10:29:16 -0700345 upstream-openbsd/lib/libc/gen/isctype.c \
Elliott Hughes692207e2014-02-28 16:23:27 -0800346 upstream-openbsd/lib/libc/gen/setprogname.c \
Elliott Hughescccfe1e2014-03-11 13:37:11 -0700347 upstream-openbsd/lib/libc/gen/time.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800348 upstream-openbsd/lib/libc/gen/tolower_.c \
Elliott Hughes692207e2014-02-28 16:23:27 -0800349 upstream-openbsd/lib/libc/gen/toupper_.c \
Elliott Hughes3d7a0d92014-04-29 14:46:56 -0700350 upstream-openbsd/lib/libc/locale/btowc.c \
351 upstream-openbsd/lib/libc/locale/mbrlen.c \
352 upstream-openbsd/lib/libc/locale/mbstowcs.c \
Elliott Hughes0a5e26d2014-04-28 17:51:13 -0700353 upstream-openbsd/lib/libc/locale/mbtowc.c \
Elliott Hughesc8937ea2014-03-10 16:11:59 -0700354 upstream-openbsd/lib/libc/locale/wcscoll.c \
Elliott Hughes3d7a0d92014-04-29 14:46:56 -0700355 upstream-openbsd/lib/libc/locale/wcstod.c \
356 upstream-openbsd/lib/libc/locale/wcstof.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700357 upstream-openbsd/lib/libc/locale/wcstoimax.c \
Elliott Hughes3d7a0d92014-04-29 14:46:56 -0700358 upstream-openbsd/lib/libc/locale/wcstol.c \
359 upstream-openbsd/lib/libc/locale/wcstold.c \
360 upstream-openbsd/lib/libc/locale/wcstoll.c \
361 upstream-openbsd/lib/libc/locale/wcstombs.c \
362 upstream-openbsd/lib/libc/locale/wcstoul.c \
363 upstream-openbsd/lib/libc/locale/wcstoull.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700364 upstream-openbsd/lib/libc/locale/wcstoumax.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700365 upstream-openbsd/lib/libc/locale/wcsxfrm.c \
Elliott Hughes3d7a0d92014-04-29 14:46:56 -0700366 upstream-openbsd/lib/libc/locale/wctob.c \
Elliott Hughes5a0aa3d2014-04-30 22:03:12 -0700367 upstream-openbsd/lib/libc/locale/wctomb.c \
Elliott Hughes6a41b0f2014-05-13 16:05:51 -0700368 upstream-openbsd/lib/libc/net/htonl.c \
369 upstream-openbsd/lib/libc/net/htons.c \
370 upstream-openbsd/lib/libc/net/inet_addr.c \
371 upstream-openbsd/lib/libc/net/inet_lnaof.c \
372 upstream-openbsd/lib/libc/net/inet_makeaddr.c \
373 upstream-openbsd/lib/libc/net/inet_netof.c \
374 upstream-openbsd/lib/libc/net/inet_network.c \
375 upstream-openbsd/lib/libc/net/inet_ntoa.c \
Elliott Hughesf51d3e82014-05-19 15:55:29 -0700376 upstream-openbsd/lib/libc/net/inet_ntop.c \
Elliott Hughes6a41b0f2014-05-13 16:05:51 -0700377 upstream-openbsd/lib/libc/net/inet_pton.c \
378 upstream-openbsd/lib/libc/net/ntohl.c \
379 upstream-openbsd/lib/libc/net/ntohs.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700380 upstream-openbsd/lib/libc/stdio/asprintf.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800381 upstream-openbsd/lib/libc/stdio/clrerr.c \
Elliott Hughesfcac8ff2014-05-22 01:24:30 -0700382 upstream-openbsd/lib/libc/stdio/dprintf.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700383 upstream-openbsd/lib/libc/stdio/fdopen.c \
384 upstream-openbsd/lib/libc/stdio/feof.c \
385 upstream-openbsd/lib/libc/stdio/ferror.c \
386 upstream-openbsd/lib/libc/stdio/fflush.c \
387 upstream-openbsd/lib/libc/stdio/fgetc.c \
388 upstream-openbsd/lib/libc/stdio/fgetln.c \
389 upstream-openbsd/lib/libc/stdio/fgetpos.c \
390 upstream-openbsd/lib/libc/stdio/fgets.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700391 upstream-openbsd/lib/libc/stdio/fgetwc.c \
Elliott Hughesc9322252014-04-29 17:08:03 -0700392 upstream-openbsd/lib/libc/stdio/fgetws.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700393 upstream-openbsd/lib/libc/stdio/fileno.c \
394 upstream-openbsd/lib/libc/stdio/fprintf.c \
395 upstream-openbsd/lib/libc/stdio/fpurge.c \
396 upstream-openbsd/lib/libc/stdio/fputc.c \
397 upstream-openbsd/lib/libc/stdio/fputs.c \
Elliott Hughesc9322252014-04-29 17:08:03 -0700398 upstream-openbsd/lib/libc/stdio/fputwc.c \
399 upstream-openbsd/lib/libc/stdio/fputws.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700400 upstream-openbsd/lib/libc/stdio/freopen.c \
401 upstream-openbsd/lib/libc/stdio/fscanf.c \
402 upstream-openbsd/lib/libc/stdio/fseek.c \
403 upstream-openbsd/lib/libc/stdio/fsetpos.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800404 upstream-openbsd/lib/libc/stdio/ftell.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700405 upstream-openbsd/lib/libc/stdio/funopen.c \
Elliott Hughes9d3c2dd2014-04-18 13:13:04 -0700406 upstream-openbsd/lib/libc/stdio/fvwrite.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800407 upstream-openbsd/lib/libc/stdio/fwalk.c \
Elliott Hughesc9322252014-04-29 17:08:03 -0700408 upstream-openbsd/lib/libc/stdio/fwide.c \
Elliott Hughes94336d82014-04-29 17:39:29 -0700409 upstream-openbsd/lib/libc/stdio/fwprintf.c \
Elliott Hughes792ae722014-05-02 18:18:46 -0700410 upstream-openbsd/lib/libc/stdio/fwrite.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700411 upstream-openbsd/lib/libc/stdio/fwscanf.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700412 upstream-openbsd/lib/libc/stdio/getc.c \
413 upstream-openbsd/lib/libc/stdio/getchar.c \
414 upstream-openbsd/lib/libc/stdio/getdelim.c \
415 upstream-openbsd/lib/libc/stdio/getline.c \
416 upstream-openbsd/lib/libc/stdio/gets.c \
Elliott Hughesc9322252014-04-29 17:08:03 -0700417 upstream-openbsd/lib/libc/stdio/getwc.c \
418 upstream-openbsd/lib/libc/stdio/getwchar.c \
Dmitriy Ivanov623b0d02014-05-14 23:11:05 -0700419 upstream-openbsd/lib/libc/stdio/makebuf.c \
Elliott Hughes65935972014-07-02 11:22:26 -0700420 upstream-openbsd/lib/libc/stdio/mktemp.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700421 upstream-openbsd/lib/libc/stdio/perror.c \
422 upstream-openbsd/lib/libc/stdio/printf.c \
423 upstream-openbsd/lib/libc/stdio/putc.c \
424 upstream-openbsd/lib/libc/stdio/putchar.c \
425 upstream-openbsd/lib/libc/stdio/puts.c \
Elliott Hughesc9322252014-04-29 17:08:03 -0700426 upstream-openbsd/lib/libc/stdio/putwc.c \
427 upstream-openbsd/lib/libc/stdio/putwchar.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700428 upstream-openbsd/lib/libc/stdio/refill.c \
429 upstream-openbsd/lib/libc/stdio/remove.c \
430 upstream-openbsd/lib/libc/stdio/rewind.c \
431 upstream-openbsd/lib/libc/stdio/rget.c \
432 upstream-openbsd/lib/libc/stdio/scanf.c \
433 upstream-openbsd/lib/libc/stdio/setbuf.c \
434 upstream-openbsd/lib/libc/stdio/setbuffer.c \
Dmitriy Ivanov623b0d02014-05-14 23:11:05 -0700435 upstream-openbsd/lib/libc/stdio/setvbuf.c \
Elliott Hughes603332f2014-03-12 17:10:41 -0700436 upstream-openbsd/lib/libc/stdio/sscanf.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700437 upstream-openbsd/lib/libc/stdio/stdio.c \
Elliott Hughes94336d82014-04-29 17:39:29 -0700438 upstream-openbsd/lib/libc/stdio/swprintf.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700439 upstream-openbsd/lib/libc/stdio/swscanf.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700440 upstream-openbsd/lib/libc/stdio/tempnam.c \
441 upstream-openbsd/lib/libc/stdio/tmpnam.c \
442 upstream-openbsd/lib/libc/stdio/ungetc.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700443 upstream-openbsd/lib/libc/stdio/ungetwc.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700444 upstream-openbsd/lib/libc/stdio/vasprintf.c \
Elliott Hughesfcac8ff2014-05-22 01:24:30 -0700445 upstream-openbsd/lib/libc/stdio/vdprintf.c \
Elliott Hughes05493712014-04-17 17:30:03 -0700446 upstream-openbsd/lib/libc/stdio/vfprintf.c \
Elliott Hughes603332f2014-03-12 17:10:41 -0700447 upstream-openbsd/lib/libc/stdio/vfscanf.c \
Elliott Hughes94336d82014-04-29 17:39:29 -0700448 upstream-openbsd/lib/libc/stdio/vfwprintf.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700449 upstream-openbsd/lib/libc/stdio/vfwscanf.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700450 upstream-openbsd/lib/libc/stdio/vprintf.c \
451 upstream-openbsd/lib/libc/stdio/vscanf.c \
452 upstream-openbsd/lib/libc/stdio/vsnprintf.c \
453 upstream-openbsd/lib/libc/stdio/vsprintf.c \
Elliott Hughes603332f2014-03-12 17:10:41 -0700454 upstream-openbsd/lib/libc/stdio/vsscanf.c \
Elliott Hughes94336d82014-04-29 17:39:29 -0700455 upstream-openbsd/lib/libc/stdio/vswprintf.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700456 upstream-openbsd/lib/libc/stdio/vswscanf.c \
Elliott Hughes94336d82014-04-29 17:39:29 -0700457 upstream-openbsd/lib/libc/stdio/vwprintf.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700458 upstream-openbsd/lib/libc/stdio/vwscanf.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700459 upstream-openbsd/lib/libc/stdio/wbuf.c \
Elliott Hughes94336d82014-04-29 17:39:29 -0700460 upstream-openbsd/lib/libc/stdio/wprintf.c \
Elliott Hughes01ae00f2014-04-29 16:28:56 -0700461 upstream-openbsd/lib/libc/stdio/wscanf.c \
Elliott Hughes53b24382014-05-02 18:29:25 -0700462 upstream-openbsd/lib/libc/stdio/wsetup.c \
Dmitriy Ivanov38778e32014-07-11 12:59:16 -0700463 upstream-openbsd/lib/libc/stdlib/atexit.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700464 upstream-openbsd/lib/libc/stdlib/atoi.c \
465 upstream-openbsd/lib/libc/stdlib/atol.c \
466 upstream-openbsd/lib/libc/stdlib/atoll.c \
Dmitriy Ivanov623b0d02014-05-14 23:11:05 -0700467 upstream-openbsd/lib/libc/stdlib/exit.c \
Elliott Hughes58d9e282014-04-22 17:41:00 -0700468 upstream-openbsd/lib/libc/stdlib/getenv.c \
Elliott Hughesb9026412014-07-23 16:02:26 -0700469 upstream-openbsd/lib/libc/stdlib/lsearch.c \
Elliott Hughes58d9e282014-04-22 17:41:00 -0700470 upstream-openbsd/lib/libc/stdlib/setenv.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700471 upstream-openbsd/lib/libc/stdlib/strtoimax.c \
472 upstream-openbsd/lib/libc/stdlib/strtol.c \
473 upstream-openbsd/lib/libc/stdlib/strtoll.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800474 upstream-openbsd/lib/libc/stdlib/strtoul.c \
475 upstream-openbsd/lib/libc/stdlib/strtoull.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800476 upstream-openbsd/lib/libc/stdlib/strtoumax.c \
Elliott Hughes1e4378e2014-02-25 15:19:26 -0800477 upstream-openbsd/lib/libc/stdlib/system.c \
Elliott Hughesb9026412014-07-23 16:02:26 -0700478 upstream-openbsd/lib/libc/stdlib/tfind.c \
479 upstream-openbsd/lib/libc/stdlib/tsearch.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700480 upstream-openbsd/lib/libc/string/strcasecmp.c \
481 upstream-openbsd/lib/libc/string/strcspn.c \
482 upstream-openbsd/lib/libc/string/strdup.c \
483 upstream-openbsd/lib/libc/string/strndup.c \
484 upstream-openbsd/lib/libc/string/strpbrk.c \
485 upstream-openbsd/lib/libc/string/strsep.c \
486 upstream-openbsd/lib/libc/string/strspn.c \
487 upstream-openbsd/lib/libc/string/strstr.c \
488 upstream-openbsd/lib/libc/string/strtok.c \
489 upstream-openbsd/lib/libc/string/wcslcpy.c \
Elliott Hughesd299bcf2014-04-28 16:28:51 -0700490 upstream-openbsd/lib/libc/string/wcsstr.c \
Elliott Hughesad41e9a2014-03-11 15:05:50 -0700491 upstream-openbsd/lib/libc/string/wcswidth.c \
Elliott Hughes53e43292014-02-24 18:00:43 -0800492
Ying Wangf25d6772014-01-23 15:17:50 -0800493libc_arch_static_src_files := \
494 bionic/dl_iterate_phdr_static.cpp \
Christopher Ferris7c83a1e2013-02-26 01:30:00 -0800495
Dima Zavinca122b02009-05-27 10:52:37 -0700496# Define some common cflags
497# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800498libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700499 -D_LIBC=1 \
Elliott Hughesd2867962014-06-03 15:22:34 -0700500 -Wall -Wextra -Wunused \
Elliott Hughes2ec400b2013-10-08 17:04:33 -0700501
Christopher Ferrisdda1c6c2014-07-09 17:16:07 -0700502ifneq ($(TARGET_USES_LOGD),false)
503libc_common_cflags += -DTARGET_USES_LOGD
504endif
505
Chih-Hung Hsieh81fe2b12014-09-04 15:19:52 -0700506use_clang := $(USE_CLANG_PLATFORM_BUILD)
507ifeq ($(use_clang),)
508 use_clang := false
509endif
Elliott Hughesc999f762014-07-10 16:57:27 -0700510
Elliott Hughes2ec400b2013-10-08 17:04:33 -0700511# Try to catch typical 32-bit assumptions that break with 64-bit pointers.
512libc_common_cflags += \
513 -Werror=pointer-to-int-cast \
514 -Werror=int-to-pointer-cast \
515 -Werror=type-limits \
Elliott Hughes65935972014-07-02 11:22:26 -0700516 -Werror \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800517
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700518ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800519 libc_common_cflags += -DDEBUG
520endif
521
Christopher Ferris8e32b7b2014-07-10 18:53:41 -0700522ifeq ($(MALLOC_IMPL),dlmalloc)
Christopher Ferris72bbd422014-05-08 11:14:03 -0700523 libc_common_cflags += -DUSE_DLMALLOC
Christopher Ferris8d2410d2014-05-21 11:45:51 -0700524 libc_malloc_src := bionic/dlmalloc.c
Christopher Ferris8e32b7b2014-07-10 18:53:41 -0700525else
526 libc_common_cflags += -DUSE_JEMALLOC
527 libc_malloc_src := bionic/jemalloc_wrapper.cpp
528 libc_common_c_includes += external/jemalloc/include
Christopher Ferris72bbd422014-05-08 11:14:03 -0700529endif
530
Jack Ren2fd81ef2011-11-19 09:48:03 +0800531# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
532# the appropriate BoardConfig.mk file.
533#
534ifneq ($(BOARD_MALLOC_ALIGNMENT),)
535 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
536endif
537
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700538# Define ANDROID_SMP appropriately.
539ifeq ($(TARGET_CPU_SMP),true)
540 libc_common_cflags += -DANDROID_SMP=1
541else
542 libc_common_cflags += -DANDROID_SMP=0
543endif
544
Stephen Hines762cea42013-09-30 17:10:53 -0700545# Define some common conlyflags
546libc_common_conlyflags := \
547 -std=gnu99
548
549# Define some common cppflags
550libc_common_cppflags := \
551 -std=gnu++11
552
Dima Zavinca122b02009-05-27 10:52:37 -0700553# Define some common includes
554# ========================================================
Christopher Ferris8e32b7b2014-07-10 18:53:41 -0700555libc_common_c_includes += \
Ying Wang76c8b882014-02-12 16:40:55 -0800556 $(LOCAL_PATH)/stdio \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800557
Ying Wangf25d6772014-01-23 15:17:50 -0800558# ========================================================
559# Add in the arch-specific flags.
560# Must be called with $(eval).
561# $(1): the LOCAL_ variable name
562# $(2): the bionic variable name to pull in
563define patch-up-arch-specific-flags
564$(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
565ifdef TARGET_2ND_ARCH
566$(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200567endif
Ying Wangf25d6772014-01-23 15:17:50 -0800568endef
Michael Hopeea8fad12012-07-31 16:18:22 +1200569
Dima Zavinca122b02009-05-27 10:52:37 -0700570
571# ========================================================
Elliott Hughes6380b512014-03-10 16:15:11 -0700572# libc_stack_protector.a - stack protector code
Nick Kralevich6334c662012-07-10 10:46:19 -0700573# ========================================================
574#
575# The stack protector code needs to be compiled
576# with -fno-stack-protector, since it modifies the
577# stack canary.
578
579include $(CLEAR_VARS)
580
Elliott Hughes642331b2013-03-06 15:03:53 -0800581LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
Elliott Hughes65935972014-07-02 11:22:26 -0700582LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
Stephen Hines762cea42013-09-30 17:10:53 -0700583LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
584LOCAL_CPPFLAGS := $(libc_common_cppflags)
Nick Kralevich6334c662012-07-10 10:46:19 -0700585LOCAL_C_INCLUDES := $(libc_common_c_includes)
Elliott Hughes6380b512014-03-10 16:15:11 -0700586LOCAL_MODULE := libc_stack_protector
Elliott Hughesc999f762014-07-10 16:57:27 -0700587LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -0700588LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Nick Kralevich6334c662012-07-10 10:46:19 -0700589LOCAL_SYSTEM_SHARED_LIBRARIES :=
590
Ying Wangf25d6772014-01-23 15:17:50 -0800591$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Nick Kralevich6334c662012-07-10 10:46:19 -0700592include $(BUILD_STATIC_LIBRARY)
593
594
595# ========================================================
Elliott Hughesce4783c2013-07-12 17:31:11 -0700596# libc_tzcode.a - upstream 'tzcode' code
597# ========================================================
598
599include $(CLEAR_VARS)
600
Elliott Hughes1fbe6212014-02-20 11:28:20 -0800601LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
Elliott Hughesefaa4612014-05-02 15:53:03 -0700602# tzcode doesn't include wcsftime, so we use the OpenBSD one.
603LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
Elliott Hughes329103d2014-04-25 16:55:04 -0700604
Elliott Hughesd10db822014-06-19 14:49:30 -0700605LOCAL_CFLAGS := $(libc_common_cflags) \
606 -fvisibility=hidden \
Elliott Hughesd10db822014-06-19 14:49:30 -0700607
Elliott Hughes329103d2014-04-25 16:55:04 -0700608# Don't use ridiculous amounts of stack.
609LOCAL_CFLAGS += -DALL_STATE
610# Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
611LOCAL_CFLAGS += -DSTD_INSPIRED
612# The name of the tm_gmtoff field in our struct tm.
613LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
614# Where we store our tzdata.
615LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
616# Include timezone and daylight globals.
617LOCAL_CFLAGS += -DUSG_COMPAT=1
Elliott Hughes9a5a3e82014-05-05 20:28:28 -0700618LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
Elliott Hughesd10db822014-06-19 14:49:30 -0700619LOCAL_CFLAGS += -Dlint
Elliott Hughes329103d2014-04-25 16:55:04 -0700620
Stephen Hines762cea42013-09-30 17:10:53 -0700621LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
622LOCAL_CPPFLAGS := $(libc_common_cppflags)
Elliott Hughesefaa4612014-05-02 15:53:03 -0700623LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
Elliott Hughesce4783c2013-07-12 17:31:11 -0700624LOCAL_MODULE := libc_tzcode
Elliott Hughesc999f762014-07-10 16:57:27 -0700625LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -0700626LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Elliott Hughesce4783c2013-07-12 17:31:11 -0700627LOCAL_SYSTEM_SHARED_LIBRARIES :=
628
Ying Wangf25d6772014-01-23 15:17:50 -0800629$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Elliott Hughesce4783c2013-07-12 17:31:11 -0700630include $(BUILD_STATIC_LIBRARY)
631
632
633# ========================================================
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700634# libc_dns.a - modified NetBSD DNS code
635# ========================================================
636
637include $(CLEAR_VARS)
638
Elliott Hughes85638022014-05-16 12:04:10 -0700639LOCAL_SRC_FILES := \
640 $(call all-c-files-under,dns) \
641 upstream-netbsd/lib/libc/isc/ev_streams.c \
642 upstream-netbsd/lib/libc/isc/ev_timers.c \
Dan Albert9f533972014-08-14 15:43:25 -0700643 upstream-netbsd/lib/libc/resolv/mtctxres.c \
Elliott Hughes85638022014-05-16 12:04:10 -0700644
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700645LOCAL_CFLAGS := \
646 $(libc_common_cflags) \
Elliott Hughes205c7882014-03-13 16:17:43 -0700647 -DANDROID_CHANGES \
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700648 -DINET6 \
Elliott Hughes85638022014-05-16 12:04:10 -0700649 -fvisibility=hidden \
Elliott Hughes65935972014-07-02 11:22:26 -0700650 -Wno-unused-parameter \
Calin Juravlececc0362014-03-03 11:44:48 +0000651 -I$(LOCAL_PATH)/dns/include \
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700652 -I$(LOCAL_PATH)/private \
Calin Juravlefcb502e2014-03-05 15:06:52 +0000653 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
Elliott Hughes85638022014-05-16 12:04:10 -0700654 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
655 -include netbsd-compat.h \
Elliott Hughes4c2da032014-05-16 16:50:34 -0700656
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700657LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
658LOCAL_CPPFLAGS := $(libc_common_cppflags)
659LOCAL_C_INCLUDES := $(libc_common_c_includes)
660LOCAL_MODULE := libc_dns
Elliott Hughesc999f762014-07-10 16:57:27 -0700661LOCAL_CLANG := $(use_clang)
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700662LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
663LOCAL_SYSTEM_SHARED_LIBRARIES :=
664
Ying Wangf25d6772014-01-23 15:17:50 -0800665$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700666include $(BUILD_STATIC_LIBRARY)
667
668
669# ========================================================
Elliott Hughesf0777842013-03-01 16:59:46 -0800670# libc_freebsd.a - upstream FreeBSD C library code
671# ========================================================
672#
673# These files are built with the freebsd-compat.h header file
674# automatically included.
675
676include $(CLEAR_VARS)
677
678LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
679LOCAL_CFLAGS := \
680 $(libc_common_cflags) \
Elliott Hughes9a5a3e82014-05-05 20:28:28 -0700681 -Wno-sign-compare -Wno-uninitialized \
Elliott Hughesd39f3f22014-04-21 17:13:46 -0700682 -I$(LOCAL_PATH)/upstream-freebsd/android/include \
Elliott Hughes02c78a32014-04-11 17:02:20 -0700683 -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
Elliott Hughes4c2da032014-05-16 16:50:34 -0700684 -include freebsd-compat.h \
Elliott Hughes4c2da032014-05-16 16:50:34 -0700685
Stephen Hines762cea42013-09-30 17:10:53 -0700686LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
687LOCAL_CPPFLAGS := $(libc_common_cppflags)
Elliott Hughesf0777842013-03-01 16:59:46 -0800688LOCAL_C_INCLUDES := $(libc_common_c_includes)
689LOCAL_MODULE := libc_freebsd
Elliott Hughesc999f762014-07-10 16:57:27 -0700690LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -0700691LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Elliott Hughesf0777842013-03-01 16:59:46 -0800692LOCAL_SYSTEM_SHARED_LIBRARIES :=
693
Ying Wangf25d6772014-01-23 15:17:50 -0800694$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Elliott Hughes86d16a02014-09-16 19:06:31 -0700695$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_freebsd_src_files))
Elliott Hughesf0777842013-03-01 16:59:46 -0800696include $(BUILD_STATIC_LIBRARY)
697
698
699# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700700# libc_netbsd.a - upstream NetBSD C library code
701# ========================================================
702#
703# These files are built with the netbsd-compat.h header file
704# automatically included.
705
706include $(CLEAR_VARS)
707
708LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
709LOCAL_CFLAGS := \
710 $(libc_common_cflags) \
Elliott Hughes9a5a3e82014-05-05 20:28:28 -0700711 -Wno-sign-compare -Wno-uninitialized \
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700712 -DPOSIX_MISTAKE \
Elliott Hughesd39f3f22014-04-21 17:13:46 -0700713 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
Elliott Hughes677b6e62014-02-20 14:15:09 -0800714 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
Elliott Hughes4c2da032014-05-16 16:50:34 -0700715 -include netbsd-compat.h \
716
Stephen Hines762cea42013-09-30 17:10:53 -0700717LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
718LOCAL_CPPFLAGS := $(libc_common_cppflags)
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700719LOCAL_C_INCLUDES := $(libc_common_c_includes)
720LOCAL_MODULE := libc_netbsd
Elliott Hughesc999f762014-07-10 16:57:27 -0700721LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -0700722LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700723LOCAL_SYSTEM_SHARED_LIBRARIES :=
724
Ying Wangf25d6772014-01-23 15:17:50 -0800725$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Dan Albertc82c0b72014-06-16 16:52:27 -0700726$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700727include $(BUILD_STATIC_LIBRARY)
728
729
730# ========================================================
Elliott Hughes01339442014-02-20 18:04:58 -0800731# libc_openbsd.a - upstream OpenBSD C library code
732# ========================================================
733#
734# These files are built with the openbsd-compat.h header file
735# automatically included.
736
737include $(CLEAR_VARS)
738
Elliott Hughes53e43292014-02-24 18:00:43 -0800739LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
Chih-Hung Hsieh81fe2b12014-09-04 15:19:52 -0700740ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
741 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
742 LOCAL_CLANG := false
743else
744 LOCAL_CLANG := $(use_clang)
745endif
746
Elliott Hughes01339442014-02-20 18:04:58 -0800747LOCAL_CFLAGS := \
748 $(libc_common_cflags) \
Elliott Hughesd2867962014-06-03 15:22:34 -0700749 -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
Dmitriy Ivanov38778e32014-07-11 12:59:16 -0700750 -I$(LOCAL_PATH)/private \
Elliott Hughesd39f3f22014-04-21 17:13:46 -0700751 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
Elliott Hughes01339442014-02-20 18:04:58 -0800752 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
Elliott Hughesf1ada792014-05-02 17:56:56 -0700753 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
Elliott Hughes4c2da032014-05-16 16:50:34 -0700754 -include openbsd-compat.h \
755
Elliott Hughes01339442014-02-20 18:04:58 -0800756LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
757LOCAL_CPPFLAGS := $(libc_common_cppflags)
758LOCAL_C_INCLUDES := $(libc_common_c_includes)
759LOCAL_MODULE := libc_openbsd
760LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
761LOCAL_SYSTEM_SHARED_LIBRARIES :=
762
763$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Elliott Hughes86d16a02014-09-16 19:06:31 -0700764$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
Elliott Hughes01339442014-02-20 18:04:58 -0800765include $(BUILD_STATIC_LIBRARY)
766
767
768# ========================================================
Elliott Hughes4bd97ce2014-04-10 17:48:14 -0700769# libc_gdtoa.a - upstream OpenBSD C library gdtoa code
770# ========================================================
771#
772# These files are built with the openbsd-compat.h header file
773# automatically included.
774
775include $(CLEAR_VARS)
776
777LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
778LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
Chih-Hung Hsieh81fe2b12014-09-04 15:19:52 -0700779ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
780 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
781 LOCAL_CLANG := false
782else
783 LOCAL_CLANG := $(use_clang)
784endif
785
Elliott Hughes4bd97ce2014-04-10 17:48:14 -0700786LOCAL_CFLAGS := \
787 $(libc_common_cflags) \
Elliott Hughes9a5a3e82014-05-05 20:28:28 -0700788 -Wno-sign-compare -Wno-uninitialized \
Elliott Hughescce36c12014-04-22 12:32:49 -0700789 -fvisibility=hidden \
Dmitriy Ivanov38778e32014-07-11 12:59:16 -0700790 -I$(LOCAL_PATH)/private \
Elliott Hughesd39f3f22014-04-21 17:13:46 -0700791 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
Elliott Hughes4bd97ce2014-04-10 17:48:14 -0700792 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
Elliott Hughesd39f3f22014-04-21 17:13:46 -0700793 -include openbsd-compat.h \
Elliott Hughes4bd97ce2014-04-10 17:48:14 -0700794
795LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
796LOCAL_CPPFLAGS := $(libc_common_cppflags)
797LOCAL_C_INCLUDES := $(libc_common_c_includes)
798LOCAL_MODULE := libc_gdtoa
799LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
800LOCAL_SYSTEM_SHARED_LIBRARIES :=
801
802$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
803include $(BUILD_STATIC_LIBRARY)
804
805
806# ========================================================
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700807# libc_bionic.a - home-grown C library code
808# ========================================================
Elliott Hughese7c59f92013-12-17 20:47:06 -0800809
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700810include $(CLEAR_VARS)
811
812LOCAL_SRC_FILES := $(libc_bionic_src_files)
Elliott Hughesb6943182014-05-13 10:14:22 -0700813LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughesb6943182014-05-13 10:14:22 -0700814 -Wframe-larger-than=2048 \
815
Chih-Hung Hsieh81fe2b12014-09-04 15:19:52 -0700816ifeq ($(TARGET_ARCH),x86_64)
817 # Clang assembler has problem with ssse3-strcmp-slm.S, http://b/17302991
818 LOCAL_CLANG_ASFLAGS += -no-integrated-as
819endif
820
Stephen Hines762cea42013-09-30 17:10:53 -0700821LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
822LOCAL_CPPFLAGS := $(libc_common_cppflags)
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700823LOCAL_C_INCLUDES := $(libc_common_c_includes)
824LOCAL_MODULE := libc_bionic
Elliott Hughesc999f762014-07-10 16:57:27 -0700825LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -0700826LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700827LOCAL_SYSTEM_SHARED_LIBRARIES :=
828
Ying Wangf25d6772014-01-23 15:17:50 -0800829$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
830$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700831include $(BUILD_STATIC_LIBRARY)
832
833
834# ========================================================
Dan Albert6df7b602014-08-15 14:20:04 -0700835# libc_cxa.a - Things traditionally in libstdc++
836# ========================================================
837
838include $(CLEAR_VARS)
839
840LOCAL_SRC_FILES := $(libc_cxa_src_files)
841LOCAL_CFLAGS := $(libc_common_cflags) \
842 -fvisibility=hidden \
843
844LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
845LOCAL_CPPFLAGS := $(libc_common_cppflags)
846LOCAL_C_INCLUDES := $(libc_common_c_includes)
847LOCAL_MODULE := libc_cxa
848# GCC refuses to hide new/delete
849LOCAL_CLANG := true
850LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
851LOCAL_SYSTEM_SHARED_LIBRARIES :=
852
853include $(BUILD_STATIC_LIBRARY)
854
855
856# ========================================================
Elliott Hughesb3a23bd2014-02-11 13:32:02 -0800857# libc_syscalls.a
858# ========================================================
859
860include $(CLEAR_VARS)
861
Ying Wangf25d6772014-01-23 15:17:50 -0800862LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
863ifdef TARGET_2ND_ARCH
864LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
865endif
Elliott Hughesb3a23bd2014-02-11 13:32:02 -0800866LOCAL_MODULE := libc_syscalls
Elliott Hughesc999f762014-07-10 16:57:27 -0700867LOCAL_CLANG := $(use_clang)
Elliott Hughesb3a23bd2014-02-11 13:32:02 -0800868LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
869LOCAL_SYSTEM_SHARED_LIBRARIES :=
870
871include $(BUILD_STATIC_LIBRARY)
872
873
874# ========================================================
Elliott Hughesc999f762014-07-10 16:57:27 -0700875# libc_aeabi.a
876# This is an LP32 ARM-only library that needs to be built with -fno-builtin
877# to avoid infinite recursion. For the other architectures we just build an
878# empty library to keep this makefile simple.
879# ========================================================
880
881include $(CLEAR_VARS)
882
883LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
884LOCAL_MODULE := libc_aeabi
885LOCAL_CLANG := $(use_clang)
886LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
887LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
888LOCAL_SYSTEM_SHARED_LIBRARIES :=
889
890include $(BUILD_STATIC_LIBRARY)
891
892# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700893# libc_common.a
894# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700895
Dima Zavinca122b02009-05-27 10:52:37 -0700896include $(CLEAR_VARS)
897
898LOCAL_SRC_FILES := $(libc_common_src_files)
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700899LOCAL_CFLAGS := $(libc_common_cflags)
Stephen Hines762cea42013-09-30 17:10:53 -0700900LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
901LOCAL_CPPFLAGS := $(libc_common_cppflags)
Dima Zavinca122b02009-05-27 10:52:37 -0700902LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800903LOCAL_MODULE := libc_common
Elliott Hughesc999f762014-07-10 16:57:27 -0700904LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -0700905LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Elliott Hughesce4783c2013-07-12 17:31:11 -0700906LOCAL_WHOLE_STATIC_LIBRARIES := \
Elliott Hughesce4783c2013-07-12 17:31:11 -0700907 libc_bionic \
Dan Albert6df7b602014-08-15 14:20:04 -0700908 libc_cxa \
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700909 libc_dns \
Elliott Hughesce4783c2013-07-12 17:31:11 -0700910 libc_freebsd \
Elliott Hughes4bd97ce2014-04-10 17:48:14 -0700911 libc_gdtoa \
Elliott Hughes9b5235d2014-06-03 18:47:17 -0700912 libc_malloc \
Elliott Hughesce4783c2013-07-12 17:31:11 -0700913 libc_netbsd \
Elliott Hughes01339442014-02-20 18:04:58 -0800914 libc_openbsd \
Elliott Hughes6380b512014-03-10 16:15:11 -0700915 libc_stack_protector \
Elliott Hughesb3a23bd2014-02-11 13:32:02 -0800916 libc_syscalls \
Elliott Hugheseb847bc2013-10-09 15:50:50 -0700917 libc_tzcode \
918
Elliott Hughesc999f762014-07-10 16:57:27 -0700919LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
920
Christopher Ferris8e32b7b2014-07-10 18:53:41 -0700921ifneq ($(MALLOC_IMPL),dlmalloc)
Elliott Hughes9b5235d2014-06-03 18:47:17 -0700922LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
Christopher Ferris72bbd422014-05-08 11:14:03 -0700923endif
924
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800925LOCAL_SYSTEM_SHARED_LIBRARIES :=
926
Ying Wangc97c5fc2012-08-11 14:23:19 -0700927# TODO: split out the asflags.
928LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
929
Ying Wangf25d6772014-01-23 15:17:50 -0800930$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
931$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
932$(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800933include $(BUILD_STATIC_LIBRARY)
934
935
Dima Zavinca122b02009-05-27 10:52:37 -0700936# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700937# libc_nomalloc.a
938# ========================================================
939#
940# This is a version of the static C library that does not
Elliott Hughes91a99252013-02-12 21:56:42 -0800941# include malloc. It's useful in situations when the user wants
942# to provide their own malloc implementation, or wants to
Christopher Ferris9029d2f2014-05-15 18:12:11 -0700943# explicitly disallow the use of malloc, such as in the
944# dynamic linker.
Dima Zavin49e55332009-05-27 10:52:37 -0700945
946include $(CLEAR_VARS)
947
948LOCAL_SRC_FILES := \
Ying Wangf25d6772014-01-23 15:17:50 -0800949 $(libc_arch_static_src_files) \
950 $(libc_static_common_src_files) \
951 bionic/libc_init_static.cpp
Dima Zavin49e55332009-05-27 10:52:37 -0700952
953LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700954LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes4c2da032014-05-16 16:50:34 -0700955 -DLIBC_STATIC \
Elliott Hughes4c2da032014-05-16 16:50:34 -0700956
Stephen Hines762cea42013-09-30 17:10:53 -0700957LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
958LOCAL_CPPFLAGS := $(libc_common_cppflags)
Dima Zavin49e55332009-05-27 10:52:37 -0700959
960LOCAL_MODULE := libc_nomalloc
Elliott Hughesc999f762014-07-10 16:57:27 -0700961LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -0700962LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Dima Zavin49e55332009-05-27 10:52:37 -0700963LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
964LOCAL_SYSTEM_SHARED_LIBRARIES :=
965
Ying Wangf25d6772014-01-23 15:17:50 -0800966$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
967$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
Dima Zavin49e55332009-05-27 10:52:37 -0700968include $(BUILD_STATIC_LIBRARY)
969
970
971# ========================================================
Elliott Hughes9b5235d2014-06-03 18:47:17 -0700972# libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
973# ========================================================
974
975include $(CLEAR_VARS)
976LOCAL_SRC_FILES := $(libc_malloc_src)
977LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes9b5235d2014-06-03 18:47:17 -0700978 -fvisibility=hidden \
979
980LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
981LOCAL_CPPFLAGS := $(libc_common_cppflags)
982LOCAL_C_INCLUDES := $(libc_common_c_includes)
983LOCAL_MODULE := libc_malloc
Elliott Hughesc999f762014-07-10 16:57:27 -0700984LOCAL_CLANG := $(use_clang)
Elliott Hughes9b5235d2014-06-03 18:47:17 -0700985LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
986include $(BUILD_STATIC_LIBRARY)
987
988
989# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800990# libc.a
991# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800992include $(CLEAR_VARS)
993
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800994LOCAL_SRC_FILES := \
Ying Wangf25d6772014-01-23 15:17:50 -0800995 $(libc_arch_static_src_files) \
996 $(libc_static_common_src_files) \
Ying Wangf25d6772014-01-23 15:17:50 -0800997 bionic/malloc_debug_common.cpp \
998 bionic/libc_init_static.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800999
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001000LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes4c2da032014-05-16 16:50:34 -07001001 -DLIBC_STATIC \
Elliott Hughes4c2da032014-05-16 16:50:34 -07001002
Stephen Hines762cea42013-09-30 17:10:53 -07001003LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1004LOCAL_CPPFLAGS := $(libc_common_cppflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001005LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -07001006LOCAL_MODULE := libc
Elliott Hughesc999f762014-07-10 16:57:27 -07001007LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -07001008LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001009LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001010LOCAL_SYSTEM_SHARED_LIBRARIES :=
1011
Ying Wangf25d6772014-01-23 15:17:50 -08001012$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1013$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001014include $(BUILD_STATIC_LIBRARY)
1015
1016
Dima Zavinca122b02009-05-27 10:52:37 -07001017# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001018# libc.so
1019# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001020include $(CLEAR_VARS)
1021
Elliott Hughes65935972014-07-02 11:22:26 -07001022LOCAL_CFLAGS := $(libc_common_cflags)
Stephen Hines762cea42013-09-30 17:10:53 -07001023LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1024LOCAL_CPPFLAGS := $(libc_common_cppflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001025LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001026LOCAL_SRC_FILES := \
Elliott Hughese7c59f92013-12-17 20:47:06 -08001027 $(libc_arch_dynamic_src_files) \
1028 $(libc_static_common_src_files) \
Elliott Hughese7c59f92013-12-17 20:47:06 -08001029 bionic/malloc_debug_common.cpp \
Elliott Hughese7c59f92013-12-17 20:47:06 -08001030 bionic/libc_init_dynamic.cpp \
Sreeram Ramachandran06e87962014-05-13 16:30:12 -07001031 bionic/NetdClient.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001032
Elliott Hughes4bd97ce2014-04-10 17:48:14 -07001033LOCAL_MODULE := libc
Elliott Hughesc999f762014-07-10 16:57:27 -07001034LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -07001035LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Elliott Hughes914d8d42012-10-18 11:28:56 -07001036LOCAL_REQUIRED_MODULES := tzdata
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001037
Christopher Ferris0ae64452014-03-21 11:11:38 -07001038# Leave the symbols in the shared library so that stack unwinders can produce
1039# meaningful name resolution.
1040LOCAL_STRIP_MODULE := keep_symbols
1041
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001042# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
1043# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
1044# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1045# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1046# should, instead relying on the external symbols from the dependent libraries. That would
Elliott Hughes4bd97ce2014-04-10 17:48:14 -07001047# create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001048# you wanted!
1049
1050LOCAL_SHARED_LIBRARIES := libdl
1051LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1052LOCAL_SYSTEM_SHARED_LIBRARIES :=
1053
Dan Albert71f9b342014-06-24 04:31:08 +00001054# We'd really like to do this for all architectures, but since this wasn't done
1055# before, these symbols must continue to be exported on LP32 for binary
1056# compatibility.
1057LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
1058LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
1059LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
1060
Ying Wangf25d6772014-01-23 15:17:50 -08001061$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Ying Wang76c8b882014-02-12 16:40:55 -08001062$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1063$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
Ying Wangf25d6772014-01-23 15:17:50 -08001064# special for arm
1065LOCAL_NO_CRT_arm := true
1066LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1067LOCAL_SRC_FILES_arm += \
1068 arch-common/bionic/crtbegin_so.c \
1069 arch-arm/bionic/atexit_legacy.c \
1070 arch-common/bionic/crtend_so.S
1071
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001072include $(BUILD_SHARED_LIBRARY)
1073
1074
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001075# For all builds, except for the -user build we will enable memory
1076# allocation checking (including memory leaks, buffer overwrites, etc.)
1077# Note that all these checks are also controlled by env. settings
1078# that can enable, or disable specific checks. Note also that some of
1079# the checks are available only in emulator and are implemeted in
1080# libc_malloc_qemu_instrumented.so.
1081ifneq ($(TARGET_BUILD_VARIANT),user)
1082
Dima Zavinca122b02009-05-27 10:52:37 -07001083# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001084# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001085# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001086include $(CLEAR_VARS)
1087
Dima Zavinca122b02009-05-27 10:52:37 -07001088LOCAL_CFLAGS := \
Ying Wangf25d6772014-01-23 15:17:50 -08001089 $(libc_common_cflags) \
Elliott Hughes4c2da032014-05-16 16:50:34 -07001090 -DMALLOC_LEAK_CHECK \
Elliott Hughes4c2da032014-05-16 16:50:34 -07001091
Stephen Hines762cea42013-09-30 17:10:53 -07001092LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1093LOCAL_CPPFLAGS := $(libc_common_cppflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001094
Christopher Ferrisc701e5b2014-07-24 17:52:23 -07001095# Make sure that unwind.h comes from libunwind.
1096LOCAL_C_INCLUDES := \
Christopher Ferrisc701e5b2014-07-24 17:52:23 -07001097 $(libc_common_c_includes) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001098
1099LOCAL_SRC_FILES := \
Ying Wangf25d6772014-01-23 15:17:50 -08001100 bionic/debug_mapinfo.cpp \
1101 bionic/debug_stacktrace.cpp \
Christopher Ferrisdda1c6c2014-07-09 17:16:07 -07001102 bionic/libc_logging.cpp \
Ying Wangf25d6772014-01-23 15:17:50 -08001103 bionic/malloc_debug_leak.cpp \
1104 bionic/malloc_debug_check.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001105
Elliott Hughes4bd97ce2014-04-10 17:48:14 -07001106LOCAL_MODULE := libc_malloc_debug_leak
Elliott Hughesc999f762014-07-10 16:57:27 -07001107LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -07001108LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001109
Pavel Chupine0077752012-09-10 19:35:25 +04001110LOCAL_SHARED_LIBRARIES := libc libdl
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001111LOCAL_SYSTEM_SHARED_LIBRARIES :=
Christopher Ferris3f7635f2014-08-26 15:47:42 -07001112# Only need this for arm since libc++ uses its own unwind code that
1113# doesn't mix with the other default unwind code.
1114LOCAL_STATIC_LIBRARIES_arm := libc++
Bruce Beareaa46fa22010-07-08 14:47:50 -07001115LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -07001116
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001117# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001118LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001119
Ying Wangf25d6772014-01-23 15:17:50 -08001120$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001121include $(BUILD_SHARED_LIBRARY)
1122
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001123
1124# ========================================================
1125# libc_malloc_debug_qemu.so
1126# ========================================================
1127include $(CLEAR_VARS)
1128
1129LOCAL_CFLAGS := \
Ying Wangf25d6772014-01-23 15:17:50 -08001130 $(libc_common_cflags) \
Elliott Hughes4c2da032014-05-16 16:50:34 -07001131 -DMALLOC_QEMU_INSTRUMENT \
Elliott Hughes4c2da032014-05-16 16:50:34 -07001132
Stephen Hines762cea42013-09-30 17:10:53 -07001133LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1134LOCAL_CPPFLAGS := $(libc_common_cppflags)
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001135
1136LOCAL_C_INCLUDES := $(libc_common_c_includes)
1137
1138LOCAL_SRC_FILES := \
Christopher Ferrisdda1c6c2014-07-09 17:16:07 -07001139 bionic/libc_logging.cpp \
1140 bionic/malloc_debug_qemu.cpp \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001141
Elliott Hughes4bd97ce2014-04-10 17:48:14 -07001142LOCAL_MODULE := libc_malloc_debug_qemu
Elliott Hughesc999f762014-07-10 16:57:27 -07001143LOCAL_CLANG := $(use_clang)
Christopher Ferrisd7a63292013-10-03 13:26:22 -07001144LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001145
Mathias Agopian7c0c3792011-09-05 23:54:55 -07001146LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001147LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -07001148
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001149# Don't install on release build
1150LOCAL_MODULE_TAGS := eng debug
1151
Ying Wangf25d6772014-01-23 15:17:50 -08001152$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001153include $(BUILD_SHARED_LIBRARY)
1154
Ying Wangf25d6772014-01-23 15:17:50 -08001155endif #!user
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001156
Dan Albert6df7b602014-08-15 14:20:04 -07001157# ========================================================
1158# libstdc++.so
1159# ========================================================
1160libstdcxx_common_src_files := \
1161 bionic/__cxa_guard.cpp \
1162 bionic/__cxa_pure_virtual.cpp \
1163 bionic/new.cpp \
1164 bionic/libc_logging.cpp \
1165
1166include $(CLEAR_VARS)
1167LOCAL_C_INCLUDES := $(libc_common_c_includes)
1168LOCAL_CFLAGS := $(libc_common_cflags)
Dmitriy Ivanovef1306d2014-09-08 16:22:22 -07001169LOCAL_CPPFLAGS := $(libc_common_cppflags)
Dan Albert6df7b602014-08-15 14:20:04 -07001170LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1171LOCAL_MODULE:= libstdc++
1172LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1173LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1174include $(BUILD_SHARED_LIBRARY)
1175
1176# ========================================================
1177# libstdc++.a
1178# ========================================================
1179include $(CLEAR_VARS)
1180LOCAL_C_INCLUDES := $(libc_common_c_includes)
1181LOCAL_CFLAGS := $(libc_common_cflags)
Dmitriy Ivanovef1306d2014-09-08 16:22:22 -07001182LOCAL_CPPFLAGS := $(libc_common_cppflags)
Dan Albert6df7b602014-08-15 14:20:04 -07001183LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1184LOCAL_MODULE:= libstdc++
1185LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1186LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1187include $(BUILD_STATIC_LIBRARY)
1188
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001189
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001190# ========================================================
1191include $(call all-makefiles-under,$(LOCAL_PATH))