blob: 0d3e2c35b37495f34cc1ab3d69bd4731411f9ddc [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 \
11 unistd/brk.c \
12 unistd/creat.c \
13 unistd/daemon.c \
14 unistd/exec.c \
15 unistd/fcntl.c \
16 unistd/fnmatch.c \
17 unistd/ftime.c \
18 unistd/ftok.c \
19 unistd/getcwd.c \
20 unistd/getdtablesize.c \
21 unistd/gethostname.c \
22 unistd/getopt_long.c \
23 unistd/getpgrp.c \
24 unistd/getpriority.c \
25 unistd/getpt.c \
26 unistd/initgroups.c \
27 unistd/isatty.c \
28 unistd/issetugid.c \
Colin Cross8c59d962010-01-13 16:39:26 -080029 unistd/killpg.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030 unistd/lseek64.c \
31 unistd/mmap.c \
32 unistd/nice.c \
33 unistd/open.c \
34 unistd/openat.c \
35 unistd/opendir.c \
36 unistd/pathconf.c \
37 unistd/perror.c \
38 unistd/popen.c \
39 unistd/pread.c \
40 unistd/pselect.c \
41 unistd/ptsname.c \
42 unistd/ptsname_r.c \
43 unistd/pwrite.c \
44 unistd/raise.c \
45 unistd/reboot.c \
46 unistd/recv.c \
47 unistd/sbrk.c \
48 unistd/send.c \
49 unistd/setegid.c \
50 unistd/seteuid.c \
51 unistd/setpgrp.c \
52 unistd/sigblock.c \
53 unistd/siginterrupt.c \
54 unistd/siglist.c \
55 unistd/signal.c \
Thorsten Glaser92b10af2009-10-02 15:39:00 +020056 unistd/signame.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080057 unistd/sigsetmask.c \
58 unistd/sigsuspend.c \
59 unistd/sigwait.c \
60 unistd/sleep.c \
61 unistd/statfs.c \
62 unistd/strsignal.c \
63 unistd/sysconf.c \
64 unistd/syslog.c \
65 unistd/system.c \
66 unistd/tcgetpgrp.c \
67 unistd/tcsetpgrp.c \
68 unistd/time.c \
69 unistd/umount.c \
70 unistd/unlockpt.c \
71 unistd/usleep.c \
72 unistd/wait.c \
73 stdio/asprintf.c \
74 stdio/clrerr.c \
75 stdio/fclose.c \
76 stdio/fdopen.c \
77 stdio/feof.c \
78 stdio/ferror.c \
79 stdio/fflush.c \
80 stdio/fgetc.c \
81 stdio/fgetln.c \
82 stdio/fgetpos.c \
83 stdio/fgets.c \
84 stdio/fileno.c \
85 stdio/findfp.c \
86 stdio/flags.c \
87 stdio/flockfile.c \
88 stdio/fopen.c \
89 stdio/fprintf.c \
90 stdio/fpurge.c \
91 stdio/fputc.c \
92 stdio/fputs.c \
93 stdio/fread.c \
94 stdio/freopen.c \
95 stdio/fscanf.c \
96 stdio/fseek.c \
97 stdio/fsetpos.c \
98 stdio/ftell.c \
99 stdio/funopen.c \
100 stdio/fvwrite.c \
101 stdio/fwalk.c \
102 stdio/fwrite.c \
103 stdio/getc.c \
104 stdio/getchar.c \
105 stdio/gets.c \
106 stdio/makebuf.c \
107 stdio/mktemp.c \
108 stdio/printf.c \
109 stdio/putc.c \
110 stdio/putchar.c \
111 stdio/puts.c \
112 stdio/putw.c \
113 stdio/refill.c \
114 stdio/remove.c \
115 stdio/rewind.c \
116 stdio/rget.c \
117 stdio/scanf.c \
118 stdio/setbuf.c \
119 stdio/setbuffer.c \
120 stdio/setvbuf.c \
121 stdio/snprintf.c\
122 stdio/sprintf.c \
123 stdio/sscanf.c \
124 stdio/stdio.c \
125 stdio/tempnam.c \
126 stdio/tmpfile.c \
127 stdio/tmpnam.c \
128 stdio/ungetc.c \
129 stdio/vasprintf.c \
130 stdio/vfprintf.c \
131 stdio/vfscanf.c \
132 stdio/vprintf.c \
133 stdio/vsnprintf.c \
134 stdio/vsprintf.c \
135 stdio/vscanf.c \
136 stdio/vsscanf.c \
137 stdio/wbuf.c \
138 stdio/wsetup.c \
139 stdlib/_rand48.c \
140 stdlib/assert.c \
141 stdlib/atexit.c \
142 stdlib/atoi.c \
143 stdlib/atol.c \
144 stdlib/atoll.c \
145 stdlib/bsearch.c \
146 stdlib/ctype_.c \
147 stdlib/div.c \
148 stdlib/exit.c \
149 stdlib/getenv.c \
150 stdlib/jrand48.c \
151 stdlib/ldiv.c \
152 stdlib/lldiv.c \
153 stdlib/locale.c \
154 stdlib/lrand48.c \
155 stdlib/mrand48.c \
156 stdlib/nrand48.c \
157 stdlib/putenv.c \
158 stdlib/qsort.c \
159 stdlib/seed48.c \
160 stdlib/setenv.c \
161 stdlib/setjmperr.c \
162 stdlib/srand48.c \
163 stdlib/strntoimax.c \
164 stdlib/strntoumax.c \
165 stdlib/strtod.c \
166 stdlib/strtoimax.c \
167 stdlib/strtol.c \
168 stdlib/strtoll.c \
169 stdlib/strtoul.c \
170 stdlib/strtoull.c \
171 stdlib/strtoumax.c \
172 stdlib/tolower_.c \
173 stdlib/toupper_.c \
174 stdlib/wchar.c \
175 string/bcopy.c \
176 string/index.c \
177 string/memccpy.c \
178 string/memchr.c \
179 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800180 string/memrchr.c \
181 string/memswap.c \
182 string/strcasecmp.c \
183 string/strcasestr.c \
184 string/strcat.c \
185 string/strchr.c \
186 string/strcmp.c \
187 string/strcoll.c \
188 string/strcpy.c \
189 string/strcspn.c \
190 string/strdup.c \
191 string/strerror.c \
192 string/strerror_r.c \
193 string/strlcat.c \
194 string/strlcpy.c \
195 string/strncat.c \
196 string/strncmp.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 inet/bindresvport.c \
209 inet/inet_addr.c \
210 inet/inet_aton.c \
211 inet/inet_ntoa.c \
212 inet/inet_ntop.c \
213 inet/inet_pton.c \
214 tzcode/asctime.c \
215 tzcode/difftime.c \
216 tzcode/localtime.c \
217 tzcode/strftime.c \
218 tzcode/strptime.c \
219 bionic/__errno.c \
220 bionic/__set_errno.c \
221 bionic/_rand48.c \
222 bionic/arc4random.c \
223 bionic/basename.c \
224 bionic/basename_r.c \
225 bionic/dirname.c \
226 bionic/dirname_r.c \
227 bionic/drand48.c \
228 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800229 bionic/err.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800230 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800231 bionic/fts.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800232 bionic/if_nametoindex.c \
233 bionic/if_indextoname.c \
234 bionic/ioctl.c \
235 bionic/ldexp.c \
236 bionic/libc_init_common.c \
237 bionic/logd_write.c \
238 bionic/md5.c \
239 bionic/pututline.c \
240 bionic/realpath.c \
241 bionic/semaphore.c \
242 bionic/sha1.c \
243 bionic/ssp.c \
244 bionic/stubs.c \
245 bionic/system_properties.c \
246 bionic/time64.c \
247 bionic/thread_atexit.c \
248 bionic/utime.c \
249 bionic/utmp.c \
250 netbsd/gethnamaddr.c \
251 netbsd/isc/ev_timers.c \
252 netbsd/isc/ev_streams.c \
253 netbsd/inet/nsap_addr.c \
254 netbsd/resolv/__dn_comp.c \
255 netbsd/resolv/__res_close.c \
256 netbsd/resolv/__res_send.c \
257 netbsd/resolv/herror.c \
258 netbsd/resolv/res_comp.c \
259 netbsd/resolv/res_data.c \
260 netbsd/resolv/res_debug.c \
261 netbsd/resolv/res_init.c \
262 netbsd/resolv/res_mkquery.c \
263 netbsd/resolv/res_query.c \
264 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900265 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800266 netbsd/resolv/res_cache.c \
267 netbsd/net/nsdispatch.c \
268 netbsd/net/getaddrinfo.c \
269 netbsd/net/getnameinfo.c \
270 netbsd/net/getservbyname.c \
271 netbsd/net/getservent.c \
272 netbsd/net/base64.c \
273 netbsd/net/getservbyport.c \
274 netbsd/nameser/ns_name.c \
275 netbsd/nameser/ns_parse.c \
276 netbsd/nameser/ns_ttl.c \
277 netbsd/nameser/ns_netint.c \
278 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800279 netbsd/nameser/ns_samedomain.c \
280 regex/regcomp.c \
281 regex/regerror.c \
282 regex/regexec.c \
283 regex/regfree.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800284
Dima Zavinca122b02009-05-27 10:52:37 -0700285# Architecture specific source files go here
286# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800287ifeq ($(TARGET_ARCH),arm)
288libc_common_src_files += \
289 bionic/eabi.c \
290 arch-arm/bionic/__get_pc.S \
291 arch-arm/bionic/__get_sp.S \
292 arch-arm/bionic/_exit_with_stack_teardown.S \
293 arch-arm/bionic/_setjmp.S \
294 arch-arm/bionic/atomics_arm.S \
295 arch-arm/bionic/clone.S \
296 arch-arm/bionic/ffs.S \
297 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700298 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800299 arch-arm/bionic/tkill.S \
300 arch-arm/bionic/memcmp.S \
301 arch-arm/bionic/memcmp16.S \
302 arch-arm/bionic/memcpy.S \
303 arch-arm/bionic/memset.S \
304 arch-arm/bionic/setjmp.S \
305 arch-arm/bionic/sigsetjmp.S \
306 arch-arm/bionic/strlen.c.arm \
307 arch-arm/bionic/syscall.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900308 string/memmove.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800309 unistd/socketcalls.c
310
311# These files need to be arm so that gdbserver
312# can set breakpoints in them without messing
313# up any thumb code.
314libc_common_src_files += \
315 bionic/pthread.c.arm \
316 bionic/pthread-timers.c.arm \
317 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700318
319# these are used by the static and dynamic versions of the libc
320# respectively
321libc_arch_static_src_files := \
322 arch-arm/bionic/exidx_static.c
323
324libc_arch_dynamic_src_files := \
325 arch-arm/bionic/exidx_dynamic.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800326else # !arm
327
328ifeq ($(TARGET_ARCH),x86)
329libc_common_src_files += \
330 arch-x86/bionic/__get_sp.S \
331 arch-x86/bionic/__get_tls.c \
332 arch-x86/bionic/__set_tls.c \
333 arch-x86/bionic/atomics_x86.S \
334 arch-x86/bionic/clone.S \
335 arch-x86/bionic/_exit_with_stack_teardown.S \
336 arch-x86/bionic/setjmp.S \
337 arch-x86/bionic/_setjmp.S \
338 arch-x86/bionic/vfork.S \
339 arch-x86/string/bzero.S \
340 arch-x86/string/memset.S \
341 arch-x86/string/memcmp.S \
342 arch-x86/string/memcpy.S \
343 arch-x86/string/strlen.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900344 string/memmove.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800345 bionic/pthread.c \
346 bionic/pthread-timers.c \
347 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800348
Dima Zavinca122b02009-05-27 10:52:37 -0700349# this is needed for static versions of libc
350libc_arch_static_src_files := \
351 arch-x86/bionic/dl_iterate_phdr_static.c
352
353libc_arch_dynamic_src_files :=
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900354else # !x86
355
356ifeq ($(TARGET_ARCH),sh)
357libc_common_src_files += \
358 arch-sh/bionic/__get_pc.S \
359 arch-sh/bionic/__get_sp.S \
360 arch-sh/bionic/_exit_with_stack_teardown.S \
361 arch-sh/bionic/_setjmp.S \
362 arch-sh/bionic/atomics_sh.c \
363 arch-sh/bionic/atomic_cmpxchg.S \
364 arch-sh/bionic/clone.S \
365 arch-sh/bionic/pipe.S \
366 arch-sh/bionic/memcpy.S \
367 arch-sh/bionic/memset.S \
368 arch-sh/bionic/bzero.S \
369 arch-sh/bionic/setjmp.S \
370 arch-sh/bionic/sigsetjmp.S \
371 arch-sh/bionic/syscall.S \
372 arch-sh/bionic/memmove.S \
373 arch-sh/bionic/__set_tls.c \
374 arch-sh/bionic/__get_tls.c \
375 arch-sh/bionic/ffs.S \
376 string/memcmp.c \
377 string/strlen.c \
378 bionic/eabi.c \
379 bionic/pthread.c \
380 bionic/pthread-timers.c \
381 bionic/ptrace.c \
382 unistd/socketcalls.c
383endif # sh
384
385endif # !x86
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800386endif # !arm
387
Dima Zavinca122b02009-05-27 10:52:37 -0700388# Define some common cflags
389# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800390libc_common_cflags := \
391 -DWITH_ERRLIST \
392 -DANDROID_CHANGES \
393 -DUSE_LOCKS \
394 -DREALLOC_ZERO_BYTES_FREES \
395 -D_LIBC=1 \
396 -DSOFTFLOAT \
397 -DFLOATING_POINT \
398 -DNEED_PSELECT=1 \
399 -DINET6 \
400 -I$(LOCAL_PATH)/private \
Colin Cross4fa7b102010-01-12 18:59:25 -0800401 -DUSE_DL_PREFIX \
402 -DPOSIX_MISTAKE
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800403
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700404ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800405 libc_common_cflags += -DDEBUG
406endif
407
408ifeq ($(TARGET_ARCH),arm)
409 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700410 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700411 #
412 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
413 # that it should access the hardware TLS register directly in
414 # private/bionic_tls.h
415 #
416 # The value must match your kernel configuration
417 #
418 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
419 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
420 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700421else # !arm
422 ifeq ($(TARGET_ARCH),x86)
423 libc_crt_target_cflags := -m32
424 endif # x86
425endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800426
Dima Zavinca122b02009-05-27 10:52:37 -0700427# Define some common includes
428# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800429libc_common_c_includes := \
430 $(LOCAL_PATH)/stdlib \
431 $(LOCAL_PATH)/string \
432 $(LOCAL_PATH)/stdio
433
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800434
Dima Zavinca122b02009-05-27 10:52:37 -0700435# Define the libc run-time (crt) support object files that must be built,
436# which are needed to build all other objects (shared/static libs and
437# executables)
438# ==========================================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800439
440ifeq ($(TARGET_ARCH),x86)
Dima Zavinca122b02009-05-27 10:52:37 -0700441# we only need begin_so/end_so for x86, since it needs an appropriate .init
442# section in the shared library with a function to call all the entries in
443# .ctors section. ARM uses init_array, and does not need the function.
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800444GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
445$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
446 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700447 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800448ALL_GENERATED_SOURCES += $(GEN)
449
450GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
451$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
452 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700453 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800454ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800455endif # TARGET_ARCH == x86
456
Dima Zavinca122b02009-05-27 10:52:37 -0700457
458GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
459$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
460 @mkdir -p $(dir $@)
461 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
462ALL_GENERATED_SOURCES += $(GEN)
463
464GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
465$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
466 @mkdir -p $(dir $@)
467 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
468ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800469
470
Dima Zavinca122b02009-05-27 10:52:37 -0700471# We rename crtend.o to crtend_android.o to avoid a
472# name clash between gcc and bionic.
473GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
474$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
475 @mkdir -p $(dir $@)
476 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
477ALL_GENERATED_SOURCES += $(GEN)
478
479
480# To enable malloc leak check for statically linked programs, add
481# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
482WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
483
484# ========================================================
485# libc_common.a
486# ========================================================
487include $(CLEAR_VARS)
488
489LOCAL_SRC_FILES := $(libc_common_src_files)
490LOCAL_CFLAGS := $(libc_common_cflags)
491LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800492LOCAL_MODULE := libc_common
493LOCAL_SYSTEM_SHARED_LIBRARIES :=
494
495include $(BUILD_STATIC_LIBRARY)
496
497
Dima Zavinca122b02009-05-27 10:52:37 -0700498# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700499# libc_nomalloc.a
500# ========================================================
501#
502# This is a version of the static C library that does not
503# include malloc. It's useful in situations when calling
504# the user wants to provide their own malloc implementation,
505# or wants to explicitly disallow the use of the use of malloc,
506# like the dynamic loader.
507
508include $(CLEAR_VARS)
509
510LOCAL_SRC_FILES := \
511 $(libc_arch_static_src_files) \
512 bionic/libc_init_static.c
513
514LOCAL_C_INCLUDES := $(libc_common_c_includes)
515LOCAL_CFLAGS := $(libc_common_cflags)
516
517LOCAL_MODULE := libc_nomalloc
518LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
519LOCAL_SYSTEM_SHARED_LIBRARIES :=
520
521include $(BUILD_STATIC_LIBRARY)
522
523
524# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800525# libc.a
526# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800527include $(CLEAR_VARS)
528
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800529LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700530 $(libc_arch_static_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800531 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800532 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800533 bionic/libc_init_static.c
534
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800535LOCAL_CFLAGS := $(libc_common_cflags) \
536 -DLIBC_STATIC
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800537LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700538LOCAL_MODULE := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800539LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800540LOCAL_SYSTEM_SHARED_LIBRARIES :=
541
542include $(BUILD_STATIC_LIBRARY)
543
544
Dima Zavinca122b02009-05-27 10:52:37 -0700545# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800546# libc.so
547# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800548include $(CLEAR_VARS)
549
550LOCAL_CFLAGS := $(libc_common_cflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800551LOCAL_C_INCLUDES := $(libc_common_c_includes)
552
553LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700554 $(libc_arch_dynamic_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800555 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800556 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800557 bionic/libc_init_dynamic.c
558
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800559LOCAL_MODULE:= libc
560
561# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
562# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
563# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
564# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
565# should, instead relying on the external symbols from the dependent libraries. That would
566# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
567# you wanted!
568
569LOCAL_SHARED_LIBRARIES := libdl
570LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
571LOCAL_SYSTEM_SHARED_LIBRARIES :=
572
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800573include $(BUILD_SHARED_LIBRARY)
574
575
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800576# For all builds, except for the -user build we will enable memory
577# allocation checking (including memory leaks, buffer overwrites, etc.)
578# Note that all these checks are also controlled by env. settings
579# that can enable, or disable specific checks. Note also that some of
580# the checks are available only in emulator and are implemeted in
581# libc_malloc_qemu_instrumented.so.
582ifneq ($(TARGET_BUILD_VARIANT),user)
583
Dima Zavinca122b02009-05-27 10:52:37 -0700584# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800585# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800586# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800587include $(CLEAR_VARS)
588
Dima Zavinca122b02009-05-27 10:52:37 -0700589LOCAL_CFLAGS := \
590 $(libc_common_cflags) \
591 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800592
593LOCAL_C_INCLUDES := $(libc_common_c_includes)
594
595LOCAL_SRC_FILES := \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800596 bionic/malloc_debug_leak.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800597
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800598LOCAL_MODULE:= libc_malloc_debug_leak
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800599
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800600LOCAL_SHARED_LIBRARIES := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800601LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
602LOCAL_SYSTEM_SHARED_LIBRARIES :=
603# Don't prelink
604LOCAL_PRELINK_MODULE := false
605# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800606LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800607
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800608include $(BUILD_SHARED_LIBRARY)
609
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800610
611# ========================================================
612# libc_malloc_debug_qemu.so
613# ========================================================
614include $(CLEAR_VARS)
615
616LOCAL_CFLAGS := \
617 $(libc_common_cflags) \
618 -DMALLOC_QEMU_INSTRUMENT
619
620LOCAL_C_INCLUDES := $(libc_common_c_includes)
621
622LOCAL_SRC_FILES := \
623 bionic/malloc_debug_qemu.c
624
625LOCAL_MODULE:= libc_malloc_debug_qemu
626
627LOCAL_SHARED_LIBRARIES := libc
628LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
629LOCAL_SYSTEM_SHARED_LIBRARIES :=
630# Don't prelink
631LOCAL_PRELINK_MODULE := false
632# Don't install on release build
633LOCAL_MODULE_TAGS := eng debug
634
635include $(BUILD_SHARED_LIBRARY)
636
637endif #!user
638
639
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800640# ========================================================
641include $(call all-makefiles-under,$(LOCAL_PATH))