blob: 79c89ed1e72279fb265d894962b24c9efeeec641 [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 \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800178 string/index.c \
179 string/memccpy.c \
180 string/memchr.c \
181 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800182 string/memrchr.c \
183 string/memswap.c \
184 string/strcasecmp.c \
185 string/strcasestr.c \
186 string/strcat.c \
187 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800188 string/strcoll.c \
189 string/strcpy.c \
190 string/strcspn.c \
191 string/strdup.c \
192 string/strerror.c \
193 string/strerror_r.c \
194 string/strlcat.c \
195 string/strlcpy.c \
196 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800197 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 \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700208 wchar/wcpcpy.c \
209 wchar/wcpncpy.c \
210 wchar/wcscasecmp.c \
211 wchar/wcscat.c \
212 wchar/wcschr.c \
213 wchar/wcscmp.c \
214 wchar/wcscoll.c \
215 wchar/wcscpy.c \
216 wchar/wcscspn.c \
217 wchar/wcsdup.c \
218 wchar/wcslcat.c \
219 wchar/wcslcpy.c \
220 wchar/wcslen.c \
221 wchar/wcsncasecmp.c \
222 wchar/wcsncat.c \
223 wchar/wcsncmp.c \
224 wchar/wcsncpy.c \
225 wchar/wcsnlen.c \
226 wchar/wcspbrk.c \
227 wchar/wcsrchr.c \
228 wchar/wcsspn.c \
229 wchar/wcsstr.c \
230 wchar/wcstok.c \
231 wchar/wcswidth.c \
232 wchar/wmemchr.c \
233 wchar/wmemcpy.c \
234 wchar/wmemmove.c \
235 wchar/wmemset.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800236 inet/bindresvport.c \
237 inet/inet_addr.c \
238 inet/inet_aton.c \
239 inet/inet_ntoa.c \
240 inet/inet_ntop.c \
241 inet/inet_pton.c \
242 tzcode/asctime.c \
243 tzcode/difftime.c \
244 tzcode/localtime.c \
245 tzcode/strftime.c \
246 tzcode/strptime.c \
247 bionic/__errno.c \
248 bionic/__set_errno.c \
249 bionic/_rand48.c \
Mike Chan9f691562010-03-02 10:55:58 -0800250 bionic/cpuacct.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800251 bionic/arc4random.c \
252 bionic/basename.c \
253 bionic/basename_r.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800254 bionic/clearenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800255 bionic/dirname.c \
256 bionic/dirname_r.c \
257 bionic/drand48.c \
258 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800259 bionic/err.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800260 bionic/fdprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800261 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800262 bionic/fts.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800263 bionic/if_nametoindex.c \
264 bionic/if_indextoname.c \
265 bionic/ioctl.c \
266 bionic/ldexp.c \
267 bionic/libc_init_common.c \
268 bionic/logd_write.c \
269 bionic/md5.c \
270 bionic/pututline.c \
271 bionic/realpath.c \
272 bionic/semaphore.c \
273 bionic/sha1.c \
274 bionic/ssp.c \
275 bionic/stubs.c \
276 bionic/system_properties.c \
277 bionic/time64.c \
278 bionic/thread_atexit.c \
279 bionic/utime.c \
280 bionic/utmp.c \
281 netbsd/gethnamaddr.c \
282 netbsd/isc/ev_timers.c \
283 netbsd/isc/ev_streams.c \
284 netbsd/inet/nsap_addr.c \
285 netbsd/resolv/__dn_comp.c \
286 netbsd/resolv/__res_close.c \
287 netbsd/resolv/__res_send.c \
288 netbsd/resolv/herror.c \
289 netbsd/resolv/res_comp.c \
290 netbsd/resolv/res_data.c \
291 netbsd/resolv/res_debug.c \
292 netbsd/resolv/res_init.c \
293 netbsd/resolv/res_mkquery.c \
294 netbsd/resolv/res_query.c \
295 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900296 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800297 netbsd/resolv/res_cache.c \
298 netbsd/net/nsdispatch.c \
299 netbsd/net/getaddrinfo.c \
300 netbsd/net/getnameinfo.c \
301 netbsd/net/getservbyname.c \
302 netbsd/net/getservent.c \
303 netbsd/net/base64.c \
304 netbsd/net/getservbyport.c \
305 netbsd/nameser/ns_name.c \
306 netbsd/nameser/ns_parse.c \
307 netbsd/nameser/ns_ttl.c \
308 netbsd/nameser/ns_netint.c \
309 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800310 netbsd/nameser/ns_samedomain.c \
311 regex/regcomp.c \
312 regex/regerror.c \
313 regex/regexec.c \
314 regex/regfree.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800315
Dima Zavinca122b02009-05-27 10:52:37 -0700316# Architecture specific source files go here
317# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800318ifeq ($(TARGET_ARCH),arm)
319libc_common_src_files += \
320 bionic/eabi.c \
David 'Digit' Turner97cf7f32010-01-22 18:59:05 -0800321 bionic/bionic_clone.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800322 arch-arm/bionic/__get_pc.S \
323 arch-arm/bionic/__get_sp.S \
324 arch-arm/bionic/_exit_with_stack_teardown.S \
325 arch-arm/bionic/_setjmp.S \
326 arch-arm/bionic/atomics_arm.S \
327 arch-arm/bionic/clone.S \
328 arch-arm/bionic/ffs.S \
329 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700330 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800331 arch-arm/bionic/tkill.S \
332 arch-arm/bionic/memcmp.S \
333 arch-arm/bionic/memcmp16.S \
334 arch-arm/bionic/memcpy.S \
335 arch-arm/bionic/memset.S \
336 arch-arm/bionic/setjmp.S \
337 arch-arm/bionic/sigsetjmp.S \
338 arch-arm/bionic/strlen.c.arm \
339 arch-arm/bionic/syscall.S \
Matt Fischere4fa46e2010-01-11 10:02:06 +0800340 arch-arm/bionic/sigaction.c \
341 arch-arm/bionic/__sig_restorer.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900342 string/memmove.c.arm \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800343 string/bcopy.c \
344 string/strcmp.c \
345 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800346 unistd/socketcalls.c
347
348# These files need to be arm so that gdbserver
349# can set breakpoints in them without messing
350# up any thumb code.
351libc_common_src_files += \
352 bionic/pthread.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700353 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800354 bionic/pthread-timers.c.arm \
355 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700356
357# these are used by the static and dynamic versions of the libc
358# respectively
359libc_arch_static_src_files := \
360 arch-arm/bionic/exidx_static.c
361
362libc_arch_dynamic_src_files := \
363 arch-arm/bionic/exidx_dynamic.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800364else # !arm
365
366ifeq ($(TARGET_ARCH),x86)
367libc_common_src_files += \
368 arch-x86/bionic/__get_sp.S \
369 arch-x86/bionic/__get_tls.c \
370 arch-x86/bionic/__set_tls.c \
371 arch-x86/bionic/atomics_x86.S \
372 arch-x86/bionic/clone.S \
373 arch-x86/bionic/_exit_with_stack_teardown.S \
374 arch-x86/bionic/setjmp.S \
375 arch-x86/bionic/_setjmp.S \
376 arch-x86/bionic/vfork.S \
Bruce Beare3c543e12010-03-04 10:29:38 -0800377 arch-x86/bionic/syscall.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800378 arch-x86/string/bcopy_wrapper.S \
379 arch-x86/string/memcpy_wrapper.S \
380 arch-x86/string/memmove_wrapper.S \
381 arch-x86/string/bzero_wrapper.S \
382 arch-x86/string/memcmp_wrapper.S \
383 arch-x86/string/memset_wrapper.S \
384 arch-x86/string/strcmp_wrapper.S \
385 arch-x86/string/strncmp_wrapper.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800386 arch-x86/string/strlen.S \
387 bionic/pthread.c \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700388 bionic/pthread-rwlocks.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800389 bionic/pthread-timers.c \
390 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800391
Dima Zavinca122b02009-05-27 10:52:37 -0700392# this is needed for static versions of libc
393libc_arch_static_src_files := \
394 arch-x86/bionic/dl_iterate_phdr_static.c
395
396libc_arch_dynamic_src_files :=
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900397else # !x86
398
399ifeq ($(TARGET_ARCH),sh)
400libc_common_src_files += \
401 arch-sh/bionic/__get_pc.S \
402 arch-sh/bionic/__get_sp.S \
403 arch-sh/bionic/_exit_with_stack_teardown.S \
404 arch-sh/bionic/_setjmp.S \
405 arch-sh/bionic/atomics_sh.c \
406 arch-sh/bionic/atomic_cmpxchg.S \
407 arch-sh/bionic/clone.S \
408 arch-sh/bionic/pipe.S \
409 arch-sh/bionic/memcpy.S \
410 arch-sh/bionic/memset.S \
411 arch-sh/bionic/bzero.S \
412 arch-sh/bionic/setjmp.S \
413 arch-sh/bionic/sigsetjmp.S \
414 arch-sh/bionic/syscall.S \
415 arch-sh/bionic/memmove.S \
416 arch-sh/bionic/__set_tls.c \
417 arch-sh/bionic/__get_tls.c \
418 arch-sh/bionic/ffs.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800419 string/bcopy.c \
420 string/strcmp.c \
421 string/strncmp.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900422 string/memcmp.c \
423 string/strlen.c \
424 bionic/eabi.c \
425 bionic/pthread.c \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700426 bionic/pthread-rwlocks.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900427 bionic/pthread-timers.c \
428 bionic/ptrace.c \
429 unistd/socketcalls.c
430endif # sh
431
432endif # !x86
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800433endif # !arm
434
Dima Zavinca122b02009-05-27 10:52:37 -0700435# Define some common cflags
436# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800437libc_common_cflags := \
438 -DWITH_ERRLIST \
439 -DANDROID_CHANGES \
440 -DUSE_LOCKS \
441 -DREALLOC_ZERO_BYTES_FREES \
442 -D_LIBC=1 \
443 -DSOFTFLOAT \
444 -DFLOATING_POINT \
445 -DNEED_PSELECT=1 \
446 -DINET6 \
447 -I$(LOCAL_PATH)/private \
Colin Cross4fa7b102010-01-12 18:59:25 -0800448 -DUSE_DL_PREFIX \
449 -DPOSIX_MISTAKE
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800450
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800451# these macro definitions are required to implement the
452# 'timezone' and 'daylight' global variables, as well as
453# properly update the 'tm_gmtoff' field in 'struct tm'.
454#
455libc_common_cflags += \
456 -DTM_GMTOFF=tm_gmtoff \
457 -DUSG_COMPAT=1
458
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700459ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800460 libc_common_cflags += -DDEBUG
461endif
462
463ifeq ($(TARGET_ARCH),arm)
464 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700465 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700466 #
467 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
468 # that it should access the hardware TLS register directly in
469 # private/bionic_tls.h
470 #
471 # The value must match your kernel configuration
472 #
473 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
474 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
475 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700476else # !arm
477 ifeq ($(TARGET_ARCH),x86)
478 libc_crt_target_cflags := -m32
Bruce Beare8ff1a272010-03-04 11:03:37 -0800479
480 # Enable recent IA friendly memory routines (such as for Atom)
481 # These will not work on the earlier x86 machines
482 libc_common_cflags += -mtune=i686 -DUSE_SSSE3 -DUSE_SSE2
Dima Zavinca122b02009-05-27 10:52:37 -0700483 endif # x86
484endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800485
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700486# Define ANDROID_SMP appropriately.
487ifeq ($(TARGET_CPU_SMP),true)
488 libc_common_cflags += -DANDROID_SMP=1
489else
490 libc_common_cflags += -DANDROID_SMP=0
491endif
492
493
Dima Zavinca122b02009-05-27 10:52:37 -0700494# Define some common includes
495# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800496libc_common_c_includes := \
497 $(LOCAL_PATH)/stdlib \
498 $(LOCAL_PATH)/string \
499 $(LOCAL_PATH)/stdio
500
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800501
Dima Zavinca122b02009-05-27 10:52:37 -0700502# Define the libc run-time (crt) support object files that must be built,
503# which are needed to build all other objects (shared/static libs and
504# executables)
505# ==========================================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800506
507ifeq ($(TARGET_ARCH),x86)
Dima Zavinca122b02009-05-27 10:52:37 -0700508# we only need begin_so/end_so for x86, since it needs an appropriate .init
509# section in the shared library with a function to call all the entries in
510# .ctors section. ARM uses init_array, and does not need the function.
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800511GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
512$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
513 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700514 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800515ALL_GENERATED_SOURCES += $(GEN)
516
517GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
518$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
519 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700520 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800521ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800522endif # TARGET_ARCH == x86
523
Dima Zavinca122b02009-05-27 10:52:37 -0700524
525GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
526$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
527 @mkdir -p $(dir $@)
528 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
529ALL_GENERATED_SOURCES += $(GEN)
530
531GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
532$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
533 @mkdir -p $(dir $@)
534 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
535ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800536
537
Dima Zavinca122b02009-05-27 10:52:37 -0700538# We rename crtend.o to crtend_android.o to avoid a
539# name clash between gcc and bionic.
540GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
541$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
542 @mkdir -p $(dir $@)
543 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
544ALL_GENERATED_SOURCES += $(GEN)
545
546
547# To enable malloc leak check for statically linked programs, add
548# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
549WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
550
551# ========================================================
552# libc_common.a
553# ========================================================
554include $(CLEAR_VARS)
555
556LOCAL_SRC_FILES := $(libc_common_src_files)
557LOCAL_CFLAGS := $(libc_common_cflags)
558LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800559LOCAL_MODULE := libc_common
560LOCAL_SYSTEM_SHARED_LIBRARIES :=
561
562include $(BUILD_STATIC_LIBRARY)
563
564
Dima Zavinca122b02009-05-27 10:52:37 -0700565# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700566# libc_nomalloc.a
567# ========================================================
568#
569# This is a version of the static C library that does not
570# include malloc. It's useful in situations when calling
571# the user wants to provide their own malloc implementation,
572# or wants to explicitly disallow the use of the use of malloc,
573# like the dynamic loader.
574
575include $(CLEAR_VARS)
576
577LOCAL_SRC_FILES := \
578 $(libc_arch_static_src_files) \
579 bionic/libc_init_static.c
580
581LOCAL_C_INCLUDES := $(libc_common_c_includes)
582LOCAL_CFLAGS := $(libc_common_cflags)
583
584LOCAL_MODULE := libc_nomalloc
585LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
586LOCAL_SYSTEM_SHARED_LIBRARIES :=
587
588include $(BUILD_STATIC_LIBRARY)
589
590
591# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800592# libc.a
593# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800594include $(CLEAR_VARS)
595
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800596LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700597 $(libc_arch_static_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800598 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800599 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800600 bionic/libc_init_static.c
601
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800602LOCAL_CFLAGS := $(libc_common_cflags) \
603 -DLIBC_STATIC
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800604LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700605LOCAL_MODULE := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800606LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800607LOCAL_SYSTEM_SHARED_LIBRARIES :=
608
609include $(BUILD_STATIC_LIBRARY)
610
611
Dima Zavinca122b02009-05-27 10:52:37 -0700612# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800613# libc.so
614# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800615include $(CLEAR_VARS)
616
617LOCAL_CFLAGS := $(libc_common_cflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800618LOCAL_C_INCLUDES := $(libc_common_c_includes)
619
620LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700621 $(libc_arch_dynamic_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800622 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800623 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800624 bionic/libc_init_dynamic.c
625
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800626LOCAL_MODULE:= libc
627
628# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
629# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
630# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
631# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
632# should, instead relying on the external symbols from the dependent libraries. That would
633# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
634# you wanted!
635
636LOCAL_SHARED_LIBRARIES := libdl
637LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
638LOCAL_SYSTEM_SHARED_LIBRARIES :=
639
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800640include $(BUILD_SHARED_LIBRARY)
641
642
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800643# For all builds, except for the -user build we will enable memory
644# allocation checking (including memory leaks, buffer overwrites, etc.)
645# Note that all these checks are also controlled by env. settings
646# that can enable, or disable specific checks. Note also that some of
647# the checks are available only in emulator and are implemeted in
648# libc_malloc_qemu_instrumented.so.
649ifneq ($(TARGET_BUILD_VARIANT),user)
650
Dima Zavinca122b02009-05-27 10:52:37 -0700651# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800652# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800653# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800654include $(CLEAR_VARS)
655
Dima Zavinca122b02009-05-27 10:52:37 -0700656LOCAL_CFLAGS := \
657 $(libc_common_cflags) \
658 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800659
660LOCAL_C_INCLUDES := $(libc_common_c_includes)
661
662LOCAL_SRC_FILES := \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800663 bionic/malloc_debug_leak.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800664
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800665LOCAL_MODULE:= libc_malloc_debug_leak
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800666
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800667LOCAL_SHARED_LIBRARIES := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800668LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
669LOCAL_SYSTEM_SHARED_LIBRARIES :=
670# Don't prelink
671LOCAL_PRELINK_MODULE := false
672# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800673LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800674
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800675include $(BUILD_SHARED_LIBRARY)
676
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800677
678# ========================================================
679# libc_malloc_debug_qemu.so
680# ========================================================
681include $(CLEAR_VARS)
682
683LOCAL_CFLAGS := \
684 $(libc_common_cflags) \
685 -DMALLOC_QEMU_INSTRUMENT
686
687LOCAL_C_INCLUDES := $(libc_common_c_includes)
688
689LOCAL_SRC_FILES := \
690 bionic/malloc_debug_qemu.c
691
692LOCAL_MODULE:= libc_malloc_debug_qemu
693
694LOCAL_SHARED_LIBRARIES := libc
695LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
696LOCAL_SYSTEM_SHARED_LIBRARIES :=
697# Don't prelink
698LOCAL_PRELINK_MODULE := false
699# Don't install on release build
700LOCAL_MODULE_TAGS := eng debug
701
702include $(BUILD_SHARED_LIBRARY)
703
704endif #!user
705
706
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800707# ========================================================
708include $(call all-makefiles-under,$(LOCAL_PATH))