Android.mk revision 9d40326830c2bd407427889c554adeb915ee6b4a
1LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
4
5# Define the common source files for all the libc instances
6# =========================================================
7libc_common_src_files := \
8	$(syscall_src) \
9	unistd/abort.c \
10	unistd/alarm.c \
11	unistd/brk.c \
12	unistd/creat.c \
13	unistd/daemon.c \
14	unistd/eventfd.c \
15	unistd/exec.c \
16	unistd/fcntl.c \
17	unistd/fnmatch.c \
18	unistd/fstatfs.c \
19	unistd/ftime.c \
20	unistd/ftok.c \
21	unistd/getcwd.c \
22	unistd/getdtablesize.c \
23	unistd/gethostname.c \
24	unistd/getopt_long.c \
25	unistd/getpgrp.c \
26	unistd/getpriority.c \
27	unistd/getpt.c \
28	unistd/initgroups.c \
29	unistd/isatty.c \
30	unistd/issetugid.c \
31	unistd/killpg.c \
32	unistd/lseek64.c \
33	unistd/mmap.c \
34	unistd/nice.c \
35	unistd/open.c \
36	unistd/openat.c \
37	unistd/opendir.c \
38	unistd/pathconf.c \
39	unistd/perror.c \
40	unistd/popen.c \
41	unistd/pread.c \
42	unistd/pselect.c \
43	unistd/ptsname.c \
44	unistd/ptsname_r.c \
45	unistd/pwrite.c \
46	unistd/raise.c \
47	unistd/reboot.c \
48	unistd/recv.c \
49	unistd/sbrk.c \
50	unistd/send.c \
51	unistd/setegid.c \
52	unistd/setuid.c \
53	unistd/seteuid.c \
54	unistd/setreuid.c \
55	unistd/setresuid.c \
56	unistd/setpgrp.c \
57	unistd/sigblock.c \
58	unistd/siginterrupt.c \
59	unistd/siglist.c \
60	unistd/signal.c \
61	unistd/signame.c \
62	unistd/sigsetmask.c \
63	unistd/sigsuspend.c \
64	unistd/sigwait.c \
65	unistd/sleep.c \
66	unistd/statfs.c \
67	unistd/strsignal.c \
68	unistd/syslog.c \
69	unistd/system.c \
70	unistd/tcgetpgrp.c \
71	unistd/tcsetpgrp.c \
72	unistd/time.c \
73	unistd/umount.c \
74	unistd/unlockpt.c \
75	unistd/usleep.c \
76	unistd/wait.c \
77	stdio/asprintf.c \
78	stdio/clrerr.c \
79	stdio/fclose.c \
80	stdio/fdopen.c \
81	stdio/feof.c \
82	stdio/ferror.c \
83	stdio/fflush.c \
84	stdio/fgetc.c \
85	stdio/fgetln.c \
86	stdio/fgetpos.c \
87	stdio/fgets.c \
88	stdio/fileno.c \
89	stdio/findfp.c \
90	stdio/flags.c \
91	stdio/flockfile.c \
92	stdio/fopen.c \
93	stdio/fprintf.c \
94	stdio/fpurge.c \
95	stdio/fputc.c \
96	stdio/fputs.c \
97	stdio/fread.c \
98	stdio/freopen.c \
99	stdio/fscanf.c \
100	stdio/fseek.c \
101	stdio/fsetpos.c \
102	stdio/ftell.c \
103	stdio/funopen.c \
104	stdio/fvwrite.c \
105	stdio/fwalk.c \
106	stdio/fwrite.c \
107	stdio/getc.c \
108	stdio/getchar.c \
109	stdio/gets.c \
110	stdio/makebuf.c \
111	stdio/mktemp.c \
112	stdio/printf.c \
113	stdio/putc.c \
114	stdio/putchar.c \
115	stdio/puts.c \
116	stdio/putw.c \
117	stdio/refill.c \
118	stdio/remove.c \
119	stdio/rewind.c \
120	stdio/rget.c \
121	stdio/scanf.c \
122	stdio/setbuf.c \
123	stdio/setbuffer.c \
124	stdio/setvbuf.c \
125	stdio/snprintf.c\
126	stdio/sprintf.c \
127	stdio/sscanf.c \
128	stdio/stdio.c \
129	stdio/tempnam.c \
130	stdio/tmpfile.c \
131	stdio/tmpnam.c \
132	stdio/ungetc.c \
133	stdio/vasprintf.c \
134	stdio/vfprintf.c \
135	stdio/vfscanf.c \
136	stdio/vprintf.c \
137	stdio/vsnprintf.c \
138	stdio/vsprintf.c \
139	stdio/vscanf.c \
140	stdio/vsscanf.c \
141	stdio/wbuf.c \
142	stdio/wsetup.c \
143	stdlib/_rand48.c \
144	stdlib/assert.c \
145	stdlib/atexit.c \
146	stdlib/atoi.c \
147	stdlib/atol.c \
148	stdlib/atoll.c \
149	stdlib/bsearch.c \
150	stdlib/ctype_.c \
151	stdlib/div.c \
152	stdlib/exit.c \
153	stdlib/getenv.c \
154	stdlib/jrand48.c \
155	stdlib/ldiv.c \
156	stdlib/lldiv.c \
157	stdlib/locale.c \
158	stdlib/lrand48.c \
159	stdlib/mrand48.c \
160	stdlib/nrand48.c \
161	stdlib/putenv.c \
162	stdlib/qsort.c \
163	stdlib/seed48.c \
164	stdlib/setenv.c \
165	stdlib/setjmperr.c \
166	stdlib/srand48.c \
167	stdlib/strntoimax.c \
168	stdlib/strntoumax.c \
169	stdlib/strtod.c \
170	stdlib/strtoimax.c \
171	stdlib/strtol.c \
172	stdlib/strtoll.c \
173	stdlib/strtoul.c \
174	stdlib/strtoull.c \
175	stdlib/strtoumax.c \
176	stdlib/tolower_.c \
177	stdlib/toupper_.c \
178	stdlib/wchar.c \
179	string/index.c \
180	string/memccpy.c \
181	string/memchr.c \
182	string/memmem.c \
183	string/memrchr.c \
184	string/memswap.c \
185	string/strcasecmp.c \
186	string/strcasestr.c \
187	string/strcat.c \
188	string/strchr.c \
189	string/strcoll.c \
190	string/strcspn.c \
191	string/strdup.c \
192	string/strerror.c \
193	string/strerror_r.c \
194	string/strlcat.c \
195	string/strlcpy.c \
196	string/strncat.c \
197	string/strncpy.c \
198	string/strndup.c \
199	string/strnlen.c \
200	string/strpbrk.c \
201	string/strrchr.c \
202	string/strsep.c \
203	string/strspn.c \
204	string/strstr.c \
205	string/strtok.c \
206	string/strtotimeval.c \
207	string/strxfrm.c \
208	wchar/wcpcpy.c \
209	wchar/wcpncpy.c \
210	wchar/wcscasecmp.c \
211	wchar/wcscat.c \
212	wchar/wcschr.c \
213	wchar/wcscmp.c \
214	wchar/wcscoll.c \
215	wchar/wcscpy.c \
216	wchar/wcscspn.c \
217	wchar/wcsdup.c \
218	wchar/wcslcat.c \
219	wchar/wcslcpy.c \
220	wchar/wcslen.c \
221	wchar/wcsncasecmp.c \
222	wchar/wcsncat.c \
223	wchar/wcsncmp.c \
224	wchar/wcsncpy.c \
225	wchar/wcsnlen.c \
226	wchar/wcspbrk.c \
227	wchar/wcsrchr.c \
228	wchar/wcsspn.c \
229	wchar/wcsstr.c \
230	wchar/wcstok.c \
231	wchar/wcswidth.c \
232	wchar/wcsxfrm.c \
233	wchar/wmemchr.c \
234	wchar/wmemcmp.c \
235	wchar/wmemcpy.c \
236	wchar/wmemmove.c \
237	wchar/wmemset.c \
238	inet/bindresvport.c \
239	inet/inet_addr.c \
240	inet/inet_aton.c \
241	inet/inet_ntoa.c \
242	inet/inet_ntop.c \
243	inet/inet_pton.c \
244	inet/ether_aton.c \
245	inet/ether_ntoa.c \
246	tzcode/asctime.c \
247	tzcode/difftime.c \
248	tzcode/localtime.c \
249	tzcode/strftime.c \
250	tzcode/strptime.c \
251	bionic/__set_errno.c \
252	bionic/cpuacct.c \
253	bionic/arc4random.c \
254	bionic/basename.c \
255	bionic/basename_r.c \
256	bionic/clearenv.c \
257	bionic/dirname.c \
258	bionic/dirname_r.c \
259	bionic/drand48.c \
260	bionic/erand48.c \
261	bionic/err.c \
262	bionic/fdprintf.c \
263	bionic/fork.c \
264	bionic/fts.c \
265	bionic/if_nametoindex.c \
266	bionic/if_indextoname.c \
267	bionic/ioctl.c \
268	bionic/ldexp.c \
269	bionic/libc_init_common.c \
270	bionic/logd_write.c \
271	bionic/md5.c \
272	bionic/memmove_words.c \
273	bionic/pututline.c \
274	bionic/realpath.c \
275	bionic/sched_getaffinity.c \
276	bionic/sched_getcpu.c \
277	bionic/sched_cpualloc.c \
278	bionic/sched_cpucount.c \
279	bionic/semaphore.c \
280	bionic/sha1.c \
281	bionic/ssp.c \
282	bionic/stubs.c \
283	bionic/system_properties.c \
284	bionic/tdelete.c \
285	bionic/tdestroy.c \
286	bionic/time64.c \
287	bionic/tfind.c \
288	bionic/thread_atexit.c \
289	bionic/tsearch.c \
290	bionic/utime.c \
291	bionic/utmp.c \
292	netbsd/gethnamaddr.c \
293	netbsd/isc/ev_timers.c \
294	netbsd/isc/ev_streams.c \
295	netbsd/inet/nsap_addr.c \
296	netbsd/resolv/__dn_comp.c \
297	netbsd/resolv/__res_close.c \
298	netbsd/resolv/__res_send.c \
299	netbsd/resolv/herror.c \
300	netbsd/resolv/res_comp.c \
301	netbsd/resolv/res_data.c \
302	netbsd/resolv/res_debug.c \
303	netbsd/resolv/res_init.c \
304	netbsd/resolv/res_mkquery.c \
305	netbsd/resolv/res_query.c \
306	netbsd/resolv/res_send.c \
307	netbsd/resolv/res_state.c \
308	netbsd/resolv/res_cache.c \
309	netbsd/net/nsdispatch.c \
310	netbsd/net/getaddrinfo.c \
311	netbsd/net/getnameinfo.c \
312	netbsd/net/getservbyname.c \
313	netbsd/net/getservent.c \
314	netbsd/net/base64.c \
315	netbsd/net/getservbyport.c \
316	netbsd/nameser/ns_name.c \
317	netbsd/nameser/ns_parse.c \
318	netbsd/nameser/ns_ttl.c \
319	netbsd/nameser/ns_netint.c \
320	netbsd/nameser/ns_print.c \
321	netbsd/nameser/ns_samedomain.c \
322	regex/regcomp.c \
323	regex/regerror.c \
324	regex/regexec.c \
325	regex/regfree.c \
326
327# The following files are common, but must be compiled
328# with different C flags when building a static C library.
329#
330# The reason for this is the implementation of __get_tls()
331# that will differ between the shared and static versions
332# of the library.
333#
334# See comments in private/bionic_tls.h for more details.
335#
336# NOTE: bionic/pthread.c is added later to this list
337#       because it needs special handling on ARM, see
338#       below.
339#
340libc_static_common_src_files := \
341        unistd/sysconf.c \
342        bionic/__errno.c \
343
344# Architecture specific source files go here
345# =========================================================
346ifeq ($(TARGET_ARCH),arm)
347libc_common_src_files += \
348	bionic/bionic_clone.c \
349	arch-arm/bionic/__get_pc.S \
350	arch-arm/bionic/__get_sp.S \
351	arch-arm/bionic/_exit_with_stack_teardown.S \
352	arch-arm/bionic/_setjmp.S \
353	arch-arm/bionic/abort_arm.S \
354	arch-arm/bionic/atomics_arm.c \
355	arch-arm/bionic/clone.S \
356	arch-arm/bionic/eabi.c \
357	arch-arm/bionic/ffs.S \
358	arch-arm/bionic/futex_arm.S \
359	arch-arm/bionic/kill.S \
360	arch-arm/bionic/libgcc_compat.c \
361	arch-arm/bionic/tkill.S \
362	arch-arm/bionic/tgkill.S \
363	arch-arm/bionic/memcmp.S \
364	arch-arm/bionic/memcmp16.S \
365	arch-arm/bionic/memcpy.S \
366	arch-arm/bionic/memset.S \
367	arch-arm/bionic/setjmp.S \
368	arch-arm/bionic/sigsetjmp.S \
369	arch-arm/bionic/strlen.c.arm \
370	arch-arm/bionic/strcpy.S \
371	arch-arm/bionic/strcmp.S \
372	arch-arm/bionic/syscall.S \
373	string/memmove.c.arm \
374	string/bcopy.c \
375	string/strncmp.c \
376	unistd/socketcalls.c
377
378# These files need to be arm so that gdbserver
379# can set breakpoints in them without messing
380# up any thumb code.
381libc_common_src_files += \
382	bionic/pthread-atfork.c.arm \
383	bionic/pthread-rwlocks.c.arm \
384	bionic/pthread-timers.c.arm \
385	bionic/ptrace.c.arm
386
387libc_static_common_src_files += \
388        bionic/pthread.c.arm \
389
390# these are used by the static and dynamic versions of the libc
391# respectively
392libc_arch_static_src_files := \
393	arch-arm/bionic/exidx_static.c
394
395libc_arch_dynamic_src_files := \
396	arch-arm/bionic/exidx_dynamic.c
397else # !arm
398
399ifeq ($(TARGET_ARCH),x86)
400libc_common_src_files += \
401	arch-x86/bionic/__get_sp.S \
402	arch-x86/bionic/__get_tls.c \
403	arch-x86/bionic/__set_tls.c \
404	arch-x86/bionic/clone.S \
405	arch-x86/bionic/_exit_with_stack_teardown.S \
406	arch-x86/bionic/futex_x86.S \
407	arch-x86/bionic/setjmp.S \
408	arch-x86/bionic/_setjmp.S \
409	arch-x86/bionic/sigsetjmp.S \
410	arch-x86/bionic/vfork.S \
411	arch-x86/bionic/syscall.S \
412	arch-x86/string/bcopy_wrapper.S \
413	arch-x86/string/memcpy_wrapper.S \
414	arch-x86/string/memmove_wrapper.S \
415	arch-x86/string/bzero_wrapper.S \
416	arch-x86/string/memcmp_wrapper.S \
417	arch-x86/string/memset_wrapper.S \
418	arch-x86/string/strcmp_wrapper.S \
419	arch-x86/string/strncmp_wrapper.S \
420	arch-x86/string/strlen_wrapper.S \
421	string/strcpy.c \
422	bionic/pthread-atfork.c \
423	bionic/pthread-rwlocks.c \
424	bionic/pthread-timers.c \
425	bionic/ptrace.c
426
427libc_static_common_src_files += \
428        bionic/pthread.c \
429
430# this is needed for static versions of libc
431libc_arch_static_src_files := \
432	arch-x86/bionic/dl_iterate_phdr_static.c
433
434libc_arch_dynamic_src_files :=
435else # !x86
436
437endif # !x86
438endif # !arm
439
440# Define some common cflags
441# ========================================================
442libc_common_cflags := \
443		-DWITH_ERRLIST			\
444		-DANDROID_CHANGES		\
445		-DUSE_LOCKS 			\
446		-DREALLOC_ZERO_BYTES_FREES 	\
447		-D_LIBC=1 			\
448		-DSOFTFLOAT                     \
449		-DFLOATING_POINT		\
450		-DINET6 \
451		-I$(LOCAL_PATH)/private \
452		-DUSE_DL_PREFIX \
453		-DPOSIX_MISTAKE \
454                -DLOG_ON_HEAP_ERROR \
455
456# these macro definitions are required to implement the
457# 'timezone' and 'daylight' global variables, as well as
458# properly update the 'tm_gmtoff' field in 'struct tm'.
459#
460libc_common_cflags += \
461    -DTM_GMTOFF=tm_gmtoff \
462    -DUSG_COMPAT=1
463
464ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
465  libc_common_cflags += -DDEBUG
466endif
467
468# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
469# the appropriate BoardConfig.mk file.
470#
471ifneq ($(BOARD_MALLOC_ALIGNMENT),)
472  libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
473endif
474
475ifeq ($(TARGET_ARCH),arm)
476  libc_common_cflags += -fstrict-aliasing
477  libc_crt_target_cflags := -mthumb-interwork
478  #
479  # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
480  # that it should access the hardware TLS register directly in
481  # private/bionic_tls.h
482  #
483  # The value must match your kernel configuration
484  #
485  ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
486    libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
487  endif
488  #
489  # Define HAVE_32_BYTE_CACHE_LINES to indicate to C
490  # library it should use to 32-byte version of memcpy, and not
491  # the 64-byte version.
492  #
493  ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
494    libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
495  endif
496  ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
497    libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
498  endif
499else # !arm
500  ifeq ($(TARGET_ARCH),x86)
501    libc_crt_target_cflags :=
502    ifeq ($(ARCH_X86_HAVE_SSE2),true)
503        libc_crt_target_cflags += -DUSE_SSE2=1
504    endif
505    ifeq ($(ARCH_X86_HAVE_SSSE3),true)
506        libc_crt_target_cflags += -DUSE_SSSE3=1
507    endif
508  endif # x86
509endif # !arm
510
511# Define ANDROID_SMP appropriately.
512ifeq ($(TARGET_CPU_SMP),true)
513    libc_common_cflags += -DANDROID_SMP=1
514else
515    libc_common_cflags += -DANDROID_SMP=0
516endif
517
518# Needed to access private/__dso_handle.h from
519# crtbegin_xxx.c and crtend_xxx.c
520#
521libc_crt_target_cflags += -I$(LOCAL_PATH)/private
522
523ifeq ($(TARGET_ARCH),arm)
524libc_crt_target_cflags += -DCRT_LEGACY_WORKAROUND
525endif
526
527# Define some common includes
528# ========================================================
529libc_common_c_includes := \
530		$(LOCAL_PATH)/stdlib  \
531		$(LOCAL_PATH)/string  \
532		$(LOCAL_PATH)/stdio
533
534# Needed to access private/__dso_handle.h from
535# crtbegin_xxx.S and crtend_xxx.S
536#
537libc_crt_target_cflags += -I$(LOCAL_PATH)/private -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
538
539# Define the libc run-time (crt) support object files that must be built,
540# which are needed to build all other objects (shared/static libs and
541# executables)
542# ==========================================================================
543
544ifneq ($(filter arm x86,$(TARGET_ARCH)),)
545# ARM and x86 need crtbegin_so/crtend_so.
546#
547# For x86, the .init section must point to a function that calls all
548# entries in the .ctors section. (on ARM this is done through the
549# .init_array section instead).
550#
551# For both platforms, the .fini_array section must point to a function
552# that will call __cxa_finalize(&__dso_handle) in order to ensure that
553# static C++ destructors are properly called on dlclose().
554#
555
556libc_crt_target_so_cflags := $(libc_crt_target_cflags)
557libc_crt_target_crtstart_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.c
558libc_crt_target_crtstart_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.c
559ifeq ($(TARGET_ARCH),x86)
560    # This flag must be added for x86 targets, but not for ARM
561    libc_crt_target_so_cflags += -fPIC
562    libc_crt_target_crtstart_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.S
563    libc_crt_target_crtstart_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
564endif
565GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
566$(GEN): $(libc_crt_target_crtstart_so_file)
567	@mkdir -p $(dir $@)
568	$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
569ALL_GENERATED_SOURCES += $(GEN)
570
571GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
572$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
573	@mkdir -p $(dir $@)
574	$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
575ALL_GENERATED_SOURCES += $(GEN)
576endif # TARGET_ARCH == x86 || TARGET_ARCH == arm
577
578
579GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
580$(GEN): $(libc_crt_target_crtstart_file)
581	@mkdir -p $(dir $@)
582	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
583ALL_GENERATED_SOURCES += $(GEN)
584
585GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
586$(GEN): $(libc_crt_target_crtstart_file)
587	@mkdir -p $(dir $@)
588	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
589ALL_GENERATED_SOURCES += $(GEN)
590
591
592# We rename crtend.o to crtend_android.o to avoid a
593# name clash between gcc and bionic.
594GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
595$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
596	@mkdir -p $(dir $@)
597	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
598ALL_GENERATED_SOURCES += $(GEN)
599
600
601# To enable malloc leak check for statically linked programs, add
602# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
603WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
604
605# ========================================================
606# libc_common.a
607# ========================================================
608include $(CLEAR_VARS)
609
610LOCAL_SRC_FILES := $(libc_common_src_files)
611LOCAL_CFLAGS := $(libc_common_cflags)
612ifeq ($(TARGET_ARCH),arm)
613LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
614endif
615LOCAL_C_INCLUDES := $(libc_common_c_includes)
616LOCAL_MODULE := libc_common
617LOCAL_SYSTEM_SHARED_LIBRARIES :=
618
619include $(BUILD_STATIC_LIBRARY)
620
621
622# ========================================================
623# libc_nomalloc.a
624# ========================================================
625#
626# This is a version of the static C library that does not
627# include malloc. It's useful in situations when calling
628# the user wants to provide their own malloc implementation,
629# or wants to explicitly disallow the use of the use of malloc,
630# like the dynamic loader.
631
632include $(CLEAR_VARS)
633
634LOCAL_SRC_FILES := \
635	$(libc_arch_static_src_files) \
636	$(libc_static_common_src_files) \
637	bionic/libc_init_static.c
638
639LOCAL_C_INCLUDES := $(libc_common_c_includes)
640LOCAL_CFLAGS := $(libc_common_cflags) \
641                -DLIBC_STATIC
642
643LOCAL_MODULE := libc_nomalloc
644LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
645LOCAL_SYSTEM_SHARED_LIBRARIES :=
646
647include $(BUILD_STATIC_LIBRARY)
648
649
650# ========================================================
651# libc.a
652# ========================================================
653include $(CLEAR_VARS)
654
655LOCAL_SRC_FILES := \
656	$(libc_arch_static_src_files) \
657	$(libc_static_common_src_files) \
658	bionic/dlmalloc.c \
659	bionic/malloc_debug_common.c \
660	bionic/libc_init_static.c
661
662LOCAL_CFLAGS := $(libc_common_cflags) \
663                -DLIBC_STATIC
664LOCAL_C_INCLUDES := $(libc_common_c_includes)
665LOCAL_MODULE := libc
666LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
667LOCAL_SYSTEM_SHARED_LIBRARIES :=
668
669include $(BUILD_STATIC_LIBRARY)
670
671
672# ========================================================
673# libc.so
674# ========================================================
675include $(CLEAR_VARS)
676
677# pthread deadlock prediction:
678# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
679# pthread deadlock prediction.
680# Since this code is experimental it is disabled by default.
681# see libc/bionic/pthread_debug.c for details
682
683LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
684LOCAL_C_INCLUDES := $(libc_common_c_includes)
685
686LOCAL_SRC_FILES := \
687	$(libc_arch_dynamic_src_files) \
688	$(libc_static_common_src_files) \
689	bionic/dlmalloc.c \
690	bionic/malloc_debug_common.c \
691	bionic/pthread_debug.c \
692	bionic/libc_init_dynamic.c
693
694LOCAL_MODULE:= libc
695
696# WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
697# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
698# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
699# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
700# should, instead relying on the external symbols from the dependent libraries.  That would
701# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
702# you wanted!
703
704LOCAL_SHARED_LIBRARIES := libdl
705LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
706LOCAL_SYSTEM_SHARED_LIBRARIES :=
707
708include $(BUILD_SHARED_LIBRARY)
709
710
711# For all builds, except for the -user build we will enable memory
712# allocation checking (including memory leaks, buffer overwrites, etc.)
713# Note that all these checks are also controlled by env. settings
714# that can enable, or disable specific checks. Note also that some of
715# the checks are available only in emulator and are implemeted in
716# libc_malloc_qemu_instrumented.so.
717ifneq ($(TARGET_BUILD_VARIANT),user)
718
719# ========================================================
720# libc_malloc_debug_leak.so
721# ========================================================
722include $(CLEAR_VARS)
723
724LOCAL_CFLAGS := \
725	$(libc_common_cflags) \
726	-DMALLOC_LEAK_CHECK
727
728LOCAL_C_INCLUDES := $(libc_common_c_includes)
729
730LOCAL_SRC_FILES := \
731	bionic/malloc_debug_leak.c
732
733LOCAL_MODULE:= libc_malloc_debug_leak
734
735LOCAL_SHARED_LIBRARIES := libc
736LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
737LOCAL_SYSTEM_SHARED_LIBRARIES :=
738LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
739
740# Don't install on release build
741LOCAL_MODULE_TAGS := eng debug
742
743include $(BUILD_SHARED_LIBRARY)
744
745
746# ========================================================
747# libc_malloc_debug_qemu.so
748# ========================================================
749include $(CLEAR_VARS)
750
751LOCAL_CFLAGS := \
752	$(libc_common_cflags) \
753	-DMALLOC_QEMU_INSTRUMENT
754
755LOCAL_C_INCLUDES := $(libc_common_c_includes)
756
757LOCAL_SRC_FILES := \
758	bionic/malloc_debug_qemu.c
759
760LOCAL_MODULE:= libc_malloc_debug_qemu
761
762LOCAL_SHARED_LIBRARIES := libc libdl
763LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
764LOCAL_SYSTEM_SHARED_LIBRARIES :=
765
766# Don't install on release build
767LOCAL_MODULE_TAGS := eng debug
768
769include $(BUILD_SHARED_LIBRARY)
770
771endif	#!user
772
773
774# ========================================================
775include $(call all-makefiles-under,$(LOCAL_PATH))
776