Android.mk revision 00008263782e484020420c606f7d145fe7d0a4d8
1LOCAL_PATH := $(call my-dir)
2
3# Make everything depend on any changes to included makefiles.
4libc_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
36
37# Define the common source files for all the libc instances
38# =========================================================
39libc_common_src_files := \
40    bionic/bindresvport.c \
41    bionic/daemon.c \
42    bionic/err.c \
43    bionic/ether_aton.c \
44    bionic/ether_ntoa.c \
45    bionic/fts.c \
46    bionic/gethostname.c \
47    bionic/getpriority.c \
48    bionic/if_indextoname.c \
49    bionic/if_nametoindex.c \
50    bionic/initgroups.c \
51    bionic/ioctl.c \
52    bionic/isatty.c \
53    bionic/memmem.c \
54    bionic/pathconf.c \
55    bionic/pututline.c \
56    bionic/sched_cpualloc.c \
57    bionic/sched_cpucount.c \
58    bionic/semaphore.c \
59    bionic/sigblock.c \
60    bionic/siginterrupt.c \
61    bionic/sigsetmask.c \
62    bionic/system_properties_compat.c \
63    stdio/snprintf.c\
64    stdio/sprintf.c \
65
66# Fortify implementations of libc functions.
67libc_common_src_files += \
68    bionic/__FD_chk.cpp \
69    bionic/__fgets_chk.cpp \
70    bionic/__memmove_chk.cpp \
71    bionic/__read_chk.cpp \
72    bionic/__recvfrom_chk.cpp \
73    bionic/__stpcpy_chk.cpp \
74    bionic/__stpncpy_chk.cpp \
75    bionic/__strchr_chk.cpp \
76    bionic/__strlcat_chk.cpp \
77    bionic/__strlcpy_chk.cpp \
78    bionic/__strlen_chk.cpp \
79    bionic/__strncat_chk.cpp \
80    bionic/__strncpy_chk.cpp \
81    bionic/__strrchr_chk.cpp \
82    bionic/__umask_chk.cpp \
83    bionic/__vsnprintf_chk.cpp \
84    bionic/__vsprintf_chk.cpp \
85
86libc_bionic_src_files := \
87    bionic/abort.cpp \
88    bionic/accept.cpp \
89    bionic/accept4.cpp \
90    bionic/access.cpp \
91    bionic/assert.cpp \
92    bionic/atof.cpp \
93    bionic/bionic_time_conversions.cpp \
94    bionic/brk.cpp \
95    bionic/c16rtomb.cpp \
96    bionic/c32rtomb.cpp \
97    bionic/chmod.cpp \
98    bionic/chown.cpp \
99    bionic/clearenv.cpp \
100    bionic/clock.cpp \
101    bionic/clone.cpp \
102    bionic/__cmsg_nxthdr.cpp \
103    bionic/connect.cpp \
104    bionic/ctype.cpp \
105    bionic/dirent.cpp \
106    bionic/dup2.cpp \
107    bionic/epoll_create.cpp \
108    bionic/epoll_pwait.cpp \
109    bionic/epoll_wait.cpp \
110    bionic/__errno.cpp \
111    bionic/eventfd_read.cpp \
112    bionic/eventfd_write.cpp \
113    bionic/ffs.cpp \
114    bionic/flockfile.cpp \
115    bionic/fork.cpp \
116    bionic/fpclassify.cpp \
117    bionic/futimens.cpp \
118    bionic/getauxval.cpp \
119    bionic/getcwd.cpp \
120    bionic/getentropy_linux.c \
121    bionic/getpgrp.cpp \
122    bionic/getpid.cpp \
123    bionic/gettid.cpp \
124    bionic/inotify_init.cpp \
125    bionic/lchown.cpp \
126    bionic/lfs64_support.cpp \
127    bionic/__libc_current_sigrtmax.cpp \
128    bionic/__libc_current_sigrtmin.cpp \
129    bionic/libc_init_common.cpp \
130    bionic/libc_logging.cpp \
131    bionic/libgen.cpp \
132    bionic/link.cpp \
133    bionic/locale.cpp \
134    bionic/lstat.cpp \
135    bionic/mbrtoc16.cpp \
136    bionic/mbrtoc32.cpp \
137    bionic/mbstate.cpp \
138    bionic/mkdir.cpp \
139    bionic/mkfifo.cpp \
140    bionic/mknod.cpp \
141    bionic/mntent.cpp \
142    bionic/NetdClientDispatch.cpp \
143    bionic/open.cpp \
144    bionic/pause.cpp \
145    bionic/pipe.cpp \
146    bionic/poll.cpp \
147    bionic/posix_fadvise.cpp \
148    bionic/posix_fallocate.cpp \
149    bionic/posix_timers.cpp \
150    bionic/pthread_atfork.cpp \
151    bionic/pthread_attr.cpp \
152    bionic/pthread_cond.cpp \
153    bionic/pthread_create.cpp \
154    bionic/pthread_detach.cpp \
155    bionic/pthread_equal.cpp \
156    bionic/pthread_exit.cpp \
157    bionic/pthread_getcpuclockid.cpp \
158    bionic/pthread_getschedparam.cpp \
159    bionic/pthread_internals.cpp \
160    bionic/pthread_join.cpp \
161    bionic/pthread_key.cpp \
162    bionic/pthread_kill.cpp \
163    bionic/pthread_mutex.cpp \
164    bionic/pthread_once.cpp \
165    bionic/pthread_rwlock.cpp \
166    bionic/pthread_self.cpp \
167    bionic/pthread_setname_np.cpp \
168    bionic/pthread_setschedparam.cpp \
169    bionic/pthread_sigmask.cpp \
170    bionic/ptrace.cpp \
171    bionic/pty.cpp \
172    bionic/raise.cpp \
173    bionic/rand.cpp \
174    bionic/readlink.cpp \
175    bionic/reboot.cpp \
176    bionic/recv.cpp \
177    bionic/rename.cpp \
178    bionic/rmdir.cpp \
179    bionic/scandir.cpp \
180    bionic/sched_getaffinity.cpp \
181    bionic/sched_getcpu.cpp \
182    bionic/send.cpp \
183    bionic/setegid.cpp \
184    bionic/__set_errno.cpp \
185    bionic/seteuid.cpp \
186    bionic/setpgrp.cpp \
187    bionic/sigaction.cpp \
188    bionic/sigaddset.cpp \
189    bionic/sigdelset.cpp \
190    bionic/sigemptyset.cpp \
191    bionic/sigfillset.cpp \
192    bionic/sigismember.cpp \
193    bionic/signal.cpp \
194    bionic/signalfd.cpp \
195    bionic/sigpending.cpp \
196    bionic/sigprocmask.cpp \
197    bionic/sigsuspend.cpp \
198    bionic/sigwait.cpp \
199    bionic/socket.cpp \
200    bionic/stat.cpp \
201    bionic/statvfs.cpp \
202    bionic/strcoll_l.cpp \
203    bionic/strerror.cpp \
204    bionic/strerror_r.cpp \
205    bionic/strftime_l.cpp \
206    bionic/strsignal.cpp \
207    bionic/strtold.cpp \
208    bionic/strtold_l.cpp \
209    bionic/strtoll_l.cpp \
210    bionic/strtoull_l.cpp \
211    bionic/strxfrm_l.cpp \
212    bionic/stubs.cpp \
213    bionic/symlink.cpp \
214    bionic/sysconf.cpp \
215    bionic/syslog.cpp \
216    bionic/sys_siglist.c \
217    bionic/sys_signame.c \
218    bionic/system_properties.cpp \
219    bionic/tdestroy.cpp \
220    bionic/termios.cpp \
221    bionic/thread_private.cpp \
222    bionic/tmpfile.cpp \
223    bionic/umount.cpp \
224    bionic/unlink.cpp \
225    bionic/utimes.cpp \
226    bionic/vdso.cpp \
227    bionic/wait.cpp \
228    bionic/wchar.cpp \
229    bionic/wctype.cpp \
230
231libc_cxa_src_files := \
232    bionic/__cxa_guard.cpp \
233    bionic/__cxa_pure_virtual.cpp \
234    bionic/new.cpp \
235
236libc_upstream_freebsd_src_files := \
237    upstream-freebsd/lib/libc/gen/ldexp.c \
238    upstream-freebsd/lib/libc/gen/sleep.c \
239    upstream-freebsd/lib/libc/gen/usleep.c \
240    upstream-freebsd/lib/libc/stdio/fclose.c \
241    upstream-freebsd/lib/libc/stdio/flags.c \
242    upstream-freebsd/lib/libc/stdio/fopen.c \
243    upstream-freebsd/lib/libc/stdlib/abs.c \
244    upstream-freebsd/lib/libc/stdlib/getopt_long.c \
245    upstream-freebsd/lib/libc/stdlib/imaxabs.c \
246    upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
247    upstream-freebsd/lib/libc/stdlib/labs.c \
248    upstream-freebsd/lib/libc/stdlib/llabs.c \
249    upstream-freebsd/lib/libc/stdlib/qsort.c \
250    upstream-freebsd/lib/libc/stdlib/quick_exit.c \
251    upstream-freebsd/lib/libc/stdlib/realpath.c \
252    upstream-freebsd/lib/libc/string/wcpcpy.c \
253    upstream-freebsd/lib/libc/string/wcpncpy.c \
254    upstream-freebsd/lib/libc/string/wcscasecmp.c \
255    upstream-freebsd/lib/libc/string/wcscspn.c \
256    upstream-freebsd/lib/libc/string/wcsdup.c \
257    upstream-freebsd/lib/libc/string/wcslcat.c \
258    upstream-freebsd/lib/libc/string/wcsncasecmp.c \
259    upstream-freebsd/lib/libc/string/wcsncat.c \
260    upstream-freebsd/lib/libc/string/wcsncmp.c \
261    upstream-freebsd/lib/libc/string/wcsncpy.c \
262    upstream-freebsd/lib/libc/string/wcsnlen.c \
263    upstream-freebsd/lib/libc/string/wcspbrk.c \
264    upstream-freebsd/lib/libc/string/wcsspn.c \
265    upstream-freebsd/lib/libc/string/wcstok.c \
266    upstream-freebsd/lib/libc/string/wmemchr.c \
267    upstream-freebsd/lib/libc/string/wmemcpy.c \
268    upstream-freebsd/lib/libc/string/wmemset.c \
269
270libc_upstream_netbsd_src_files := \
271    upstream-netbsd/common/lib/libc/stdlib/random.c \
272    upstream-netbsd/lib/libc/gen/ftw.c \
273    upstream-netbsd/lib/libc/gen/nftw.c \
274    upstream-netbsd/lib/libc/gen/nice.c \
275    upstream-netbsd/lib/libc/gen/popen.c \
276    upstream-netbsd/lib/libc/gen/psignal.c \
277    upstream-netbsd/lib/libc/gen/utime.c \
278    upstream-netbsd/lib/libc/gen/utmp.c \
279    upstream-netbsd/lib/libc/inet/nsap_addr.c \
280    upstream-netbsd/lib/libc/regex/regcomp.c \
281    upstream-netbsd/lib/libc/regex/regerror.c \
282    upstream-netbsd/lib/libc/regex/regexec.c \
283    upstream-netbsd/lib/libc/regex/regfree.c \
284    upstream-netbsd/lib/libc/stdlib/bsearch.c \
285    upstream-netbsd/lib/libc/stdlib/div.c \
286    upstream-netbsd/lib/libc/stdlib/drand48.c \
287    upstream-netbsd/lib/libc/stdlib/erand48.c \
288    upstream-netbsd/lib/libc/stdlib/insque.c \
289    upstream-netbsd/lib/libc/stdlib/jrand48.c \
290    upstream-netbsd/lib/libc/stdlib/ldiv.c \
291    upstream-netbsd/lib/libc/stdlib/lldiv.c \
292    upstream-netbsd/lib/libc/stdlib/lrand48.c \
293    upstream-netbsd/lib/libc/stdlib/mrand48.c \
294    upstream-netbsd/lib/libc/stdlib/nrand48.c \
295    upstream-netbsd/lib/libc/stdlib/_rand48.c \
296    upstream-netbsd/lib/libc/stdlib/rand_r.c \
297    upstream-netbsd/lib/libc/stdlib/remque.c \
298    upstream-netbsd/lib/libc/stdlib/seed48.c \
299    upstream-netbsd/lib/libc/stdlib/srand48.c \
300    upstream-netbsd/lib/libc/string/memccpy.c \
301    upstream-netbsd/lib/libc/string/strcasestr.c \
302    upstream-netbsd/lib/libc/string/strcoll.c \
303    upstream-netbsd/lib/libc/string/strxfrm.c \
304    upstream-netbsd/lib/libc/unistd/killpg.c \
305
306libc_upstream_openbsd_gdtoa_src_files := \
307    upstream-openbsd/android/gdtoa_support.cpp \
308    upstream-openbsd/lib/libc/gdtoa/dmisc.c \
309    upstream-openbsd/lib/libc/gdtoa/dtoa.c \
310    upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
311    upstream-openbsd/lib/libc/gdtoa/gethex.c \
312    upstream-openbsd/lib/libc/gdtoa/gmisc.c \
313    upstream-openbsd/lib/libc/gdtoa/hd_init.c \
314    upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
315    upstream-openbsd/lib/libc/gdtoa/hexnan.c \
316    upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
317    upstream-openbsd/lib/libc/gdtoa/misc.c \
318    upstream-openbsd/lib/libc/gdtoa/smisc.c \
319    upstream-openbsd/lib/libc/gdtoa/strtod.c \
320    upstream-openbsd/lib/libc/gdtoa/strtodg.c \
321    upstream-openbsd/lib/libc/gdtoa/strtof.c \
322    upstream-openbsd/lib/libc/gdtoa/strtord.c \
323    upstream-openbsd/lib/libc/gdtoa/sum.c \
324    upstream-openbsd/lib/libc/gdtoa/ulp.c \
325
326libc_upstream_openbsd_gdtoa_src_files_32 := \
327    $(libc_upstream_openbsd_gdtoa_src_files) \
328
329libc_upstream_openbsd_gdtoa_src_files_64 := \
330    $(libc_upstream_openbsd_gdtoa_src_files) \
331    upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
332
333libc_upstream_openbsd_src_files := \
334    upstream-openbsd/lib/libc/crypt/arc4random.c \
335    upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
336    upstream-openbsd/lib/libc/gen/alarm.c \
337    upstream-openbsd/lib/libc/gen/ctype_.c \
338    upstream-openbsd/lib/libc/gen/exec.c \
339    upstream-openbsd/lib/libc/gen/fnmatch.c \
340    upstream-openbsd/lib/libc/gen/ftok.c \
341    upstream-openbsd/lib/libc/gen/getprogname.c \
342    upstream-openbsd/lib/libc/gen/isctype.c \
343    upstream-openbsd/lib/libc/gen/setprogname.c \
344    upstream-openbsd/lib/libc/gen/time.c \
345    upstream-openbsd/lib/libc/gen/tolower_.c \
346    upstream-openbsd/lib/libc/gen/toupper_.c \
347    upstream-openbsd/lib/libc/locale/btowc.c \
348    upstream-openbsd/lib/libc/locale/mbrlen.c \
349    upstream-openbsd/lib/libc/locale/mbstowcs.c \
350    upstream-openbsd/lib/libc/locale/mbtowc.c \
351    upstream-openbsd/lib/libc/locale/wcscoll.c \
352    upstream-openbsd/lib/libc/locale/wcstod.c \
353    upstream-openbsd/lib/libc/locale/wcstof.c \
354    upstream-openbsd/lib/libc/locale/wcstoimax.c \
355    upstream-openbsd/lib/libc/locale/wcstol.c \
356    upstream-openbsd/lib/libc/locale/wcstold.c \
357    upstream-openbsd/lib/libc/locale/wcstoll.c \
358    upstream-openbsd/lib/libc/locale/wcstombs.c \
359    upstream-openbsd/lib/libc/locale/wcstoul.c \
360    upstream-openbsd/lib/libc/locale/wcstoull.c \
361    upstream-openbsd/lib/libc/locale/wcstoumax.c \
362    upstream-openbsd/lib/libc/locale/wcsxfrm.c \
363    upstream-openbsd/lib/libc/locale/wctob.c \
364    upstream-openbsd/lib/libc/locale/wctomb.c \
365    upstream-openbsd/lib/libc/net/htonl.c \
366    upstream-openbsd/lib/libc/net/htons.c \
367    upstream-openbsd/lib/libc/net/inet_addr.c \
368    upstream-openbsd/lib/libc/net/inet_lnaof.c \
369    upstream-openbsd/lib/libc/net/inet_makeaddr.c \
370    upstream-openbsd/lib/libc/net/inet_netof.c \
371    upstream-openbsd/lib/libc/net/inet_network.c \
372    upstream-openbsd/lib/libc/net/inet_ntoa.c \
373    upstream-openbsd/lib/libc/net/inet_ntop.c \
374    upstream-openbsd/lib/libc/net/inet_pton.c \
375    upstream-openbsd/lib/libc/net/ntohl.c \
376    upstream-openbsd/lib/libc/net/ntohs.c \
377    upstream-openbsd/lib/libc/stdio/asprintf.c \
378    upstream-openbsd/lib/libc/stdio/clrerr.c \
379    upstream-openbsd/lib/libc/stdio/dprintf.c \
380    upstream-openbsd/lib/libc/stdio/fdopen.c \
381    upstream-openbsd/lib/libc/stdio/feof.c \
382    upstream-openbsd/lib/libc/stdio/ferror.c \
383    upstream-openbsd/lib/libc/stdio/fflush.c \
384    upstream-openbsd/lib/libc/stdio/fgetc.c \
385    upstream-openbsd/lib/libc/stdio/fgetln.c \
386    upstream-openbsd/lib/libc/stdio/fgetpos.c \
387    upstream-openbsd/lib/libc/stdio/fgets.c \
388    upstream-openbsd/lib/libc/stdio/fgetwc.c \
389    upstream-openbsd/lib/libc/stdio/fgetws.c \
390    upstream-openbsd/lib/libc/stdio/fileno.c \
391    upstream-openbsd/lib/libc/stdio/findfp.c \
392    upstream-openbsd/lib/libc/stdio/fprintf.c \
393    upstream-openbsd/lib/libc/stdio/fpurge.c \
394    upstream-openbsd/lib/libc/stdio/fputc.c \
395    upstream-openbsd/lib/libc/stdio/fputs.c \
396    upstream-openbsd/lib/libc/stdio/fputwc.c \
397    upstream-openbsd/lib/libc/stdio/fputws.c \
398    upstream-openbsd/lib/libc/stdio/fread.c \
399    upstream-openbsd/lib/libc/stdio/freopen.c \
400    upstream-openbsd/lib/libc/stdio/fscanf.c \
401    upstream-openbsd/lib/libc/stdio/fseek.c \
402    upstream-openbsd/lib/libc/stdio/fsetpos.c \
403    upstream-openbsd/lib/libc/stdio/ftell.c \
404    upstream-openbsd/lib/libc/stdio/funopen.c \
405    upstream-openbsd/lib/libc/stdio/fvwrite.c \
406    upstream-openbsd/lib/libc/stdio/fwalk.c \
407    upstream-openbsd/lib/libc/stdio/fwide.c \
408    upstream-openbsd/lib/libc/stdio/fwprintf.c \
409    upstream-openbsd/lib/libc/stdio/fwrite.c \
410    upstream-openbsd/lib/libc/stdio/fwscanf.c \
411    upstream-openbsd/lib/libc/stdio/getc.c \
412    upstream-openbsd/lib/libc/stdio/getchar.c \
413    upstream-openbsd/lib/libc/stdio/getdelim.c \
414    upstream-openbsd/lib/libc/stdio/getline.c \
415    upstream-openbsd/lib/libc/stdio/gets.c \
416    upstream-openbsd/lib/libc/stdio/getwc.c \
417    upstream-openbsd/lib/libc/stdio/getwchar.c \
418    upstream-openbsd/lib/libc/stdio/makebuf.c \
419    upstream-openbsd/lib/libc/stdio/mktemp.c \
420    upstream-openbsd/lib/libc/stdio/perror.c \
421    upstream-openbsd/lib/libc/stdio/printf.c \
422    upstream-openbsd/lib/libc/stdio/putc.c \
423    upstream-openbsd/lib/libc/stdio/putchar.c \
424    upstream-openbsd/lib/libc/stdio/puts.c \
425    upstream-openbsd/lib/libc/stdio/putwc.c \
426    upstream-openbsd/lib/libc/stdio/putwchar.c \
427    upstream-openbsd/lib/libc/stdio/refill.c \
428    upstream-openbsd/lib/libc/stdio/remove.c \
429    upstream-openbsd/lib/libc/stdio/rewind.c \
430    upstream-openbsd/lib/libc/stdio/rget.c \
431    upstream-openbsd/lib/libc/stdio/scanf.c \
432    upstream-openbsd/lib/libc/stdio/setbuf.c \
433    upstream-openbsd/lib/libc/stdio/setbuffer.c \
434    upstream-openbsd/lib/libc/stdio/setvbuf.c \
435    upstream-openbsd/lib/libc/stdio/sscanf.c \
436    upstream-openbsd/lib/libc/stdio/stdio.c \
437    upstream-openbsd/lib/libc/stdio/swprintf.c \
438    upstream-openbsd/lib/libc/stdio/swscanf.c \
439    upstream-openbsd/lib/libc/stdio/tempnam.c \
440    upstream-openbsd/lib/libc/stdio/tmpnam.c \
441    upstream-openbsd/lib/libc/stdio/ungetc.c \
442    upstream-openbsd/lib/libc/stdio/ungetwc.c \
443    upstream-openbsd/lib/libc/stdio/vasprintf.c \
444    upstream-openbsd/lib/libc/stdio/vdprintf.c \
445    upstream-openbsd/lib/libc/stdio/vfprintf.c \
446    upstream-openbsd/lib/libc/stdio/vfscanf.c \
447    upstream-openbsd/lib/libc/stdio/vfwprintf.c \
448    upstream-openbsd/lib/libc/stdio/vfwscanf.c \
449    upstream-openbsd/lib/libc/stdio/vprintf.c \
450    upstream-openbsd/lib/libc/stdio/vscanf.c \
451    upstream-openbsd/lib/libc/stdio/vsnprintf.c \
452    upstream-openbsd/lib/libc/stdio/vsprintf.c \
453    upstream-openbsd/lib/libc/stdio/vsscanf.c \
454    upstream-openbsd/lib/libc/stdio/vswprintf.c \
455    upstream-openbsd/lib/libc/stdio/vswscanf.c \
456    upstream-openbsd/lib/libc/stdio/vwprintf.c \
457    upstream-openbsd/lib/libc/stdio/vwscanf.c \
458    upstream-openbsd/lib/libc/stdio/wbuf.c \
459    upstream-openbsd/lib/libc/stdio/wprintf.c \
460    upstream-openbsd/lib/libc/stdio/wscanf.c \
461    upstream-openbsd/lib/libc/stdio/wsetup.c \
462    upstream-openbsd/lib/libc/stdlib/atexit.c \
463    upstream-openbsd/lib/libc/stdlib/atoi.c \
464    upstream-openbsd/lib/libc/stdlib/atol.c \
465    upstream-openbsd/lib/libc/stdlib/atoll.c \
466    upstream-openbsd/lib/libc/stdlib/exit.c \
467    upstream-openbsd/lib/libc/stdlib/getenv.c \
468    upstream-openbsd/lib/libc/stdlib/lsearch.c \
469    upstream-openbsd/lib/libc/stdlib/setenv.c \
470    upstream-openbsd/lib/libc/stdlib/strtoimax.c \
471    upstream-openbsd/lib/libc/stdlib/strtol.c \
472    upstream-openbsd/lib/libc/stdlib/strtoll.c \
473    upstream-openbsd/lib/libc/stdlib/strtoul.c \
474    upstream-openbsd/lib/libc/stdlib/strtoull.c \
475    upstream-openbsd/lib/libc/stdlib/strtoumax.c \
476    upstream-openbsd/lib/libc/stdlib/system.c \
477    upstream-openbsd/lib/libc/stdlib/tfind.c \
478    upstream-openbsd/lib/libc/stdlib/tsearch.c \
479    upstream-openbsd/lib/libc/string/strcasecmp.c \
480    upstream-openbsd/lib/libc/string/strcspn.c \
481    upstream-openbsd/lib/libc/string/strdup.c \
482    upstream-openbsd/lib/libc/string/strndup.c \
483    upstream-openbsd/lib/libc/string/strpbrk.c \
484    upstream-openbsd/lib/libc/string/strsep.c \
485    upstream-openbsd/lib/libc/string/strspn.c \
486    upstream-openbsd/lib/libc/string/strstr.c \
487    upstream-openbsd/lib/libc/string/strtok.c \
488    upstream-openbsd/lib/libc/string/wcslcpy.c \
489    upstream-openbsd/lib/libc/string/wcsstr.c \
490    upstream-openbsd/lib/libc/string/wcswidth.c \
491
492libc_arch_static_src_files := \
493    bionic/dl_iterate_phdr_static.cpp \
494
495# Define some common cflags
496# ========================================================
497libc_common_cflags := \
498    -D_LIBC=1 \
499    -Wall -Wextra -Wunused \
500
501ifneq ($(TARGET_USES_LOGD),false)
502libc_common_cflags += -DTARGET_USES_LOGD
503endif
504
505use_clang := false
506
507# Try to catch typical 32-bit assumptions that break with 64-bit pointers.
508libc_common_cflags += \
509    -Werror=pointer-to-int-cast \
510    -Werror=int-to-pointer-cast \
511    -Werror=type-limits \
512    -Werror \
513
514ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
515  libc_common_cflags += -DDEBUG
516endif
517
518ifeq ($(MALLOC_IMPL),dlmalloc)
519  libc_common_cflags += -DUSE_DLMALLOC
520  libc_malloc_src := bionic/dlmalloc.c
521else
522  libc_common_cflags += -DUSE_JEMALLOC
523  libc_malloc_src := bionic/jemalloc_wrapper.cpp
524  libc_common_c_includes += external/jemalloc/include
525endif
526
527# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
528# the appropriate BoardConfig.mk file.
529#
530ifneq ($(BOARD_MALLOC_ALIGNMENT),)
531  libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
532endif
533
534# Define ANDROID_SMP appropriately.
535ifeq ($(TARGET_CPU_SMP),true)
536    libc_common_cflags += -DANDROID_SMP=1
537else
538    libc_common_cflags += -DANDROID_SMP=0
539endif
540
541# Define some common conlyflags
542libc_common_conlyflags := \
543    -std=gnu99
544
545# Define some common cppflags
546libc_common_cppflags := \
547    -std=gnu++11
548
549# Define some common includes
550# ========================================================
551libc_common_c_includes += \
552    $(LOCAL_PATH)/stdio   \
553
554# ========================================================
555# Add in the arch-specific flags.
556# Must be called with $(eval).
557# $(1): the LOCAL_ variable name
558# $(2): the bionic variable name to pull in
559define patch-up-arch-specific-flags
560$(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
561ifdef TARGET_2ND_ARCH
562$(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
563endif
564endef
565
566
567# ========================================================
568# libc_stack_protector.a - stack protector code
569# ========================================================
570#
571# The stack protector code needs to be compiled
572# with -fno-stack-protector, since it modifies the
573# stack canary.
574
575include $(CLEAR_VARS)
576
577LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
578LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
579LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
580LOCAL_CPPFLAGS := $(libc_common_cppflags)
581LOCAL_C_INCLUDES := $(libc_common_c_includes)
582LOCAL_MODULE := libc_stack_protector
583LOCAL_CLANG := $(use_clang)
584LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
585LOCAL_SYSTEM_SHARED_LIBRARIES :=
586
587$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
588include $(BUILD_STATIC_LIBRARY)
589
590
591# ========================================================
592# libc_tzcode.a - upstream 'tzcode' code
593# ========================================================
594
595include $(CLEAR_VARS)
596
597LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
598# tzcode doesn't include wcsftime, so we use the OpenBSD one.
599LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
600
601LOCAL_CFLAGS := $(libc_common_cflags) \
602    -fvisibility=hidden \
603
604# Don't use ridiculous amounts of stack.
605LOCAL_CFLAGS += -DALL_STATE
606# Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
607LOCAL_CFLAGS += -DSTD_INSPIRED
608# The name of the tm_gmtoff field in our struct tm.
609LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
610# Where we store our tzdata.
611LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
612# Include timezone and daylight globals.
613LOCAL_CFLAGS += -DUSG_COMPAT=1
614LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
615LOCAL_CFLAGS += -Dlint
616
617LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
618LOCAL_CPPFLAGS := $(libc_common_cppflags)
619LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
620LOCAL_MODULE := libc_tzcode
621LOCAL_CLANG := $(use_clang)
622LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
623LOCAL_SYSTEM_SHARED_LIBRARIES :=
624
625$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
626include $(BUILD_STATIC_LIBRARY)
627
628
629# ========================================================
630# libc_dns.a - modified NetBSD DNS code
631# ========================================================
632
633include $(CLEAR_VARS)
634
635LOCAL_SRC_FILES := \
636    $(call all-c-files-under,dns) \
637    upstream-netbsd/lib/libc/isc/ev_streams.c \
638    upstream-netbsd/lib/libc/isc/ev_timers.c \
639    upstream-netbsd/lib/libc/resolv/mtctxres.c \
640
641LOCAL_CFLAGS := \
642    $(libc_common_cflags) \
643    -DANDROID_CHANGES \
644    -DINET6 \
645    -fvisibility=hidden \
646    -Wno-unused-parameter \
647    -I$(LOCAL_PATH)/dns/include \
648    -I$(LOCAL_PATH)/private \
649    -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
650    -I$(LOCAL_PATH)/upstream-netbsd/android/include \
651    -include netbsd-compat.h \
652
653LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
654LOCAL_CPPFLAGS := $(libc_common_cppflags)
655LOCAL_C_INCLUDES := $(libc_common_c_includes)
656LOCAL_MODULE := libc_dns
657LOCAL_CLANG := $(use_clang)
658LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
659LOCAL_SYSTEM_SHARED_LIBRARIES :=
660
661$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
662include $(BUILD_STATIC_LIBRARY)
663
664
665# ========================================================
666# libc_freebsd.a - upstream FreeBSD C library code
667# ========================================================
668#
669# These files are built with the freebsd-compat.h header file
670# automatically included.
671
672include $(CLEAR_VARS)
673
674LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
675LOCAL_CFLAGS := \
676    $(libc_common_cflags) \
677    -Wno-sign-compare -Wno-uninitialized \
678    -I$(LOCAL_PATH)/upstream-freebsd/android/include \
679    -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
680    -include freebsd-compat.h \
681
682LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
683LOCAL_CPPFLAGS := $(libc_common_cppflags)
684LOCAL_C_INCLUDES := $(libc_common_c_includes)
685LOCAL_MODULE := libc_freebsd
686LOCAL_CLANG := $(use_clang)
687LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
688LOCAL_SYSTEM_SHARED_LIBRARIES :=
689
690$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
691include $(BUILD_STATIC_LIBRARY)
692
693
694# ========================================================
695# libc_netbsd.a - upstream NetBSD C library code
696# ========================================================
697#
698# These files are built with the netbsd-compat.h header file
699# automatically included.
700
701include $(CLEAR_VARS)
702
703LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
704LOCAL_CFLAGS := \
705    $(libc_common_cflags) \
706    -Wno-sign-compare -Wno-uninitialized \
707    -DPOSIX_MISTAKE \
708    -I$(LOCAL_PATH)/upstream-netbsd/android/include \
709    -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
710    -include netbsd-compat.h \
711
712LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
713LOCAL_CPPFLAGS := $(libc_common_cppflags)
714LOCAL_C_INCLUDES := $(libc_common_c_includes)
715LOCAL_MODULE := libc_netbsd
716LOCAL_CLANG := $(use_clang)
717LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
718LOCAL_SYSTEM_SHARED_LIBRARIES :=
719
720$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
721$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
722include $(BUILD_STATIC_LIBRARY)
723
724
725# ========================================================
726# libc_openbsd.a - upstream OpenBSD C library code
727# ========================================================
728#
729# These files are built with the openbsd-compat.h header file
730# automatically included.
731
732include $(CLEAR_VARS)
733
734LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
735LOCAL_CFLAGS := \
736    $(libc_common_cflags) \
737    -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
738    -I$(LOCAL_PATH)/private \
739    -I$(LOCAL_PATH)/upstream-openbsd/android/include \
740    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
741    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
742    -include openbsd-compat.h \
743
744LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
745LOCAL_CPPFLAGS := $(libc_common_cppflags)
746LOCAL_C_INCLUDES := $(libc_common_c_includes)
747LOCAL_MODULE := libc_openbsd
748LOCAL_CLANG := $(use_clang)
749LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
750LOCAL_SYSTEM_SHARED_LIBRARIES :=
751
752$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
753include $(BUILD_STATIC_LIBRARY)
754
755
756# ========================================================
757# libc_gdtoa.a - upstream OpenBSD C library gdtoa code
758# ========================================================
759#
760# These files are built with the openbsd-compat.h header file
761# automatically included.
762
763include $(CLEAR_VARS)
764
765LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
766LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
767LOCAL_CFLAGS := \
768    $(libc_common_cflags) \
769    -Wno-sign-compare -Wno-uninitialized \
770    -fvisibility=hidden \
771    -I$(LOCAL_PATH)/private \
772    -I$(LOCAL_PATH)/upstream-openbsd/android/include \
773    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
774    -include openbsd-compat.h \
775
776LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
777LOCAL_CPPFLAGS := $(libc_common_cppflags)
778LOCAL_C_INCLUDES := $(libc_common_c_includes)
779LOCAL_MODULE := libc_gdtoa
780LOCAL_CLANG := $(use_clang)
781LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
782LOCAL_SYSTEM_SHARED_LIBRARIES :=
783
784$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
785include $(BUILD_STATIC_LIBRARY)
786
787
788# ========================================================
789# libc_bionic.a - home-grown C library code
790# ========================================================
791
792include $(CLEAR_VARS)
793
794LOCAL_SRC_FILES := $(libc_bionic_src_files)
795LOCAL_CFLAGS := $(libc_common_cflags) \
796    -Wframe-larger-than=2048 \
797
798LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
799LOCAL_CPPFLAGS := $(libc_common_cppflags)
800LOCAL_C_INCLUDES := $(libc_common_c_includes)
801LOCAL_MODULE := libc_bionic
802LOCAL_CLANG := $(use_clang)
803LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
804LOCAL_SYSTEM_SHARED_LIBRARIES :=
805
806$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
807$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
808include $(BUILD_STATIC_LIBRARY)
809
810
811# ========================================================
812# libc_cxa.a - Things traditionally in libstdc++
813# ========================================================
814
815include $(CLEAR_VARS)
816
817LOCAL_SRC_FILES := $(libc_cxa_src_files)
818LOCAL_CFLAGS := $(libc_common_cflags) \
819    -fvisibility=hidden \
820
821LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
822LOCAL_CPPFLAGS := $(libc_common_cppflags)
823LOCAL_C_INCLUDES := $(libc_common_c_includes)
824LOCAL_MODULE := libc_cxa
825# GCC refuses to hide new/delete
826LOCAL_CLANG := true
827LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
828LOCAL_SYSTEM_SHARED_LIBRARIES :=
829
830include $(BUILD_STATIC_LIBRARY)
831
832
833# ========================================================
834# libc_syscalls.a
835# ========================================================
836
837include $(CLEAR_VARS)
838
839LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
840ifdef TARGET_2ND_ARCH
841LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
842endif
843LOCAL_MODULE := libc_syscalls
844LOCAL_CLANG := $(use_clang)
845LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
846LOCAL_SYSTEM_SHARED_LIBRARIES :=
847
848include $(BUILD_STATIC_LIBRARY)
849
850
851# ========================================================
852# libc_aeabi.a
853# This is an LP32 ARM-only library that needs to be built with -fno-builtin
854# to avoid infinite recursion. For the other architectures we just build an
855# empty library to keep this makefile simple.
856# ========================================================
857
858include $(CLEAR_VARS)
859
860LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
861LOCAL_MODULE := libc_aeabi
862LOCAL_CLANG := $(use_clang)
863LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
864LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
865LOCAL_SYSTEM_SHARED_LIBRARIES :=
866
867include $(BUILD_STATIC_LIBRARY)
868
869# ========================================================
870# libc_common.a
871# ========================================================
872
873include $(CLEAR_VARS)
874
875LOCAL_SRC_FILES := $(libc_common_src_files)
876LOCAL_CFLAGS := $(libc_common_cflags)
877LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
878LOCAL_CPPFLAGS := $(libc_common_cppflags)
879LOCAL_C_INCLUDES := $(libc_common_c_includes)
880LOCAL_MODULE := libc_common
881LOCAL_CLANG := $(use_clang)
882LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
883LOCAL_WHOLE_STATIC_LIBRARIES := \
884    libc_bionic \
885    libc_cxa \
886    libc_dns \
887    libc_freebsd \
888    libc_gdtoa \
889    libc_malloc \
890    libc_netbsd \
891    libc_openbsd \
892    libc_stack_protector \
893    libc_syscalls \
894    libc_tzcode \
895
896LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
897
898ifneq ($(MALLOC_IMPL),dlmalloc)
899LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
900endif
901
902LOCAL_SYSTEM_SHARED_LIBRARIES :=
903
904# TODO: split out the asflags.
905LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
906
907$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
908$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
909$(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
910include $(BUILD_STATIC_LIBRARY)
911
912
913# ========================================================
914# libc_nomalloc.a
915# ========================================================
916#
917# This is a version of the static C library that does not
918# include malloc. It's useful in situations when the user wants
919# to provide their own malloc implementation, or wants to
920# explicitly disallow the use of malloc, such as in the
921# dynamic linker.
922
923include $(CLEAR_VARS)
924
925LOCAL_SRC_FILES := \
926    $(libc_arch_static_src_files) \
927    $(libc_static_common_src_files) \
928    bionic/libc_init_static.cpp
929
930LOCAL_C_INCLUDES := $(libc_common_c_includes)
931LOCAL_CFLAGS := $(libc_common_cflags) \
932    -DLIBC_STATIC \
933
934LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
935LOCAL_CPPFLAGS := $(libc_common_cppflags)
936
937LOCAL_MODULE := libc_nomalloc
938LOCAL_CLANG := $(use_clang)
939LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
940LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
941LOCAL_SYSTEM_SHARED_LIBRARIES :=
942
943$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
944$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
945include $(BUILD_STATIC_LIBRARY)
946
947
948# ========================================================
949# libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
950# ========================================================
951
952include $(CLEAR_VARS)
953LOCAL_SRC_FILES := $(libc_malloc_src)
954LOCAL_CFLAGS := $(libc_common_cflags) \
955    -fvisibility=hidden \
956
957LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
958LOCAL_CPPFLAGS := $(libc_common_cppflags)
959LOCAL_C_INCLUDES := $(libc_common_c_includes)
960LOCAL_MODULE := libc_malloc
961LOCAL_CLANG := $(use_clang)
962LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
963include $(BUILD_STATIC_LIBRARY)
964
965
966# ========================================================
967# libc.a
968# ========================================================
969include $(CLEAR_VARS)
970
971LOCAL_SRC_FILES := \
972    $(libc_arch_static_src_files) \
973    $(libc_static_common_src_files) \
974    bionic/malloc_debug_common.cpp \
975    bionic/libc_init_static.cpp \
976
977LOCAL_CFLAGS := $(libc_common_cflags) \
978    -DLIBC_STATIC \
979
980LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
981LOCAL_CPPFLAGS := $(libc_common_cppflags)
982LOCAL_C_INCLUDES := $(libc_common_c_includes)
983LOCAL_MODULE := libc
984LOCAL_CLANG := $(use_clang)
985LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
986LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
987LOCAL_SYSTEM_SHARED_LIBRARIES :=
988
989$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
990$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
991include $(BUILD_STATIC_LIBRARY)
992
993
994# ========================================================
995# libc.so
996# ========================================================
997include $(CLEAR_VARS)
998
999LOCAL_CFLAGS := $(libc_common_cflags)
1000LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1001LOCAL_CPPFLAGS := $(libc_common_cppflags)
1002LOCAL_C_INCLUDES := $(libc_common_c_includes)
1003LOCAL_SRC_FILES := \
1004    $(libc_arch_dynamic_src_files) \
1005    $(libc_static_common_src_files) \
1006    bionic/malloc_debug_common.cpp \
1007    bionic/libc_init_dynamic.cpp \
1008    bionic/NetdClient.cpp \
1009
1010LOCAL_MODULE := libc
1011LOCAL_CLANG := $(use_clang)
1012LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1013LOCAL_REQUIRED_MODULES := tzdata
1014
1015# Leave the symbols in the shared library so that stack unwinders can produce
1016# meaningful name resolution.
1017LOCAL_STRIP_MODULE := keep_symbols
1018
1019# WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
1020# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
1021# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1022# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1023# should, instead relying on the external symbols from the dependent libraries.  That would
1024# create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
1025# you wanted!
1026
1027LOCAL_SHARED_LIBRARIES := libdl
1028LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1029LOCAL_SYSTEM_SHARED_LIBRARIES :=
1030
1031# We'd really like to do this for all architectures, but since this wasn't done
1032# before, these symbols must continue to be exported on LP32 for binary
1033# compatibility.
1034LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
1035LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
1036LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
1037
1038$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1039$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1040$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
1041# special for arm
1042LOCAL_NO_CRT_arm := true
1043LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1044LOCAL_SRC_FILES_arm += \
1045    arch-common/bionic/crtbegin_so.c \
1046    arch-arm/bionic/atexit_legacy.c \
1047    arch-common/bionic/crtend_so.S
1048
1049include $(BUILD_SHARED_LIBRARY)
1050
1051
1052# For all builds, except for the -user build we will enable memory
1053# allocation checking (including memory leaks, buffer overwrites, etc.)
1054# Note that all these checks are also controlled by env. settings
1055# that can enable, or disable specific checks. Note also that some of
1056# the checks are available only in emulator and are implemeted in
1057# libc_malloc_qemu_instrumented.so.
1058ifneq ($(TARGET_BUILD_VARIANT),user)
1059
1060# ========================================================
1061# libc_malloc_debug_leak.so
1062# ========================================================
1063include $(CLEAR_VARS)
1064
1065LOCAL_CFLAGS := \
1066    $(libc_common_cflags) \
1067    -DMALLOC_LEAK_CHECK \
1068
1069LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1070LOCAL_CPPFLAGS := $(libc_common_cppflags)
1071
1072# Make sure that unwind.h comes from libunwind.
1073LOCAL_C_INCLUDES := \
1074    $(libc_common_c_includes) \
1075
1076LOCAL_SRC_FILES := \
1077    bionic/debug_mapinfo.cpp \
1078    bionic/debug_stacktrace.cpp \
1079    bionic/libc_logging.cpp \
1080    bionic/malloc_debug_leak.cpp \
1081    bionic/malloc_debug_check.cpp \
1082
1083LOCAL_MODULE := libc_malloc_debug_leak
1084LOCAL_CLANG := $(use_clang)
1085LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1086
1087LOCAL_SHARED_LIBRARIES := libc libdl
1088LOCAL_SYSTEM_SHARED_LIBRARIES :=
1089# Only need this for arm since libc++ uses its own unwind code that
1090# doesn't mix with the other default unwind code.
1091LOCAL_STATIC_LIBRARIES_arm := libc++
1092LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
1093
1094# Don't install on release build
1095LOCAL_MODULE_TAGS := eng debug
1096
1097$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1098include $(BUILD_SHARED_LIBRARY)
1099
1100
1101# ========================================================
1102# libc_malloc_debug_qemu.so
1103# ========================================================
1104include $(CLEAR_VARS)
1105
1106LOCAL_CFLAGS := \
1107    $(libc_common_cflags) \
1108    -DMALLOC_QEMU_INSTRUMENT \
1109
1110LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1111LOCAL_CPPFLAGS := $(libc_common_cppflags)
1112
1113LOCAL_C_INCLUDES := $(libc_common_c_includes)
1114
1115LOCAL_SRC_FILES := \
1116    bionic/libc_logging.cpp \
1117    bionic/malloc_debug_qemu.cpp \
1118
1119LOCAL_MODULE := libc_malloc_debug_qemu
1120LOCAL_CLANG := $(use_clang)
1121LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1122
1123LOCAL_SHARED_LIBRARIES := libc libdl
1124LOCAL_SYSTEM_SHARED_LIBRARIES :=
1125
1126# Don't install on release build
1127LOCAL_MODULE_TAGS := eng debug
1128
1129$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1130include $(BUILD_SHARED_LIBRARY)
1131
1132endif  #!user
1133
1134# ========================================================
1135# libstdc++.so
1136# ========================================================
1137libstdcxx_common_src_files := \
1138    bionic/__cxa_guard.cpp \
1139    bionic/__cxa_pure_virtual.cpp \
1140    bionic/new.cpp \
1141    bionic/libc_logging.cpp \
1142
1143include $(CLEAR_VARS)
1144LOCAL_C_INCLUDES := $(libc_common_c_includes)
1145LOCAL_CFLAGS := $(libc_common_cflags)
1146LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1147LOCAL_MODULE:= libstdc++
1148LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1149LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1150include $(BUILD_SHARED_LIBRARY)
1151
1152# ========================================================
1153# libstdc++.a
1154# ========================================================
1155include $(CLEAR_VARS)
1156LOCAL_C_INCLUDES := $(libc_common_c_includes)
1157LOCAL_CFLAGS := $(libc_common_cflags)
1158LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1159LOCAL_MODULE:= libstdc++
1160LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1161LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1162include $(BUILD_STATIC_LIBRARY)
1163
1164
1165# ========================================================
1166include $(call all-makefiles-under,$(LOCAL_PATH))
1167