blob: 97f401198fbf303e67cd2c8973d23a8927f1a5bb [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 \
Mike Chan9f691562010-03-02 10:55:58 -080050 unistd/setuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080051 unistd/seteuid.c \
Mike Chan9f691562010-03-02 10:55:58 -080052 unistd/setreuid.c \
53 unistd/setresuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054 unistd/setpgrp.c \
55 unistd/sigblock.c \
56 unistd/siginterrupt.c \
57 unistd/siglist.c \
58 unistd/signal.c \
Thorsten Glaser92b10af2009-10-02 15:39:00 +020059 unistd/signame.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080060 unistd/sigsetmask.c \
61 unistd/sigsuspend.c \
62 unistd/sigwait.c \
63 unistd/sleep.c \
64 unistd/statfs.c \
65 unistd/strsignal.c \
66 unistd/sysconf.c \
67 unistd/syslog.c \
68 unistd/system.c \
69 unistd/tcgetpgrp.c \
70 unistd/tcsetpgrp.c \
71 unistd/time.c \
72 unistd/umount.c \
73 unistd/unlockpt.c \
74 unistd/usleep.c \
75 unistd/wait.c \
76 stdio/asprintf.c \
77 stdio/clrerr.c \
78 stdio/fclose.c \
79 stdio/fdopen.c \
80 stdio/feof.c \
81 stdio/ferror.c \
82 stdio/fflush.c \
83 stdio/fgetc.c \
84 stdio/fgetln.c \
85 stdio/fgetpos.c \
86 stdio/fgets.c \
87 stdio/fileno.c \
88 stdio/findfp.c \
89 stdio/flags.c \
90 stdio/flockfile.c \
91 stdio/fopen.c \
92 stdio/fprintf.c \
93 stdio/fpurge.c \
94 stdio/fputc.c \
95 stdio/fputs.c \
96 stdio/fread.c \
97 stdio/freopen.c \
98 stdio/fscanf.c \
99 stdio/fseek.c \
100 stdio/fsetpos.c \
101 stdio/ftell.c \
102 stdio/funopen.c \
103 stdio/fvwrite.c \
104 stdio/fwalk.c \
105 stdio/fwrite.c \
106 stdio/getc.c \
107 stdio/getchar.c \
108 stdio/gets.c \
109 stdio/makebuf.c \
110 stdio/mktemp.c \
111 stdio/printf.c \
112 stdio/putc.c \
113 stdio/putchar.c \
114 stdio/puts.c \
115 stdio/putw.c \
116 stdio/refill.c \
117 stdio/remove.c \
118 stdio/rewind.c \
119 stdio/rget.c \
120 stdio/scanf.c \
121 stdio/setbuf.c \
122 stdio/setbuffer.c \
123 stdio/setvbuf.c \
124 stdio/snprintf.c\
125 stdio/sprintf.c \
126 stdio/sscanf.c \
127 stdio/stdio.c \
128 stdio/tempnam.c \
129 stdio/tmpfile.c \
130 stdio/tmpnam.c \
131 stdio/ungetc.c \
132 stdio/vasprintf.c \
133 stdio/vfprintf.c \
134 stdio/vfscanf.c \
135 stdio/vprintf.c \
136 stdio/vsnprintf.c \
137 stdio/vsprintf.c \
138 stdio/vscanf.c \
139 stdio/vsscanf.c \
140 stdio/wbuf.c \
141 stdio/wsetup.c \
142 stdlib/_rand48.c \
143 stdlib/assert.c \
144 stdlib/atexit.c \
145 stdlib/atoi.c \
146 stdlib/atol.c \
147 stdlib/atoll.c \
148 stdlib/bsearch.c \
149 stdlib/ctype_.c \
150 stdlib/div.c \
151 stdlib/exit.c \
152 stdlib/getenv.c \
153 stdlib/jrand48.c \
154 stdlib/ldiv.c \
155 stdlib/lldiv.c \
156 stdlib/locale.c \
157 stdlib/lrand48.c \
158 stdlib/mrand48.c \
159 stdlib/nrand48.c \
160 stdlib/putenv.c \
161 stdlib/qsort.c \
162 stdlib/seed48.c \
163 stdlib/setenv.c \
164 stdlib/setjmperr.c \
165 stdlib/srand48.c \
166 stdlib/strntoimax.c \
167 stdlib/strntoumax.c \
168 stdlib/strtod.c \
169 stdlib/strtoimax.c \
170 stdlib/strtol.c \
171 stdlib/strtoll.c \
172 stdlib/strtoul.c \
173 stdlib/strtoull.c \
174 stdlib/strtoumax.c \
175 stdlib/tolower_.c \
176 stdlib/toupper_.c \
177 stdlib/wchar.c \
178 string/bcopy.c \
179 string/index.c \
180 string/memccpy.c \
181 string/memchr.c \
182 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800183 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/strcmp.c \
190 string/strcoll.c \
191 string/strcpy.c \
192 string/strcspn.c \
193 string/strdup.c \
194 string/strerror.c \
195 string/strerror_r.c \
196 string/strlcat.c \
197 string/strlcpy.c \
198 string/strncat.c \
199 string/strncmp.c \
200 string/strncpy.c \
201 string/strndup.c \
202 string/strnlen.c \
203 string/strpbrk.c \
204 string/strrchr.c \
205 string/strsep.c \
206 string/strspn.c \
207 string/strstr.c \
208 string/strtok.c \
209 string/strtotimeval.c \
210 string/strxfrm.c \
211 inet/bindresvport.c \
212 inet/inet_addr.c \
213 inet/inet_aton.c \
214 inet/inet_ntoa.c \
215 inet/inet_ntop.c \
216 inet/inet_pton.c \
217 tzcode/asctime.c \
218 tzcode/difftime.c \
219 tzcode/localtime.c \
220 tzcode/strftime.c \
221 tzcode/strptime.c \
222 bionic/__errno.c \
223 bionic/__set_errno.c \
224 bionic/_rand48.c \
Mike Chan9f691562010-03-02 10:55:58 -0800225 bionic/cpuacct.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800226 bionic/arc4random.c \
227 bionic/basename.c \
228 bionic/basename_r.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800229 bionic/clearenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800230 bionic/dirname.c \
231 bionic/dirname_r.c \
232 bionic/drand48.c \
233 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800234 bionic/err.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800235 bionic/fdprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800236 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800237 bionic/fts.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800238 bionic/if_nametoindex.c \
239 bionic/if_indextoname.c \
240 bionic/ioctl.c \
241 bionic/ldexp.c \
242 bionic/libc_init_common.c \
243 bionic/logd_write.c \
244 bionic/md5.c \
245 bionic/pututline.c \
246 bionic/realpath.c \
247 bionic/semaphore.c \
248 bionic/sha1.c \
249 bionic/ssp.c \
250 bionic/stubs.c \
251 bionic/system_properties.c \
252 bionic/time64.c \
253 bionic/thread_atexit.c \
254 bionic/utime.c \
255 bionic/utmp.c \
256 netbsd/gethnamaddr.c \
257 netbsd/isc/ev_timers.c \
258 netbsd/isc/ev_streams.c \
259 netbsd/inet/nsap_addr.c \
260 netbsd/resolv/__dn_comp.c \
261 netbsd/resolv/__res_close.c \
262 netbsd/resolv/__res_send.c \
263 netbsd/resolv/herror.c \
264 netbsd/resolv/res_comp.c \
265 netbsd/resolv/res_data.c \
266 netbsd/resolv/res_debug.c \
267 netbsd/resolv/res_init.c \
268 netbsd/resolv/res_mkquery.c \
269 netbsd/resolv/res_query.c \
270 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900271 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800272 netbsd/resolv/res_cache.c \
273 netbsd/net/nsdispatch.c \
274 netbsd/net/getaddrinfo.c \
275 netbsd/net/getnameinfo.c \
276 netbsd/net/getservbyname.c \
277 netbsd/net/getservent.c \
278 netbsd/net/base64.c \
279 netbsd/net/getservbyport.c \
280 netbsd/nameser/ns_name.c \
281 netbsd/nameser/ns_parse.c \
282 netbsd/nameser/ns_ttl.c \
283 netbsd/nameser/ns_netint.c \
284 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800285 netbsd/nameser/ns_samedomain.c \
286 regex/regcomp.c \
287 regex/regerror.c \
288 regex/regexec.c \
289 regex/regfree.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800290
Dima Zavinca122b02009-05-27 10:52:37 -0700291# Architecture specific source files go here
292# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800293ifeq ($(TARGET_ARCH),arm)
294libc_common_src_files += \
295 bionic/eabi.c \
David 'Digit' Turner97cf7f32010-01-22 18:59:05 -0800296 bionic/bionic_clone.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800297 arch-arm/bionic/__get_pc.S \
298 arch-arm/bionic/__get_sp.S \
299 arch-arm/bionic/_exit_with_stack_teardown.S \
300 arch-arm/bionic/_setjmp.S \
301 arch-arm/bionic/atomics_arm.S \
302 arch-arm/bionic/clone.S \
303 arch-arm/bionic/ffs.S \
304 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700305 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800306 arch-arm/bionic/tkill.S \
307 arch-arm/bionic/memcmp.S \
308 arch-arm/bionic/memcmp16.S \
309 arch-arm/bionic/memcpy.S \
310 arch-arm/bionic/memset.S \
311 arch-arm/bionic/setjmp.S \
312 arch-arm/bionic/sigsetjmp.S \
313 arch-arm/bionic/strlen.c.arm \
314 arch-arm/bionic/syscall.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900315 string/memmove.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800316 unistd/socketcalls.c
317
318# These files need to be arm so that gdbserver
319# can set breakpoints in them without messing
320# up any thumb code.
321libc_common_src_files += \
322 bionic/pthread.c.arm \
323 bionic/pthread-timers.c.arm \
324 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700325
326# these are used by the static and dynamic versions of the libc
327# respectively
328libc_arch_static_src_files := \
329 arch-arm/bionic/exidx_static.c
330
331libc_arch_dynamic_src_files := \
332 arch-arm/bionic/exidx_dynamic.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800333else # !arm
334
335ifeq ($(TARGET_ARCH),x86)
336libc_common_src_files += \
337 arch-x86/bionic/__get_sp.S \
338 arch-x86/bionic/__get_tls.c \
339 arch-x86/bionic/__set_tls.c \
340 arch-x86/bionic/atomics_x86.S \
341 arch-x86/bionic/clone.S \
342 arch-x86/bionic/_exit_with_stack_teardown.S \
343 arch-x86/bionic/setjmp.S \
344 arch-x86/bionic/_setjmp.S \
345 arch-x86/bionic/vfork.S \
346 arch-x86/string/bzero.S \
347 arch-x86/string/memset.S \
348 arch-x86/string/memcmp.S \
349 arch-x86/string/memcpy.S \
350 arch-x86/string/strlen.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900351 string/memmove.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800352 bionic/pthread.c \
353 bionic/pthread-timers.c \
354 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800355
Dima Zavinca122b02009-05-27 10:52:37 -0700356# this is needed for static versions of libc
357libc_arch_static_src_files := \
358 arch-x86/bionic/dl_iterate_phdr_static.c
359
360libc_arch_dynamic_src_files :=
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900361else # !x86
362
363ifeq ($(TARGET_ARCH),sh)
364libc_common_src_files += \
365 arch-sh/bionic/__get_pc.S \
366 arch-sh/bionic/__get_sp.S \
367 arch-sh/bionic/_exit_with_stack_teardown.S \
368 arch-sh/bionic/_setjmp.S \
369 arch-sh/bionic/atomics_sh.c \
370 arch-sh/bionic/atomic_cmpxchg.S \
371 arch-sh/bionic/clone.S \
372 arch-sh/bionic/pipe.S \
373 arch-sh/bionic/memcpy.S \
374 arch-sh/bionic/memset.S \
375 arch-sh/bionic/bzero.S \
376 arch-sh/bionic/setjmp.S \
377 arch-sh/bionic/sigsetjmp.S \
378 arch-sh/bionic/syscall.S \
379 arch-sh/bionic/memmove.S \
380 arch-sh/bionic/__set_tls.c \
381 arch-sh/bionic/__get_tls.c \
382 arch-sh/bionic/ffs.S \
383 string/memcmp.c \
384 string/strlen.c \
385 bionic/eabi.c \
386 bionic/pthread.c \
387 bionic/pthread-timers.c \
388 bionic/ptrace.c \
389 unistd/socketcalls.c
390endif # sh
391
392endif # !x86
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800393endif # !arm
394
Dima Zavinca122b02009-05-27 10:52:37 -0700395# Define some common cflags
396# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800397libc_common_cflags := \
398 -DWITH_ERRLIST \
399 -DANDROID_CHANGES \
400 -DUSE_LOCKS \
401 -DREALLOC_ZERO_BYTES_FREES \
402 -D_LIBC=1 \
403 -DSOFTFLOAT \
404 -DFLOATING_POINT \
405 -DNEED_PSELECT=1 \
406 -DINET6 \
407 -I$(LOCAL_PATH)/private \
Colin Cross4fa7b102010-01-12 18:59:25 -0800408 -DUSE_DL_PREFIX \
409 -DPOSIX_MISTAKE
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800410
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700411ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800412 libc_common_cflags += -DDEBUG
413endif
414
415ifeq ($(TARGET_ARCH),arm)
416 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700417 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700418 #
419 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
420 # that it should access the hardware TLS register directly in
421 # private/bionic_tls.h
422 #
423 # The value must match your kernel configuration
424 #
425 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
426 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
427 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700428else # !arm
429 ifeq ($(TARGET_ARCH),x86)
430 libc_crt_target_cflags := -m32
431 endif # x86
432endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800433
Dima Zavinca122b02009-05-27 10:52:37 -0700434# Define some common includes
435# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800436libc_common_c_includes := \
437 $(LOCAL_PATH)/stdlib \
438 $(LOCAL_PATH)/string \
439 $(LOCAL_PATH)/stdio
440
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800441
Dima Zavinca122b02009-05-27 10:52:37 -0700442# Define the libc run-time (crt) support object files that must be built,
443# which are needed to build all other objects (shared/static libs and
444# executables)
445# ==========================================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800446
447ifeq ($(TARGET_ARCH),x86)
Dima Zavinca122b02009-05-27 10:52:37 -0700448# we only need begin_so/end_so for x86, since it needs an appropriate .init
449# section in the shared library with a function to call all the entries in
450# .ctors section. ARM uses init_array, and does not need the function.
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800451GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
452$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
453 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700454 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800455ALL_GENERATED_SOURCES += $(GEN)
456
457GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
458$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
459 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700460 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800461ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800462endif # TARGET_ARCH == x86
463
Dima Zavinca122b02009-05-27 10:52:37 -0700464
465GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
466$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
467 @mkdir -p $(dir $@)
468 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
469ALL_GENERATED_SOURCES += $(GEN)
470
471GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
472$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
473 @mkdir -p $(dir $@)
474 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
475ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800476
477
Dima Zavinca122b02009-05-27 10:52:37 -0700478# We rename crtend.o to crtend_android.o to avoid a
479# name clash between gcc and bionic.
480GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
481$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
482 @mkdir -p $(dir $@)
483 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
484ALL_GENERATED_SOURCES += $(GEN)
485
486
487# To enable malloc leak check for statically linked programs, add
488# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
489WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
490
491# ========================================================
492# libc_common.a
493# ========================================================
494include $(CLEAR_VARS)
495
496LOCAL_SRC_FILES := $(libc_common_src_files)
497LOCAL_CFLAGS := $(libc_common_cflags)
498LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800499LOCAL_MODULE := libc_common
500LOCAL_SYSTEM_SHARED_LIBRARIES :=
501
502include $(BUILD_STATIC_LIBRARY)
503
504
Dima Zavinca122b02009-05-27 10:52:37 -0700505# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700506# libc_nomalloc.a
507# ========================================================
508#
509# This is a version of the static C library that does not
510# include malloc. It's useful in situations when calling
511# the user wants to provide their own malloc implementation,
512# or wants to explicitly disallow the use of the use of malloc,
513# like the dynamic loader.
514
515include $(CLEAR_VARS)
516
517LOCAL_SRC_FILES := \
518 $(libc_arch_static_src_files) \
519 bionic/libc_init_static.c
520
521LOCAL_C_INCLUDES := $(libc_common_c_includes)
522LOCAL_CFLAGS := $(libc_common_cflags)
523
524LOCAL_MODULE := libc_nomalloc
525LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
526LOCAL_SYSTEM_SHARED_LIBRARIES :=
527
528include $(BUILD_STATIC_LIBRARY)
529
530
531# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800532# libc.a
533# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800534include $(CLEAR_VARS)
535
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800536LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700537 $(libc_arch_static_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800538 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800539 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800540 bionic/libc_init_static.c
541
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800542LOCAL_CFLAGS := $(libc_common_cflags) \
543 -DLIBC_STATIC
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800544LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700545LOCAL_MODULE := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800546LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800547LOCAL_SYSTEM_SHARED_LIBRARIES :=
548
549include $(BUILD_STATIC_LIBRARY)
550
551
Dima Zavinca122b02009-05-27 10:52:37 -0700552# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800553# libc.so
554# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800555include $(CLEAR_VARS)
556
557LOCAL_CFLAGS := $(libc_common_cflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800558LOCAL_C_INCLUDES := $(libc_common_c_includes)
559
560LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700561 $(libc_arch_dynamic_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800562 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800563 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800564 bionic/libc_init_dynamic.c
565
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800566LOCAL_MODULE:= libc
567
568# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
569# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
570# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
571# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
572# should, instead relying on the external symbols from the dependent libraries. That would
573# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
574# you wanted!
575
576LOCAL_SHARED_LIBRARIES := libdl
577LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
578LOCAL_SYSTEM_SHARED_LIBRARIES :=
579
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800580include $(BUILD_SHARED_LIBRARY)
581
582
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800583# For all builds, except for the -user build we will enable memory
584# allocation checking (including memory leaks, buffer overwrites, etc.)
585# Note that all these checks are also controlled by env. settings
586# that can enable, or disable specific checks. Note also that some of
587# the checks are available only in emulator and are implemeted in
588# libc_malloc_qemu_instrumented.so.
589ifneq ($(TARGET_BUILD_VARIANT),user)
590
Dima Zavinca122b02009-05-27 10:52:37 -0700591# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800592# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800593# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800594include $(CLEAR_VARS)
595
Dima Zavinca122b02009-05-27 10:52:37 -0700596LOCAL_CFLAGS := \
597 $(libc_common_cflags) \
598 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800599
600LOCAL_C_INCLUDES := $(libc_common_c_includes)
601
602LOCAL_SRC_FILES := \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800603 bionic/malloc_debug_leak.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800604
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800605LOCAL_MODULE:= libc_malloc_debug_leak
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800606
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800607LOCAL_SHARED_LIBRARIES := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800608LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
609LOCAL_SYSTEM_SHARED_LIBRARIES :=
610# Don't prelink
611LOCAL_PRELINK_MODULE := false
612# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800613LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800614
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800615include $(BUILD_SHARED_LIBRARY)
616
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800617
618# ========================================================
619# libc_malloc_debug_qemu.so
620# ========================================================
621include $(CLEAR_VARS)
622
623LOCAL_CFLAGS := \
624 $(libc_common_cflags) \
625 -DMALLOC_QEMU_INSTRUMENT
626
627LOCAL_C_INCLUDES := $(libc_common_c_includes)
628
629LOCAL_SRC_FILES := \
630 bionic/malloc_debug_qemu.c
631
632LOCAL_MODULE:= libc_malloc_debug_qemu
633
634LOCAL_SHARED_LIBRARIES := libc
635LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
636LOCAL_SYSTEM_SHARED_LIBRARIES :=
637# Don't prelink
638LOCAL_PRELINK_MODULE := false
639# Don't install on release build
640LOCAL_MODULE_TAGS := eng debug
641
642include $(BUILD_SHARED_LIBRARY)
643
644endif #!user
645
646
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800647# ========================================================
648include $(call all-makefiles-under,$(LOCAL_PATH))