blob: c32cc30fef21fe5415de156b3d4af5e854d2bc57 [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 \
Colin Crossfc10b242010-01-13 17:48:34 -0800225 bionic/clearenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800226 bionic/dirname.c \
227 bionic/dirname_r.c \
228 bionic/drand48.c \
229 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800230 bionic/err.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800231 bionic/fdprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800232 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800233 bionic/fts.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800234 bionic/if_nametoindex.c \
235 bionic/if_indextoname.c \
236 bionic/ioctl.c \
237 bionic/ldexp.c \
238 bionic/libc_init_common.c \
239 bionic/logd_write.c \
240 bionic/md5.c \
241 bionic/pututline.c \
242 bionic/realpath.c \
243 bionic/semaphore.c \
244 bionic/sha1.c \
245 bionic/ssp.c \
246 bionic/stubs.c \
247 bionic/system_properties.c \
248 bionic/time64.c \
249 bionic/thread_atexit.c \
250 bionic/utime.c \
251 bionic/utmp.c \
252 netbsd/gethnamaddr.c \
253 netbsd/isc/ev_timers.c \
254 netbsd/isc/ev_streams.c \
255 netbsd/inet/nsap_addr.c \
256 netbsd/resolv/__dn_comp.c \
257 netbsd/resolv/__res_close.c \
258 netbsd/resolv/__res_send.c \
259 netbsd/resolv/herror.c \
260 netbsd/resolv/res_comp.c \
261 netbsd/resolv/res_data.c \
262 netbsd/resolv/res_debug.c \
263 netbsd/resolv/res_init.c \
264 netbsd/resolv/res_mkquery.c \
265 netbsd/resolv/res_query.c \
266 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900267 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800268 netbsd/resolv/res_cache.c \
269 netbsd/net/nsdispatch.c \
270 netbsd/net/getaddrinfo.c \
271 netbsd/net/getnameinfo.c \
272 netbsd/net/getservbyname.c \
273 netbsd/net/getservent.c \
274 netbsd/net/base64.c \
275 netbsd/net/getservbyport.c \
276 netbsd/nameser/ns_name.c \
277 netbsd/nameser/ns_parse.c \
278 netbsd/nameser/ns_ttl.c \
279 netbsd/nameser/ns_netint.c \
280 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800281 netbsd/nameser/ns_samedomain.c \
282 regex/regcomp.c \
283 regex/regerror.c \
284 regex/regexec.c \
285 regex/regfree.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800286
Dima Zavinca122b02009-05-27 10:52:37 -0700287# Architecture specific source files go here
288# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800289ifeq ($(TARGET_ARCH),arm)
290libc_common_src_files += \
291 bionic/eabi.c \
292 arch-arm/bionic/__get_pc.S \
293 arch-arm/bionic/__get_sp.S \
294 arch-arm/bionic/_exit_with_stack_teardown.S \
295 arch-arm/bionic/_setjmp.S \
296 arch-arm/bionic/atomics_arm.S \
297 arch-arm/bionic/clone.S \
298 arch-arm/bionic/ffs.S \
299 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700300 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800301 arch-arm/bionic/tkill.S \
302 arch-arm/bionic/memcmp.S \
303 arch-arm/bionic/memcmp16.S \
304 arch-arm/bionic/memcpy.S \
305 arch-arm/bionic/memset.S \
306 arch-arm/bionic/setjmp.S \
307 arch-arm/bionic/sigsetjmp.S \
308 arch-arm/bionic/strlen.c.arm \
309 arch-arm/bionic/syscall.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900310 string/memmove.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800311 unistd/socketcalls.c
312
313# These files need to be arm so that gdbserver
314# can set breakpoints in them without messing
315# up any thumb code.
316libc_common_src_files += \
317 bionic/pthread.c.arm \
318 bionic/pthread-timers.c.arm \
319 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700320
321# these are used by the static and dynamic versions of the libc
322# respectively
323libc_arch_static_src_files := \
324 arch-arm/bionic/exidx_static.c
325
326libc_arch_dynamic_src_files := \
327 arch-arm/bionic/exidx_dynamic.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800328else # !arm
329
330ifeq ($(TARGET_ARCH),x86)
331libc_common_src_files += \
332 arch-x86/bionic/__get_sp.S \
333 arch-x86/bionic/__get_tls.c \
334 arch-x86/bionic/__set_tls.c \
335 arch-x86/bionic/atomics_x86.S \
336 arch-x86/bionic/clone.S \
337 arch-x86/bionic/_exit_with_stack_teardown.S \
338 arch-x86/bionic/setjmp.S \
339 arch-x86/bionic/_setjmp.S \
340 arch-x86/bionic/vfork.S \
341 arch-x86/string/bzero.S \
342 arch-x86/string/memset.S \
343 arch-x86/string/memcmp.S \
344 arch-x86/string/memcpy.S \
345 arch-x86/string/strlen.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900346 string/memmove.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800347 bionic/pthread.c \
348 bionic/pthread-timers.c \
349 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800350
Dima Zavinca122b02009-05-27 10:52:37 -0700351# this is needed for static versions of libc
352libc_arch_static_src_files := \
353 arch-x86/bionic/dl_iterate_phdr_static.c
354
355libc_arch_dynamic_src_files :=
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900356else # !x86
357
358ifeq ($(TARGET_ARCH),sh)
359libc_common_src_files += \
360 arch-sh/bionic/__get_pc.S \
361 arch-sh/bionic/__get_sp.S \
362 arch-sh/bionic/_exit_with_stack_teardown.S \
363 arch-sh/bionic/_setjmp.S \
364 arch-sh/bionic/atomics_sh.c \
365 arch-sh/bionic/atomic_cmpxchg.S \
366 arch-sh/bionic/clone.S \
367 arch-sh/bionic/pipe.S \
368 arch-sh/bionic/memcpy.S \
369 arch-sh/bionic/memset.S \
370 arch-sh/bionic/bzero.S \
371 arch-sh/bionic/setjmp.S \
372 arch-sh/bionic/sigsetjmp.S \
373 arch-sh/bionic/syscall.S \
374 arch-sh/bionic/memmove.S \
375 arch-sh/bionic/__set_tls.c \
376 arch-sh/bionic/__get_tls.c \
377 arch-sh/bionic/ffs.S \
378 string/memcmp.c \
379 string/strlen.c \
380 bionic/eabi.c \
381 bionic/pthread.c \
382 bionic/pthread-timers.c \
383 bionic/ptrace.c \
384 unistd/socketcalls.c
385endif # sh
386
387endif # !x86
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800388endif # !arm
389
Dima Zavinca122b02009-05-27 10:52:37 -0700390# Define some common cflags
391# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800392libc_common_cflags := \
393 -DWITH_ERRLIST \
394 -DANDROID_CHANGES \
395 -DUSE_LOCKS \
396 -DREALLOC_ZERO_BYTES_FREES \
397 -D_LIBC=1 \
398 -DSOFTFLOAT \
399 -DFLOATING_POINT \
400 -DNEED_PSELECT=1 \
401 -DINET6 \
402 -I$(LOCAL_PATH)/private \
Colin Cross4fa7b102010-01-12 18:59:25 -0800403 -DUSE_DL_PREFIX \
404 -DPOSIX_MISTAKE
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800405
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700406ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800407 libc_common_cflags += -DDEBUG
408endif
409
410ifeq ($(TARGET_ARCH),arm)
411 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700412 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700413 #
414 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
415 # that it should access the hardware TLS register directly in
416 # private/bionic_tls.h
417 #
418 # The value must match your kernel configuration
419 #
420 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
421 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
422 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700423else # !arm
424 ifeq ($(TARGET_ARCH),x86)
425 libc_crt_target_cflags := -m32
426 endif # x86
427endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800428
Dima Zavinca122b02009-05-27 10:52:37 -0700429# Define some common includes
430# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800431libc_common_c_includes := \
432 $(LOCAL_PATH)/stdlib \
433 $(LOCAL_PATH)/string \
434 $(LOCAL_PATH)/stdio
435
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800436
Dima Zavinca122b02009-05-27 10:52:37 -0700437# Define the libc run-time (crt) support object files that must be built,
438# which are needed to build all other objects (shared/static libs and
439# executables)
440# ==========================================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800441
442ifeq ($(TARGET_ARCH),x86)
Dima Zavinca122b02009-05-27 10:52:37 -0700443# we only need begin_so/end_so for x86, since it needs an appropriate .init
444# section in the shared library with a function to call all the entries in
445# .ctors section. ARM uses init_array, and does not need the function.
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800446GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
447$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
448 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700449 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800450ALL_GENERATED_SOURCES += $(GEN)
451
452GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
453$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
454 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700455 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800456ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800457endif # TARGET_ARCH == x86
458
Dima Zavinca122b02009-05-27 10:52:37 -0700459
460GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
461$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
462 @mkdir -p $(dir $@)
463 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
464ALL_GENERATED_SOURCES += $(GEN)
465
466GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
467$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
468 @mkdir -p $(dir $@)
469 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
470ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800471
472
Dima Zavinca122b02009-05-27 10:52:37 -0700473# We rename crtend.o to crtend_android.o to avoid a
474# name clash between gcc and bionic.
475GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
476$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
477 @mkdir -p $(dir $@)
478 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
479ALL_GENERATED_SOURCES += $(GEN)
480
481
482# To enable malloc leak check for statically linked programs, add
483# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
484WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
485
486# ========================================================
487# libc_common.a
488# ========================================================
489include $(CLEAR_VARS)
490
491LOCAL_SRC_FILES := $(libc_common_src_files)
492LOCAL_CFLAGS := $(libc_common_cflags)
493LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800494LOCAL_MODULE := libc_common
495LOCAL_SYSTEM_SHARED_LIBRARIES :=
496
497include $(BUILD_STATIC_LIBRARY)
498
499
Dima Zavinca122b02009-05-27 10:52:37 -0700500# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700501# libc_nomalloc.a
502# ========================================================
503#
504# This is a version of the static C library that does not
505# include malloc. It's useful in situations when calling
506# the user wants to provide their own malloc implementation,
507# or wants to explicitly disallow the use of the use of malloc,
508# like the dynamic loader.
509
510include $(CLEAR_VARS)
511
512LOCAL_SRC_FILES := \
513 $(libc_arch_static_src_files) \
514 bionic/libc_init_static.c
515
516LOCAL_C_INCLUDES := $(libc_common_c_includes)
517LOCAL_CFLAGS := $(libc_common_cflags)
518
519LOCAL_MODULE := libc_nomalloc
520LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
521LOCAL_SYSTEM_SHARED_LIBRARIES :=
522
523include $(BUILD_STATIC_LIBRARY)
524
525
526# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800527# libc.a
528# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800529include $(CLEAR_VARS)
530
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800531LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700532 $(libc_arch_static_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800533 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800534 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800535 bionic/libc_init_static.c
536
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800537LOCAL_CFLAGS := $(libc_common_cflags) \
538 -DLIBC_STATIC
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800539LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700540LOCAL_MODULE := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800541LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800542LOCAL_SYSTEM_SHARED_LIBRARIES :=
543
544include $(BUILD_STATIC_LIBRARY)
545
546
Dima Zavinca122b02009-05-27 10:52:37 -0700547# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800548# libc.so
549# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800550include $(CLEAR_VARS)
551
552LOCAL_CFLAGS := $(libc_common_cflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800553LOCAL_C_INCLUDES := $(libc_common_c_includes)
554
555LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700556 $(libc_arch_dynamic_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800557 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800558 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800559 bionic/libc_init_dynamic.c
560
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800561LOCAL_MODULE:= libc
562
563# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
564# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
565# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
566# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
567# should, instead relying on the external symbols from the dependent libraries. That would
568# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
569# you wanted!
570
571LOCAL_SHARED_LIBRARIES := libdl
572LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
573LOCAL_SYSTEM_SHARED_LIBRARIES :=
574
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800575include $(BUILD_SHARED_LIBRARY)
576
577
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800578# For all builds, except for the -user build we will enable memory
579# allocation checking (including memory leaks, buffer overwrites, etc.)
580# Note that all these checks are also controlled by env. settings
581# that can enable, or disable specific checks. Note also that some of
582# the checks are available only in emulator and are implemeted in
583# libc_malloc_qemu_instrumented.so.
584ifneq ($(TARGET_BUILD_VARIANT),user)
585
Dima Zavinca122b02009-05-27 10:52:37 -0700586# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800587# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800588# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800589include $(CLEAR_VARS)
590
Dima Zavinca122b02009-05-27 10:52:37 -0700591LOCAL_CFLAGS := \
592 $(libc_common_cflags) \
593 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800594
595LOCAL_C_INCLUDES := $(libc_common_c_includes)
596
597LOCAL_SRC_FILES := \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800598 bionic/malloc_debug_leak.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800599
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800600LOCAL_MODULE:= libc_malloc_debug_leak
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800601
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800602LOCAL_SHARED_LIBRARIES := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800603LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
604LOCAL_SYSTEM_SHARED_LIBRARIES :=
605# Don't prelink
606LOCAL_PRELINK_MODULE := false
607# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800608LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800609
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800610include $(BUILD_SHARED_LIBRARY)
611
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800612
613# ========================================================
614# libc_malloc_debug_qemu.so
615# ========================================================
616include $(CLEAR_VARS)
617
618LOCAL_CFLAGS := \
619 $(libc_common_cflags) \
620 -DMALLOC_QEMU_INSTRUMENT
621
622LOCAL_C_INCLUDES := $(libc_common_c_includes)
623
624LOCAL_SRC_FILES := \
625 bionic/malloc_debug_qemu.c
626
627LOCAL_MODULE:= libc_malloc_debug_qemu
628
629LOCAL_SHARED_LIBRARIES := libc
630LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
631LOCAL_SYSTEM_SHARED_LIBRARIES :=
632# Don't prelink
633LOCAL_PRELINK_MODULE := false
634# Don't install on release build
635LOCAL_MODULE_TAGS := eng debug
636
637include $(BUILD_SHARED_LIBRARY)
638
639endif #!user
640
641
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800642# ========================================================
643include $(call all-makefiles-under,$(LOCAL_PATH))