blob: 9a55eff273a4164c087aa28433f30f1bea91d202 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
Dima Zavinca122b02009-05-27 10:52:37 -07004
5# Define the common source files for all the libc instances
6# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08007libc_common_src_files := \
8 $(syscall_src) \
9 unistd/abort.c \
10 unistd/alarm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080011 unistd/exec.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080012 unistd/fnmatch.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080013 unistd/getopt_long.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080014 unistd/popen.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 unistd/syslog.c \
16 unistd/system.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080017 unistd/time.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018 stdio/asprintf.c \
19 stdio/clrerr.c \
20 stdio/fclose.c \
21 stdio/fdopen.c \
22 stdio/feof.c \
23 stdio/ferror.c \
24 stdio/fflush.c \
25 stdio/fgetc.c \
26 stdio/fgetln.c \
27 stdio/fgetpos.c \
28 stdio/fgets.c \
29 stdio/fileno.c \
30 stdio/findfp.c \
31 stdio/flags.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032 stdio/fopen.c \
33 stdio/fprintf.c \
34 stdio/fpurge.c \
35 stdio/fputc.c \
36 stdio/fputs.c \
37 stdio/fread.c \
38 stdio/freopen.c \
39 stdio/fscanf.c \
40 stdio/fseek.c \
41 stdio/fsetpos.c \
42 stdio/ftell.c \
43 stdio/funopen.c \
44 stdio/fvwrite.c \
45 stdio/fwalk.c \
46 stdio/fwrite.c \
47 stdio/getc.c \
48 stdio/getchar.c \
49 stdio/gets.c \
50 stdio/makebuf.c \
51 stdio/mktemp.c \
52 stdio/printf.c \
53 stdio/putc.c \
54 stdio/putchar.c \
55 stdio/puts.c \
56 stdio/putw.c \
57 stdio/refill.c \
58 stdio/remove.c \
59 stdio/rewind.c \
60 stdio/rget.c \
61 stdio/scanf.c \
62 stdio/setbuf.c \
63 stdio/setbuffer.c \
64 stdio/setvbuf.c \
65 stdio/snprintf.c\
66 stdio/sprintf.c \
67 stdio/sscanf.c \
68 stdio/stdio.c \
69 stdio/tempnam.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080070 stdio/tmpnam.c \
71 stdio/ungetc.c \
72 stdio/vasprintf.c \
73 stdio/vfprintf.c \
74 stdio/vfscanf.c \
75 stdio/vprintf.c \
76 stdio/vsnprintf.c \
77 stdio/vsprintf.c \
78 stdio/vscanf.c \
79 stdio/vsscanf.c \
80 stdio/wbuf.c \
81 stdio/wsetup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080082 stdlib/atexit.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080083 stdlib/ctype_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080084 stdlib/exit.c \
85 stdlib/getenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080086 stdlib/putenv.c \
87 stdlib/qsort.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080088 stdlib/setenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080089 stdlib/strtod.c \
90 stdlib/strtoimax.c \
91 stdlib/strtol.c \
92 stdlib/strtoll.c \
93 stdlib/strtoul.c \
94 stdlib/strtoull.c \
95 stdlib/strtoumax.c \
96 stdlib/tolower_.c \
97 stdlib/toupper_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080098 string/index.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080099 string/strcasecmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800100 string/strcat.c \
101 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800102 string/strcspn.c \
103 string/strdup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800104 string/strlcat.c \
105 string/strlcpy.c \
106 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800107 string/strncpy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800108 string/strpbrk.c \
109 string/strrchr.c \
110 string/strsep.c \
111 string/strspn.c \
112 string/strstr.c \
113 string/strtok.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700114 wchar/wcpcpy.c \
115 wchar/wcpncpy.c \
116 wchar/wcscasecmp.c \
117 wchar/wcscat.c \
118 wchar/wcschr.c \
119 wchar/wcscmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700120 wchar/wcscpy.c \
121 wchar/wcscspn.c \
122 wchar/wcsdup.c \
123 wchar/wcslcat.c \
124 wchar/wcslcpy.c \
125 wchar/wcslen.c \
126 wchar/wcsncasecmp.c \
127 wchar/wcsncat.c \
128 wchar/wcsncmp.c \
129 wchar/wcsncpy.c \
130 wchar/wcsnlen.c \
131 wchar/wcspbrk.c \
132 wchar/wcsrchr.c \
133 wchar/wcsspn.c \
134 wchar/wcsstr.c \
135 wchar/wcstok.c \
136 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100137 wchar/wcsxfrm.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700138 wchar/wmemchr.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100139 wchar/wmemcmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700140 wchar/wmemcpy.c \
141 wchar/wmemmove.c \
142 wchar/wmemset.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800143 tzcode/asctime.c \
144 tzcode/difftime.c \
145 tzcode/localtime.c \
146 tzcode/strftime.c \
147 tzcode/strptime.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800148 bionic/arc4random.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700149 bionic/atoi.c \
150 bionic/atol.c \
151 bionic/atoll.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700152 bionic/bindresvport.c \
153 bionic/bionic_clone.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800154 bionic/clearenv.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700155 bionic/cpuacct.c \
156 bionic/daemon.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800157 bionic/err.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700158 bionic/ether_aton.c \
159 bionic/ether_ntoa.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700160 bionic/fcntl.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800161 bionic/fdprintf.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700162 bionic/flockfile.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800163 bionic/fork.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700164 bionic/fstatfs.c \
165 bionic/ftime.c \
166 bionic/ftok.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800167 bionic/fts.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700168 bionic/getdtablesize.c \
169 bionic/gethostname.c \
170 bionic/getpgrp.c \
171 bionic/getpriority.c \
172 bionic/getpt.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800173 bionic/if_indextoname.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700174 bionic/if_nametoindex.c \
175 bionic/initgroups.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800176 bionic/ioctl.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700177 bionic/isatty.c \
178 bionic/issetugid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800179 bionic/ldexp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800180 bionic/logd_write.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700181 bionic/lseek64.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800182 bionic/md5.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700183 bionic/memchr.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700184 bionic/memmem.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700185 bionic/memrchr.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700186 bionic/memswap.c \
187 bionic/mmap.c \
188 bionic/openat.c \
189 bionic/open.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700190 bionic/pathconf.c \
191 bionic/perror.c \
192 bionic/pread.c \
193 bionic/pselect.c \
194 bionic/ptsname.c \
195 bionic/ptsname_r.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800196 bionic/pututline.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700197 bionic/pwrite.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800198 bionic/realpath.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700199 bionic/reboot.c \
200 bionic/recv.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100201 bionic/sched_cpualloc.c \
202 bionic/sched_cpucount.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700203 bionic/sched_getaffinity.c \
204 bionic/sched_getcpu.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800205 bionic/semaphore.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700206 bionic/send.c \
207 bionic/setegid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700208 bionic/seteuid.c \
209 bionic/setpgrp.c \
210 bionic/setresuid.c \
211 bionic/setreuid.c \
212 bionic/setuid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700213 bionic/sigblock.c \
214 bionic/siginterrupt.c \
215 bionic/siglist.c \
216 bionic/signal.c \
217 bionic/signame.c \
218 bionic/sigsetmask.c \
219 bionic/sigsuspend.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700220 bionic/sleep.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700221 bionic/statfs.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700222 bionic/strndup.c \
223 bionic/strnlen.c \
224 bionic/strntoimax.c \
225 bionic/strntoumax.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700226 bionic/strtotimeval.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800227 bionic/system_properties.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700228 bionic/tcgetpgrp.c \
229 bionic/tcsetpgrp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800230 bionic/thread_atexit.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700231 bionic/time64.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700232 bionic/umount.c \
233 bionic/unlockpt.c \
234 bionic/usleep.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800235 bionic/utmp.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700236 bionic/wait.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700237 bionic/wcscoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800238 netbsd/gethnamaddr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800239 netbsd/inet/nsap_addr.c \
240 netbsd/resolv/__dn_comp.c \
241 netbsd/resolv/__res_close.c \
242 netbsd/resolv/__res_send.c \
243 netbsd/resolv/herror.c \
244 netbsd/resolv/res_comp.c \
245 netbsd/resolv/res_data.c \
246 netbsd/resolv/res_debug.c \
247 netbsd/resolv/res_init.c \
248 netbsd/resolv/res_mkquery.c \
249 netbsd/resolv/res_query.c \
250 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900251 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800252 netbsd/resolv/res_cache.c \
253 netbsd/net/nsdispatch.c \
254 netbsd/net/getaddrinfo.c \
255 netbsd/net/getnameinfo.c \
256 netbsd/net/getservbyname.c \
257 netbsd/net/getservent.c \
258 netbsd/net/base64.c \
259 netbsd/net/getservbyport.c \
260 netbsd/nameser/ns_name.c \
261 netbsd/nameser/ns_parse.c \
262 netbsd/nameser/ns_ttl.c \
263 netbsd/nameser/ns_netint.c \
264 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800265 netbsd/nameser/ns_samedomain.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800266
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700267libc_bionic_src_files := \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700268 bionic/assert.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800269 bionic/brk.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800270 bionic/debug_format.cpp \
David 'Digit' Turnerc30396f2012-10-29 15:32:54 +0100271 bionic/dirent.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800272 bionic/__errno.c \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700273 bionic/eventfd.cpp \
274 bionic/__fgets_chk.cpp \
Nick Kralevich2c5153b2013-01-11 14:43:05 -0800275 bionic/getauxval.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700276 bionic/getcwd.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800277 bionic/libc_init_common.cpp \
Elliott Hughes58b57542012-10-29 14:27:10 -0700278 bionic/libgen.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700279 bionic/__memcpy_chk.cpp \
280 bionic/__memmove_chk.cpp \
281 bionic/__memset_chk.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000282 bionic/pthread_attr.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800283 bionic/pthread_detach.cpp \
284 bionic/pthread_equal.cpp \
285 bionic/pthread_getcpuclockid.cpp \
286 bionic/pthread_getschedparam.cpp \
287 bionic/pthread_internals.cpp \
288 bionic/pthread_join.cpp \
289 bionic/pthread_kill.cpp \
290 bionic/pthread_self.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000291 bionic/pthread_setname_np.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800292 bionic/pthread_setschedparam.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800293 bionic/pthread_sigmask.cpp \
Chris Dearmand8a5a6f2012-12-07 18:41:10 -0800294 bionic/raise.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800295 bionic/sbrk.cpp \
Elliott Hughes701bec22013-02-25 13:14:31 -0800296 bionic/scandir.cpp \
Elliott Hughes4a9e8372012-11-30 11:58:57 -0800297 bionic/__set_errno.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700298 bionic/setlocale.cpp \
Rom Lemarchanda4b2dc02013-01-09 15:46:06 -0800299 bionic/signalfd.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800300 bionic/sigwait.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700301 bionic/__strcat_chk.cpp \
302 bionic/__strcpy_chk.cpp \
303 bionic/strerror.cpp \
304 bionic/strerror_r.cpp \
305 bionic/__strlcat_chk.cpp \
306 bionic/__strlcpy_chk.cpp \
307 bionic/__strlen_chk.cpp \
308 bionic/__strncat_chk.cpp \
309 bionic/__strncpy_chk.cpp \
310 bionic/strsignal.cpp \
311 bionic/stubs.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800312 bionic/sysconf.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700313 bionic/tdestroy.cpp \
314 bionic/tmpfile.cpp \
315 bionic/__umask_chk.cpp \
316 bionic/__vsnprintf_chk.cpp \
317 bionic/__vsprintf_chk.cpp \
318 bionic/wchar.cpp \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700319
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700320libc_upstream_netbsd_src_files := \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700321 upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
322 upstream-netbsd/common/lib/libc/inet/inet_addr.c \
323 upstream-netbsd/libc/compat-43/creat.c \
324 upstream-netbsd/libc/gen/ftw.c \
325 upstream-netbsd/libc/gen/nftw.c \
326 upstream-netbsd/libc/gen/nice.c \
327 upstream-netbsd/libc/gen/psignal.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700328 upstream-netbsd/libc/gen/setjmperr.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700329 upstream-netbsd/libc/gen/utime.c \
330 upstream-netbsd/libc/inet/inet_ntoa.c \
331 upstream-netbsd/libc/inet/inet_ntop.c \
332 upstream-netbsd/libc/inet/inet_pton.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700333 upstream-netbsd/libc/isc/ev_streams.c \
334 upstream-netbsd/libc/isc/ev_timers.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700335 upstream-netbsd/libc/regex/regcomp.c \
336 upstream-netbsd/libc/regex/regerror.c \
337 upstream-netbsd/libc/regex/regexec.c \
338 upstream-netbsd/libc/regex/regfree.c \
339 upstream-netbsd/libc/stdio/getdelim.c \
340 upstream-netbsd/libc/stdio/getline.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700341 upstream-netbsd/libc/stdlib/bsearch.c \
342 upstream-netbsd/libc/stdlib/div.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700343 upstream-netbsd/libc/stdlib/drand48.c \
344 upstream-netbsd/libc/stdlib/erand48.c \
345 upstream-netbsd/libc/stdlib/jrand48.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700346 upstream-netbsd/libc/stdlib/ldiv.c \
347 upstream-netbsd/libc/stdlib/lldiv.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700348 upstream-netbsd/libc/stdlib/lrand48.c \
349 upstream-netbsd/libc/stdlib/mrand48.c \
350 upstream-netbsd/libc/stdlib/nrand48.c \
351 upstream-netbsd/libc/stdlib/_rand48.c \
352 upstream-netbsd/libc/stdlib/seed48.c \
353 upstream-netbsd/libc/stdlib/srand48.c \
354 upstream-netbsd/libc/stdlib/tdelete.c \
355 upstream-netbsd/libc/stdlib/tfind.c \
356 upstream-netbsd/libc/stdlib/tsearch.c \
Elliott Hughesc51cd762013-01-22 14:41:23 -0800357 upstream-netbsd/libc/string/memccpy.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700358 upstream-netbsd/libc/string/strcasestr.c \
Elliott Hughes2b473072013-01-22 15:10:19 -0800359 upstream-netbsd/libc/string/strcoll.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700360 upstream-netbsd/libc/string/strxfrm.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700361 upstream-netbsd/libc/unistd/killpg.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700362
Dima Zavinca122b02009-05-27 10:52:37 -0700363# Architecture specific source files go here
364# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800365ifeq ($(TARGET_ARCH),arm)
366libc_common_src_files += \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700367 bionic/memmove.c.arm \
368 bionic/socketcalls.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800369 string/bcopy.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800370 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800371
372# These files need to be arm so that gdbserver
373# can set breakpoints in them without messing
374# up any thumb code.
375libc_common_src_files += \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500376 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700377 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800378 bionic/pthread-timers.c.arm \
379 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700380
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700381libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000382 bionic/pthread.c.arm \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800383 bionic/pthread_create.cpp.arm \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000384 bionic/pthread_key.cpp.arm \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700385
Raghu Gandhama4c79332012-08-07 12:23:24 -0700386endif # arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800387
388ifeq ($(TARGET_ARCH),x86)
389libc_common_src_files += \
Elliott Hughesd2547042013-02-13 16:31:52 -0800390 bionic/pthread-atfork.c \
391 bionic/pthread-rwlocks.c \
392 bionic/pthread-timers.c \
393 bionic/ptrace.c \
394 string/strcpy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800395
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700396libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000397 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800398 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000399 bionic/pthread_key.cpp \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700400
Raghu Gandhama4c79332012-08-07 12:23:24 -0700401endif # x86
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900402
Raghu Gandhama4c79332012-08-07 12:23:24 -0700403ifeq ($(TARGET_ARCH),mips)
404libc_common_src_files += \
Elliott Hughes857fed52012-10-02 11:20:07 -0700405 bionic/memcmp.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700406 string/bcopy.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700407 string/strcmp.c \
408 string/strcpy.c \
409 string/strncmp.c
410
411libc_common_src_files += \
412 bionic/pthread-atfork.c \
413 bionic/pthread-rwlocks.c \
414 bionic/pthread-timers.c \
415 bionic/ptrace.c
416
417libc_static_common_src_files += \
Elliott Hughesba342c12013-02-11 18:06:23 -0800418 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800419 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000420 bionic/pthread_key.cpp \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700421
Raghu Gandhama4c79332012-08-07 12:23:24 -0700422endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800423
Christopher Ferris7c83a1e2013-02-26 01:30:00 -0800424ifeq ($(strip $(TARGET_CPU_VARIANT)),)
425$(warning TARGET_CPU_VARIANT is not defined)
426endif
427
428###########################################################
429## Add cpu specific source files.
430##
431## This can be called multiple times, but it will only add
432## the first source file for each unique $(1).
433## $(1): Unique identifier to identify the cpu variant
434## implementation.
435## $(2): Cpu specific source file.
436###########################################################
437
438define libc-add-cpu-variant-src
439$(if $(filter true,$(_LIBC_ARCH_CPU_VARIANT_HAS_$(1))), \
440 , \
441 $(eval _LIBC_ARCH_CPU_VARIANT_HAS_$(1) := true) \
442 $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILE.$(1) := $(2)) \
443 $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILES += $(2)) \
444)
445endef
446
447_LIBC_ARCH_COMMON_SRC_FILES :=
448_LIBC_ARCH_CPU_VARIANT_SRC_FILES :=
449_LIBC_ARCH_STATIC_SRC_FILES :=
450_LIBC_ARCH_DYNAMIC_SRC_FILES :=
451include bionic/libc/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
452
453libc_common_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES)
454libc_common_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES)
455libc_arch_static_src_files := $(_LIBC_ARCH_STATIC_SRC_FILES)
456libc_arch_dynamic_src_files := $(_LIBC_ARCH_DYNAMIC_SRC_FILES)
457
Dima Zavinca122b02009-05-27 10:52:37 -0700458# Define some common cflags
459# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800460libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700461 -DWITH_ERRLIST \
462 -DANDROID_CHANGES \
Elliott Hughes470631e2012-06-06 10:32:56 -0700463 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700464 -DFLOATING_POINT \
465 -DINET6 \
466 -I$(LOCAL_PATH)/private \
Elliott Hughes470631e2012-06-06 10:32:56 -0700467 -DPOSIX_MISTAKE \
468 -DLOG_ON_HEAP_ERROR \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700469 -Wall -Wextra
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800470
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800471# these macro definitions are required to implement the
472# 'timezone' and 'daylight' global variables, as well as
473# properly update the 'tm_gmtoff' field in 'struct tm'.
474#
475libc_common_cflags += \
476 -DTM_GMTOFF=tm_gmtoff \
477 -DUSG_COMPAT=1
478
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700479ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800480 libc_common_cflags += -DDEBUG
481endif
482
Jack Ren2fd81ef2011-11-19 09:48:03 +0800483# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
484# the appropriate BoardConfig.mk file.
485#
486ifneq ($(BOARD_MALLOC_ALIGNMENT),)
487 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
488endif
489
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800490ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700491 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800492 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700493 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700494 #
Elliott Hughes91a99252013-02-12 21:56:42 -0800495 # Define HAVE_32_BYTE_CACHE_LINES to indicate to the C library
496 # that it should use the 32-byte version of memcpy, not
Henrik Smidingfe6338d2010-09-15 16:08:03 +0200497 # the 64-byte version.
498 #
499 ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
500 libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
501 endif
Prajakta Gudadhe08e72d02012-05-07 14:17:44 -0700502 ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
503 libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
504 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700505endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800506
Raghu Gandhama4c79332012-08-07 12:23:24 -0700507ifeq ($(TARGET_ARCH),x86)
508 libc_common_cflags += -DSOFTFLOAT
509 libc_crt_target_cflags :=
510 ifeq ($(ARCH_X86_HAVE_SSE2),true)
511 libc_crt_target_cflags += -DUSE_SSE2=1
512 endif
513 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
514 libc_crt_target_cflags += -DUSE_SSSE3=1
515 endif
516endif # x86
517
518ifeq ($(TARGET_ARCH),mips)
519 ifneq ($(ARCH_MIPS_HAS_FPU),true)
520 libc_common_cflags += -DSOFTFLOAT
521 endif
522 libc_common_cflags += -fstrict-aliasing
523 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
524endif # mips
525
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700526# Define ANDROID_SMP appropriately.
527ifeq ($(TARGET_CPU_SMP),true)
528 libc_common_cflags += -DANDROID_SMP=1
529else
530 libc_common_cflags += -DANDROID_SMP=0
531endif
532
Elliott Hughes76be6602012-08-08 14:07:37 -0700533# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
534libc_crt_target_cflags += \
535 -I$(LOCAL_PATH)/include \
536 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700537
Dima Zavinca122b02009-05-27 10:52:37 -0700538# Define some common includes
539# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800540libc_common_c_includes := \
541 $(LOCAL_PATH)/stdlib \
542 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700543 $(LOCAL_PATH)/stdio \
544 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800545
Nick Kralevich9d403262012-05-31 11:40:10 -0700546# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700547# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700548libc_crt_target_cflags += \
549 -I$(LOCAL_PATH)/private \
550 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800551
Dima Zavinca122b02009-05-27 10:52:37 -0700552# Define the libc run-time (crt) support object files that must be built,
553# which are needed to build all other objects (shared/static libs and
554# executables)
555# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700556# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700557#
558# For x86, the .init section must point to a function that calls all
559# entries in the .ctors section. (on ARM this is done through the
560# .init_array section instead).
561#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700562# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700563# that will call __cxa_finalize(&__dso_handle) in order to ensure that
564# static C++ destructors are properly called on dlclose().
565#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700566ifeq ($(TARGET_ARCH),arm)
Elliott Hughes12949e52012-09-10 11:16:12 -0700567 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700568 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200569endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700570ifeq ($(TARGET_ARCH),mips)
Elliott Hughes12949e52012-09-10 11:16:12 -0700571 libc_crtbegin_extension := S
Raghu Gandhama4c79332012-08-07 12:23:24 -0700572 libc_crt_target_so_cflags := -fPIC
573endif
574ifeq ($(TARGET_ARCH),x86)
Pavel Chupin20c4a3a2012-11-28 18:31:14 +0400575 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700576 libc_crt_target_so_cflags := -fPIC
577endif
Elliott Hughes12949e52012-09-10 11:16:12 -0700578ifeq ($(libc_crtbegin_extension),)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700579 $(error $(TARGET_ARCH) not supported)
580endif
581libc_crt_target_so_cflags += $(libc_crt_target_cflags)
Elliott Hughes12949e52012-09-10 11:16:12 -0700582libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtbegin_extension)
583libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtbegin_extension)
Michael Hopeea8fad12012-07-31 16:18:22 +1200584
585# See the comment in crtbrand.c for the reason why we need to generate
586# crtbrand.s before generating crtbrand.o.
587GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
588$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
589 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700590 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -S \
591 -MD -MF $(@:%.s=%.d) -o $@ $<
592 $(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
593 $(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P))
594-include $(GEN:%.s=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200595ALL_GENERATED_SOURCES += $(GEN)
596
597GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
598$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
599 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700600 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
Michael Hopeea8fad12012-07-31 16:18:22 +1200601ALL_GENERATED_SOURCES += $(GEN)
602
Ying Wangfc9e5252012-05-15 15:15:11 -0700603GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700604$(GEN): $(libc_crt_target_crtbegin_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800605 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700606 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
607 -MD -MF $(@:%.o=%.d) -o $@ -c $<
608 $(transform-d-to-p)
609-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800610ALL_GENERATED_SOURCES += $(GEN)
611
Ying Wangfc9e5252012-05-15 15:15:11 -0700612GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800613$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
614 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700615 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
616 -MD -MF $(@:%.o=%.d) -o $@ -c $<
617 $(transform-d-to-p)
618-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800619ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700620
Ying Wangcf464872012-09-07 17:06:56 -0700621# The following two are installed to device
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700622GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700623$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
624 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700625ALL_GENERATED_SOURCES += $(GEN)
626
627GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700628$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
629 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700630ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800631
Dima Zavinca122b02009-05-27 10:52:37 -0700632
Michael Hopeea8fad12012-07-31 16:18:22 +1200633GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700634$(GEN): $(libc_crt_target_crtbegin_file)
Michael Hopeea8fad12012-07-31 16:18:22 +1200635 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700636 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
637 -MD -MF $(@:%.o=%.d) -o $@ -c $<
638 $(transform-d-to-p)
639-include $(GEN:%.o=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200640ALL_GENERATED_SOURCES += $(GEN)
641
Ying Wangfc9e5252012-05-15 15:15:11 -0700642GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200643$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
644 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700645 $(hide) $(TARGET_LD) -r -o $@ $^
Michael Hopeea8fad12012-07-31 16:18:22 +1200646ALL_GENERATED_SOURCES += $(GEN)
647
648GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700649$(GEN): $(libc_crt_target_crtbegin_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700650 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700651 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
652 -MD -MF $(@:%.o=%.d) -o $@ -c $<
653 $(transform-d-to-p)
654-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700655ALL_GENERATED_SOURCES += $(GEN)
656
Ying Wangfc9e5252012-05-15 15:15:11 -0700657GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200658$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700659 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700660 $(hide) $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700661ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800662
Dima Zavinca122b02009-05-27 10:52:37 -0700663# We rename crtend.o to crtend_android.o to avoid a
664# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700665GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700666$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
667 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700668 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
669 -MD -MF $(@:%.o=%.d) -o $@ -c $<
670 $(transform-d-to-p)
671-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700672ALL_GENERATED_SOURCES += $(GEN)
673
674
675# To enable malloc leak check for statically linked programs, add
676# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
677WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
678
679# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700680# libbionic_ssp.a - stack protector code
681# ========================================================
682#
683# The stack protector code needs to be compiled
684# with -fno-stack-protector, since it modifies the
685# stack canary.
686
687include $(CLEAR_VARS)
688
Elliott Hughesfb7eb5e2013-02-14 14:37:34 -0800689LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp bionic/__stack_chk_guard.cpp
Elliott Hughesdc5ec072013-02-14 11:15:58 -0800690LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector -Werror
Nick Kralevich6334c662012-07-10 10:46:19 -0700691LOCAL_C_INCLUDES := $(libc_common_c_includes)
692LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700693LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700694LOCAL_SYSTEM_SHARED_LIBRARIES :=
695
696include $(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 Hughes3d2d4482012-08-13 16:38:29 -0700711 -I$(LOCAL_PATH)/upstream-netbsd \
Elliott Hughesab44f522012-10-23 16:05:09 -0700712 -I$(LOCAL_PATH)/upstream-netbsd/libc/include \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700713 -include upstream-netbsd/netbsd-compat.h
714LOCAL_C_INCLUDES := $(libc_common_c_includes)
715LOCAL_MODULE := libc_netbsd
Elliott Hughesae5c6442012-08-13 14:06:05 -0700716LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700717LOCAL_SYSTEM_SHARED_LIBRARIES :=
718
719include $(BUILD_STATIC_LIBRARY)
720
721
722# ========================================================
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700723# libc_bionic.a - home-grown C library code
724# ========================================================
725#
726include $(CLEAR_VARS)
727
728LOCAL_SRC_FILES := $(libc_bionic_src_files)
729LOCAL_CFLAGS := $(libc_common_cflags) -Werror
730LOCAL_C_INCLUDES := $(libc_common_c_includes)
731LOCAL_MODULE := libc_bionic
732LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
733LOCAL_SYSTEM_SHARED_LIBRARIES :=
734
735include $(BUILD_STATIC_LIBRARY)
736
737
738# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700739# libc_common.a
740# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700741
Dima Zavinca122b02009-05-27 10:52:37 -0700742include $(CLEAR_VARS)
743
744LOCAL_SRC_FILES := $(libc_common_src_files)
Elliott Hughesab44f522012-10-23 16:05:09 -0700745LOCAL_CFLAGS := $(libc_common_cflags) \
746 -std=gnu99 \
747 -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for netbsd private headers
Dima Zavinca122b02009-05-27 10:52:37 -0700748LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800749LOCAL_MODULE := libc_common
Elliott Hughesae5c6442012-08-13 14:06:05 -0700750LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700751LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_netbsd
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800752LOCAL_SYSTEM_SHARED_LIBRARIES :=
753
Ying Wangc97c5fc2012-08-11 14:23:19 -0700754# TODO: split out the asflags.
755LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
756
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800757include $(BUILD_STATIC_LIBRARY)
758
759
Dima Zavinca122b02009-05-27 10:52:37 -0700760# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700761# libc_nomalloc.a
762# ========================================================
763#
764# This is a version of the static C library that does not
Elliott Hughes91a99252013-02-12 21:56:42 -0800765# include malloc. It's useful in situations when the user wants
766# to provide their own malloc implementation, or wants to
767# explicitly disallow the use of the use of malloc,
768# such as in the dynamic loader.
Dima Zavin49e55332009-05-27 10:52:37 -0700769
770include $(CLEAR_VARS)
771
772LOCAL_SRC_FILES := \
773 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700774 $(libc_static_common_src_files) \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800775 bionic/libc_init_static.cpp
Dima Zavin49e55332009-05-27 10:52:37 -0700776
777LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700778LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700779 -DLIBC_STATIC \
780 -std=gnu99
Dima Zavin49e55332009-05-27 10:52:37 -0700781
782LOCAL_MODULE := libc_nomalloc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700783LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dima Zavin49e55332009-05-27 10:52:37 -0700784LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
785LOCAL_SYSTEM_SHARED_LIBRARIES :=
786
787include $(BUILD_STATIC_LIBRARY)
788
789
790# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800791# libc.a
792# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800793include $(CLEAR_VARS)
794
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800795LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700796 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700797 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800798 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700799 bionic/malloc_debug_common.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800800 bionic/libc_init_static.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800801
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800802LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700803 -DLIBC_STATIC \
804 -std=gnu99
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800805LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700806LOCAL_MODULE := libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700807LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800808LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800809LOCAL_SYSTEM_SHARED_LIBRARIES :=
810
811include $(BUILD_STATIC_LIBRARY)
812
813
Dima Zavinca122b02009-05-27 10:52:37 -0700814# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800815# libc.so
816# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800817include $(CLEAR_VARS)
818
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700819# pthread deadlock prediction:
820# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
821# pthread deadlock prediction.
822# Since this code is experimental it is disabled by default.
823# see libc/bionic/pthread_debug.c for details
824
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700825LOCAL_CFLAGS := $(libc_common_cflags) -std=gnu99 -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800826LOCAL_C_INCLUDES := $(libc_common_c_includes)
827
828LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700829 $(libc_arch_dynamic_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700830 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800831 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700832 bionic/malloc_debug_common.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800833 bionic/pthread_debug.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800834 bionic/libc_init_dynamic.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800835
Ard Biesheuvelf3cfcd82012-08-21 14:13:50 +0200836ifeq ($(TARGET_ARCH),arm)
837 LOCAL_NO_CRT := true
838 LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
839
840 LOCAL_SRC_FILES := \
841 arch-arm/bionic/crtbegin_so.c \
842 arch-arm/bionic/atexit_legacy.c \
843 $(LOCAL_SRC_FILES) \
844 arch-arm/bionic/crtend_so.S
845endif
846
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800847LOCAL_MODULE:= libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700848LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughes914d8d42012-10-18 11:28:56 -0700849LOCAL_REQUIRED_MODULES := tzdata
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800850
851# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
852# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
853# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
854# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
855# should, instead relying on the external symbols from the dependent libraries. That would
856# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
857# you wanted!
858
859LOCAL_SHARED_LIBRARIES := libdl
860LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
861LOCAL_SYSTEM_SHARED_LIBRARIES :=
862
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800863include $(BUILD_SHARED_LIBRARY)
864
865
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800866# For all builds, except for the -user build we will enable memory
867# allocation checking (including memory leaks, buffer overwrites, etc.)
868# Note that all these checks are also controlled by env. settings
869# that can enable, or disable specific checks. Note also that some of
870# the checks are available only in emulator and are implemeted in
871# libc_malloc_qemu_instrumented.so.
872ifneq ($(TARGET_BUILD_VARIANT),user)
873
Dima Zavinca122b02009-05-27 10:52:37 -0700874# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800875# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800876# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800877include $(CLEAR_VARS)
878
Dima Zavinca122b02009-05-27 10:52:37 -0700879LOCAL_CFLAGS := \
880 $(libc_common_cflags) \
881 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800882
883LOCAL_C_INCLUDES := $(libc_common_c_includes)
884
885LOCAL_SRC_FILES := \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800886 bionic/debug_mapinfo.cpp \
887 bionic/debug_stacktrace.cpp \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700888 bionic/malloc_debug_leak.cpp \
889 bionic/malloc_debug_check.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800890
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800891LOCAL_MODULE:= libc_malloc_debug_leak
Elliott Hughesae5c6442012-08-13 14:06:05 -0700892LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800893
Pavel Chupine0077752012-09-10 19:35:25 +0400894LOCAL_SHARED_LIBRARIES := libc libdl
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800895LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
896LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700897LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -0700898
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800899# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800900LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800901
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800902include $(BUILD_SHARED_LIBRARY)
903
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800904
905# ========================================================
906# libc_malloc_debug_qemu.so
907# ========================================================
908include $(CLEAR_VARS)
909
910LOCAL_CFLAGS := \
911 $(libc_common_cflags) \
912 -DMALLOC_QEMU_INSTRUMENT
913
914LOCAL_C_INCLUDES := $(libc_common_c_includes)
915
916LOCAL_SRC_FILES := \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700917 bionic/malloc_debug_qemu.cpp
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800918
919LOCAL_MODULE:= libc_malloc_debug_qemu
Elliott Hughesae5c6442012-08-13 14:06:05 -0700920LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800921
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700922LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800923LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
924LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -0700925
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800926# Don't install on release build
927LOCAL_MODULE_TAGS := eng debug
928
929include $(BUILD_SHARED_LIBRARY)
930
931endif #!user
932
933
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800934# ========================================================
935include $(call all-makefiles-under,$(LOCAL_PATH))