blob: 37112ccf066954c606137897cbc56f63ebdc9a13 [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 \
29 unistd/lseek64.c \
30 unistd/mmap.c \
31 unistd/nice.c \
32 unistd/open.c \
33 unistd/openat.c \
34 unistd/opendir.c \
35 unistd/pathconf.c \
36 unistd/perror.c \
37 unistd/popen.c \
38 unistd/pread.c \
39 unistd/pselect.c \
40 unistd/ptsname.c \
41 unistd/ptsname_r.c \
42 unistd/pwrite.c \
43 unistd/raise.c \
44 unistd/reboot.c \
45 unistd/recv.c \
46 unistd/sbrk.c \
47 unistd/send.c \
48 unistd/setegid.c \
49 unistd/seteuid.c \
50 unistd/setpgrp.c \
51 unistd/sigblock.c \
52 unistd/siginterrupt.c \
53 unistd/siglist.c \
54 unistd/signal.c \
Thorsten Glaser92b10af2009-10-02 15:39:00 +020055 unistd/signame.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080056 unistd/sigsetmask.c \
57 unistd/sigsuspend.c \
58 unistd/sigwait.c \
59 unistd/sleep.c \
60 unistd/statfs.c \
61 unistd/strsignal.c \
62 unistd/sysconf.c \
63 unistd/syslog.c \
64 unistd/system.c \
65 unistd/tcgetpgrp.c \
66 unistd/tcsetpgrp.c \
67 unistd/time.c \
68 unistd/umount.c \
69 unistd/unlockpt.c \
70 unistd/usleep.c \
71 unistd/wait.c \
72 stdio/asprintf.c \
73 stdio/clrerr.c \
74 stdio/fclose.c \
75 stdio/fdopen.c \
76 stdio/feof.c \
77 stdio/ferror.c \
78 stdio/fflush.c \
79 stdio/fgetc.c \
80 stdio/fgetln.c \
81 stdio/fgetpos.c \
82 stdio/fgets.c \
83 stdio/fileno.c \
84 stdio/findfp.c \
85 stdio/flags.c \
86 stdio/flockfile.c \
87 stdio/fopen.c \
88 stdio/fprintf.c \
89 stdio/fpurge.c \
90 stdio/fputc.c \
91 stdio/fputs.c \
92 stdio/fread.c \
93 stdio/freopen.c \
94 stdio/fscanf.c \
95 stdio/fseek.c \
96 stdio/fsetpos.c \
97 stdio/ftell.c \
98 stdio/funopen.c \
99 stdio/fvwrite.c \
100 stdio/fwalk.c \
101 stdio/fwrite.c \
102 stdio/getc.c \
103 stdio/getchar.c \
104 stdio/gets.c \
105 stdio/makebuf.c \
106 stdio/mktemp.c \
107 stdio/printf.c \
108 stdio/putc.c \
109 stdio/putchar.c \
110 stdio/puts.c \
111 stdio/putw.c \
112 stdio/refill.c \
113 stdio/remove.c \
114 stdio/rewind.c \
115 stdio/rget.c \
116 stdio/scanf.c \
117 stdio/setbuf.c \
118 stdio/setbuffer.c \
119 stdio/setvbuf.c \
120 stdio/snprintf.c\
121 stdio/sprintf.c \
122 stdio/sscanf.c \
123 stdio/stdio.c \
124 stdio/tempnam.c \
125 stdio/tmpfile.c \
126 stdio/tmpnam.c \
127 stdio/ungetc.c \
128 stdio/vasprintf.c \
129 stdio/vfprintf.c \
130 stdio/vfscanf.c \
131 stdio/vprintf.c \
132 stdio/vsnprintf.c \
133 stdio/vsprintf.c \
134 stdio/vscanf.c \
135 stdio/vsscanf.c \
136 stdio/wbuf.c \
137 stdio/wsetup.c \
138 stdlib/_rand48.c \
139 stdlib/assert.c \
140 stdlib/atexit.c \
141 stdlib/atoi.c \
142 stdlib/atol.c \
143 stdlib/atoll.c \
144 stdlib/bsearch.c \
145 stdlib/ctype_.c \
146 stdlib/div.c \
147 stdlib/exit.c \
148 stdlib/getenv.c \
149 stdlib/jrand48.c \
150 stdlib/ldiv.c \
151 stdlib/lldiv.c \
152 stdlib/locale.c \
153 stdlib/lrand48.c \
154 stdlib/mrand48.c \
155 stdlib/nrand48.c \
156 stdlib/putenv.c \
157 stdlib/qsort.c \
158 stdlib/seed48.c \
159 stdlib/setenv.c \
160 stdlib/setjmperr.c \
161 stdlib/srand48.c \
162 stdlib/strntoimax.c \
163 stdlib/strntoumax.c \
164 stdlib/strtod.c \
165 stdlib/strtoimax.c \
166 stdlib/strtol.c \
167 stdlib/strtoll.c \
168 stdlib/strtoul.c \
169 stdlib/strtoull.c \
170 stdlib/strtoumax.c \
171 stdlib/tolower_.c \
172 stdlib/toupper_.c \
173 stdlib/wchar.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800174 string/index.c \
175 string/memccpy.c \
176 string/memchr.c \
177 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800178 string/memrchr.c \
179 string/memswap.c \
180 string/strcasecmp.c \
181 string/strcasestr.c \
182 string/strcat.c \
183 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800184 string/strcoll.c \
185 string/strcpy.c \
186 string/strcspn.c \
187 string/strdup.c \
188 string/strerror.c \
189 string/strerror_r.c \
190 string/strlcat.c \
191 string/strlcpy.c \
192 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800193 string/strncpy.c \
194 string/strndup.c \
195 string/strnlen.c \
196 string/strpbrk.c \
197 string/strrchr.c \
198 string/strsep.c \
199 string/strspn.c \
200 string/strstr.c \
201 string/strtok.c \
202 string/strtotimeval.c \
203 string/strxfrm.c \
204 inet/bindresvport.c \
205 inet/inet_addr.c \
206 inet/inet_aton.c \
207 inet/inet_ntoa.c \
208 inet/inet_ntop.c \
209 inet/inet_pton.c \
Szymon Jakubczak4032c1e2010-06-09 15:53:28 -0400210 inet/ether_aton.c \
211 inet/ether_ntoa.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800212 tzcode/asctime.c \
213 tzcode/difftime.c \
214 tzcode/localtime.c \
215 tzcode/strftime.c \
216 tzcode/strptime.c \
217 bionic/__errno.c \
218 bionic/__set_errno.c \
219 bionic/_rand48.c \
220 bionic/arc4random.c \
221 bionic/basename.c \
222 bionic/basename_r.c \
223 bionic/dirname.c \
224 bionic/dirname_r.c \
225 bionic/drand48.c \
226 bionic/erand48.c \
227 bionic/fork.c \
228 bionic/if_nametoindex.c \
229 bionic/if_indextoname.c \
230 bionic/ioctl.c \
231 bionic/ldexp.c \
232 bionic/libc_init_common.c \
233 bionic/logd_write.c \
234 bionic/md5.c \
235 bionic/pututline.c \
236 bionic/realpath.c \
237 bionic/semaphore.c \
238 bionic/sha1.c \
239 bionic/ssp.c \
240 bionic/stubs.c \
241 bionic/system_properties.c \
242 bionic/time64.c \
243 bionic/thread_atexit.c \
244 bionic/utime.c \
245 bionic/utmp.c \
246 netbsd/gethnamaddr.c \
247 netbsd/isc/ev_timers.c \
248 netbsd/isc/ev_streams.c \
249 netbsd/inet/nsap_addr.c \
250 netbsd/resolv/__dn_comp.c \
251 netbsd/resolv/__res_close.c \
252 netbsd/resolv/__res_send.c \
253 netbsd/resolv/herror.c \
254 netbsd/resolv/res_comp.c \
255 netbsd/resolv/res_data.c \
256 netbsd/resolv/res_debug.c \
257 netbsd/resolv/res_init.c \
258 netbsd/resolv/res_mkquery.c \
259 netbsd/resolv/res_query.c \
260 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900261 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800262 netbsd/resolv/res_cache.c \
263 netbsd/net/nsdispatch.c \
264 netbsd/net/getaddrinfo.c \
265 netbsd/net/getnameinfo.c \
266 netbsd/net/getservbyname.c \
267 netbsd/net/getservent.c \
268 netbsd/net/base64.c \
269 netbsd/net/getservbyport.c \
270 netbsd/nameser/ns_name.c \
271 netbsd/nameser/ns_parse.c \
272 netbsd/nameser/ns_ttl.c \
273 netbsd/nameser/ns_netint.c \
274 netbsd/nameser/ns_print.c \
275 netbsd/nameser/ns_samedomain.c
276
Dima Zavinca122b02009-05-27 10:52:37 -0700277# Architecture specific source files go here
278# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800279ifeq ($(TARGET_ARCH),arm)
280libc_common_src_files += \
281 bionic/eabi.c \
282 arch-arm/bionic/__get_pc.S \
283 arch-arm/bionic/__get_sp.S \
284 arch-arm/bionic/_exit_with_stack_teardown.S \
285 arch-arm/bionic/_setjmp.S \
286 arch-arm/bionic/atomics_arm.S \
287 arch-arm/bionic/clone.S \
288 arch-arm/bionic/ffs.S \
289 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700290 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800291 arch-arm/bionic/tkill.S \
292 arch-arm/bionic/memcmp.S \
293 arch-arm/bionic/memcmp16.S \
294 arch-arm/bionic/memcpy.S \
295 arch-arm/bionic/memset.S \
296 arch-arm/bionic/setjmp.S \
297 arch-arm/bionic/sigsetjmp.S \
298 arch-arm/bionic/strlen.c.arm \
299 arch-arm/bionic/syscall.S \
Matt Fischere4fa46e2010-01-11 10:02:06 +0800300 arch-arm/bionic/sigaction.c \
301 arch-arm/bionic/__sig_restorer.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900302 string/memmove.c.arm \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800303 string/bcopy.c \
304 string/strcmp.c \
305 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800306 unistd/socketcalls.c
307
308# These files need to be arm so that gdbserver
309# can set breakpoints in them without messing
310# up any thumb code.
311libc_common_src_files += \
312 bionic/pthread.c.arm \
313 bionic/pthread-timers.c.arm \
314 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700315
316# these are used by the static and dynamic versions of the libc
317# respectively
318libc_arch_static_src_files := \
319 arch-arm/bionic/exidx_static.c
320
321libc_arch_dynamic_src_files := \
322 arch-arm/bionic/exidx_dynamic.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800323else # !arm
324
325ifeq ($(TARGET_ARCH),x86)
326libc_common_src_files += \
327 arch-x86/bionic/__get_sp.S \
328 arch-x86/bionic/__get_tls.c \
329 arch-x86/bionic/__set_tls.c \
330 arch-x86/bionic/atomics_x86.S \
331 arch-x86/bionic/clone.S \
332 arch-x86/bionic/_exit_with_stack_teardown.S \
333 arch-x86/bionic/setjmp.S \
334 arch-x86/bionic/_setjmp.S \
335 arch-x86/bionic/vfork.S \
Bruce Beare3c543e12010-03-04 10:29:38 -0800336 arch-x86/bionic/syscall.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800337 arch-x86/string/bcopy_wrapper.S \
338 arch-x86/string/memcpy_wrapper.S \
339 arch-x86/string/memmove_wrapper.S \
340 arch-x86/string/bzero_wrapper.S \
341 arch-x86/string/memcmp_wrapper.S \
342 arch-x86/string/memset_wrapper.S \
343 arch-x86/string/strcmp_wrapper.S \
344 arch-x86/string/strncmp_wrapper.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800345 arch-x86/string/strlen.S \
346 bionic/pthread.c \
347 bionic/pthread-timers.c \
348 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800349
Dima Zavinca122b02009-05-27 10:52:37 -0700350# this is needed for static versions of libc
351libc_arch_static_src_files := \
352 arch-x86/bionic/dl_iterate_phdr_static.c
353
354libc_arch_dynamic_src_files :=
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900355else # !x86
356
357ifeq ($(TARGET_ARCH),sh)
358libc_common_src_files += \
359 arch-sh/bionic/__get_pc.S \
360 arch-sh/bionic/__get_sp.S \
361 arch-sh/bionic/_exit_with_stack_teardown.S \
362 arch-sh/bionic/_setjmp.S \
363 arch-sh/bionic/atomics_sh.c \
364 arch-sh/bionic/atomic_cmpxchg.S \
365 arch-sh/bionic/clone.S \
366 arch-sh/bionic/pipe.S \
367 arch-sh/bionic/memcpy.S \
368 arch-sh/bionic/memset.S \
369 arch-sh/bionic/bzero.S \
370 arch-sh/bionic/setjmp.S \
371 arch-sh/bionic/sigsetjmp.S \
372 arch-sh/bionic/syscall.S \
373 arch-sh/bionic/memmove.S \
374 arch-sh/bionic/__set_tls.c \
375 arch-sh/bionic/__get_tls.c \
376 arch-sh/bionic/ffs.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800377 string/bcopy.c \
378 string/strcmp.c \
379 string/strncmp.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900380 string/memcmp.c \
381 string/strlen.c \
382 bionic/eabi.c \
383 bionic/pthread.c \
384 bionic/pthread-timers.c \
385 bionic/ptrace.c \
386 unistd/socketcalls.c
387endif # sh
388
389endif # !x86
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800390endif # !arm
391
Dima Zavinca122b02009-05-27 10:52:37 -0700392# Define some common cflags
393# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800394libc_common_cflags := \
395 -DWITH_ERRLIST \
396 -DANDROID_CHANGES \
397 -DUSE_LOCKS \
398 -DREALLOC_ZERO_BYTES_FREES \
399 -D_LIBC=1 \
400 -DSOFTFLOAT \
401 -DFLOATING_POINT \
402 -DNEED_PSELECT=1 \
403 -DINET6 \
404 -I$(LOCAL_PATH)/private \
Dima Zavinca122b02009-05-27 10:52:37 -0700405 -DUSE_DL_PREFIX
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800406
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700407ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800408 libc_common_cflags += -DDEBUG
409endif
410
411ifeq ($(TARGET_ARCH),arm)
412 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700413 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700414 #
415 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
416 # that it should access the hardware TLS register directly in
417 # private/bionic_tls.h
418 #
419 # The value must match your kernel configuration
420 #
421 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
422 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
423 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700424else # !arm
425 ifeq ($(TARGET_ARCH),x86)
426 libc_crt_target_cflags := -m32
Bruce Beare8ff1a272010-03-04 11:03:37 -0800427
428 # Enable recent IA friendly memory routines (such as for Atom)
429 # These will not work on the earlier x86 machines
430 libc_common_cflags += -mtune=i686 -DUSE_SSSE3 -DUSE_SSE2
Dima Zavinca122b02009-05-27 10:52:37 -0700431 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 \
539 bionic/libc_init_static.c
540
Dima Zavinca122b02009-05-27 10:52:37 -0700541LOCAL_CFLAGS := $(libc_common_cflags)
542
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800543ifeq ($(WITH_MALLOC_CHECK_LIBC_A),true)
Dima Zavinca122b02009-05-27 10:52:37 -0700544 LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800545 LOCAL_SRC_FILES += bionic/malloc_leak.c.arm
546endif
547
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800548LOCAL_C_INCLUDES := $(libc_common_c_includes)
549
Dima Zavinca122b02009-05-27 10:52:37 -0700550LOCAL_MODULE := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800551LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800552LOCAL_SYSTEM_SHARED_LIBRARIES :=
553
554include $(BUILD_STATIC_LIBRARY)
555
556
Dima Zavinca122b02009-05-27 10:52:37 -0700557# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800558# libc.so
559# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800560include $(CLEAR_VARS)
561
562LOCAL_CFLAGS := $(libc_common_cflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800563LOCAL_C_INCLUDES := $(libc_common_c_includes)
564
565LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700566 $(libc_arch_dynamic_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800567 bionic/dlmalloc.c \
568 bionic/malloc_leak.c.arm \
569 bionic/libc_init_dynamic.c
570
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800571LOCAL_MODULE:= libc
572
573# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
574# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
575# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
576# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
577# should, instead relying on the external symbols from the dependent libraries. That would
578# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
579# you wanted!
580
581LOCAL_SHARED_LIBRARIES := libdl
582LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
583LOCAL_SYSTEM_SHARED_LIBRARIES :=
584
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800585include $(BUILD_SHARED_LIBRARY)
586
587
Dima Zavinca122b02009-05-27 10:52:37 -0700588# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800589# libc_debug.so
590# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800591include $(CLEAR_VARS)
592
Dima Zavinca122b02009-05-27 10:52:37 -0700593LOCAL_CFLAGS := \
594 $(libc_common_cflags) \
595 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800596
597LOCAL_C_INCLUDES := $(libc_common_c_includes)
598
599LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700600 $(libc_arch_dynamic_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800601 bionic/dlmalloc.c \
602 bionic/malloc_leak.c.arm \
603 bionic/libc_init_dynamic.c
604
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800605LOCAL_MODULE:= libc_debug
606
607# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
608# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
609# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
610# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
611# should, instead relying on the external symbols from the dependent libraries. That would
612# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
613# you wanted!
614
615LOCAL_SHARED_LIBRARIES := libdl
616LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
617LOCAL_SYSTEM_SHARED_LIBRARIES :=
618# Don't prelink
619LOCAL_PRELINK_MODULE := false
620# Don't install on release build
621LOCAL_MODULE_TAGS := eng
622
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800623include $(BUILD_SHARED_LIBRARY)
624
625# ========================================================
626include $(call all-makefiles-under,$(LOCAL_PATH))