The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
| 2 | |
| 3 | include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 4 | |
| 5 | # Define the common source files for all the libc instances |
| 6 | # ========================================================= |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 7 | libc_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 Glaser | 92b10af | 2009-10-02 15:39:00 +0200 | [diff] [blame] | 55 | unistd/signame.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 56 | 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 \ |
| 174 | string/bcopy.c \ |
| 175 | string/index.c \ |
| 176 | string/memccpy.c \ |
| 177 | string/memchr.c \ |
| 178 | string/memmem.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 179 | string/memrchr.c \ |
| 180 | string/memswap.c \ |
| 181 | string/strcasecmp.c \ |
| 182 | string/strcasestr.c \ |
| 183 | string/strcat.c \ |
| 184 | string/strchr.c \ |
| 185 | string/strcmp.c \ |
| 186 | string/strcoll.c \ |
| 187 | string/strcpy.c \ |
| 188 | string/strcspn.c \ |
| 189 | string/strdup.c \ |
| 190 | string/strerror.c \ |
| 191 | string/strerror_r.c \ |
| 192 | string/strlcat.c \ |
| 193 | string/strlcpy.c \ |
| 194 | string/strncat.c \ |
| 195 | string/strncmp.c \ |
| 196 | string/strncpy.c \ |
| 197 | string/strndup.c \ |
| 198 | string/strnlen.c \ |
| 199 | string/strpbrk.c \ |
| 200 | string/strrchr.c \ |
| 201 | string/strsep.c \ |
| 202 | string/strspn.c \ |
| 203 | string/strstr.c \ |
| 204 | string/strtok.c \ |
| 205 | string/strtotimeval.c \ |
| 206 | string/strxfrm.c \ |
| 207 | inet/bindresvport.c \ |
| 208 | inet/inet_addr.c \ |
| 209 | inet/inet_aton.c \ |
| 210 | inet/inet_ntoa.c \ |
| 211 | inet/inet_ntop.c \ |
| 212 | inet/inet_pton.c \ |
| 213 | tzcode/asctime.c \ |
| 214 | tzcode/difftime.c \ |
| 215 | tzcode/localtime.c \ |
| 216 | tzcode/strftime.c \ |
| 217 | tzcode/strptime.c \ |
| 218 | bionic/__errno.c \ |
| 219 | bionic/__set_errno.c \ |
| 220 | bionic/_rand48.c \ |
| 221 | bionic/arc4random.c \ |
| 222 | bionic/basename.c \ |
| 223 | bionic/basename_r.c \ |
| 224 | bionic/dirname.c \ |
| 225 | bionic/dirname_r.c \ |
| 226 | bionic/drand48.c \ |
| 227 | bionic/erand48.c \ |
| 228 | bionic/fork.c \ |
| 229 | bionic/if_nametoindex.c \ |
| 230 | bionic/if_indextoname.c \ |
| 231 | bionic/ioctl.c \ |
| 232 | bionic/ldexp.c \ |
| 233 | bionic/libc_init_common.c \ |
| 234 | bionic/logd_write.c \ |
| 235 | bionic/md5.c \ |
| 236 | bionic/pututline.c \ |
| 237 | bionic/realpath.c \ |
| 238 | bionic/semaphore.c \ |
| 239 | bionic/sha1.c \ |
| 240 | bionic/ssp.c \ |
| 241 | bionic/stubs.c \ |
| 242 | bionic/system_properties.c \ |
| 243 | bionic/time64.c \ |
| 244 | bionic/thread_atexit.c \ |
| 245 | bionic/utime.c \ |
| 246 | bionic/utmp.c \ |
| 247 | netbsd/gethnamaddr.c \ |
| 248 | netbsd/isc/ev_timers.c \ |
| 249 | netbsd/isc/ev_streams.c \ |
| 250 | netbsd/inet/nsap_addr.c \ |
| 251 | netbsd/resolv/__dn_comp.c \ |
| 252 | netbsd/resolv/__res_close.c \ |
| 253 | netbsd/resolv/__res_send.c \ |
| 254 | netbsd/resolv/herror.c \ |
| 255 | netbsd/resolv/res_comp.c \ |
| 256 | netbsd/resolv/res_data.c \ |
| 257 | netbsd/resolv/res_debug.c \ |
| 258 | netbsd/resolv/res_init.c \ |
| 259 | netbsd/resolv/res_mkquery.c \ |
| 260 | netbsd/resolv/res_query.c \ |
| 261 | netbsd/resolv/res_send.c \ |
Shin-ichiro KAWASAKI | 1009327 | 2009-09-28 16:11:39 +0900 | [diff] [blame] | 262 | netbsd/resolv/res_state.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 263 | netbsd/resolv/res_cache.c \ |
| 264 | netbsd/net/nsdispatch.c \ |
| 265 | netbsd/net/getaddrinfo.c \ |
| 266 | netbsd/net/getnameinfo.c \ |
| 267 | netbsd/net/getservbyname.c \ |
| 268 | netbsd/net/getservent.c \ |
| 269 | netbsd/net/base64.c \ |
| 270 | netbsd/net/getservbyport.c \ |
| 271 | netbsd/nameser/ns_name.c \ |
| 272 | netbsd/nameser/ns_parse.c \ |
| 273 | netbsd/nameser/ns_ttl.c \ |
| 274 | netbsd/nameser/ns_netint.c \ |
| 275 | netbsd/nameser/ns_print.c \ |
Colin Cross | 4fa7b10 | 2010-01-12 18:59:25 -0800 | [diff] [blame^] | 276 | netbsd/nameser/ns_samedomain.c \ |
| 277 | regex/regcomp.c \ |
| 278 | regex/regerror.c \ |
| 279 | regex/regexec.c \ |
| 280 | regex/regfree.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 281 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 282 | # Architecture specific source files go here |
| 283 | # ========================================================= |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 284 | ifeq ($(TARGET_ARCH),arm) |
| 285 | libc_common_src_files += \ |
| 286 | bionic/eabi.c \ |
| 287 | arch-arm/bionic/__get_pc.S \ |
| 288 | arch-arm/bionic/__get_sp.S \ |
| 289 | arch-arm/bionic/_exit_with_stack_teardown.S \ |
| 290 | arch-arm/bionic/_setjmp.S \ |
| 291 | arch-arm/bionic/atomics_arm.S \ |
| 292 | arch-arm/bionic/clone.S \ |
| 293 | arch-arm/bionic/ffs.S \ |
| 294 | arch-arm/bionic/kill.S \ |
David 'Digit' Turner | 2a7ad97 | 2009-09-29 14:43:38 -0700 | [diff] [blame] | 295 | arch-arm/bionic/libgcc_compat.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 296 | arch-arm/bionic/tkill.S \ |
| 297 | arch-arm/bionic/memcmp.S \ |
| 298 | arch-arm/bionic/memcmp16.S \ |
| 299 | arch-arm/bionic/memcpy.S \ |
| 300 | arch-arm/bionic/memset.S \ |
| 301 | arch-arm/bionic/setjmp.S \ |
| 302 | arch-arm/bionic/sigsetjmp.S \ |
| 303 | arch-arm/bionic/strlen.c.arm \ |
| 304 | arch-arm/bionic/syscall.S \ |
Shin-ichiro KAWASAKI | 1009327 | 2009-09-28 16:11:39 +0900 | [diff] [blame] | 305 | string/memmove.c.arm \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 306 | 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. |
| 311 | libc_common_src_files += \ |
| 312 | bionic/pthread.c.arm \ |
| 313 | bionic/pthread-timers.c.arm \ |
| 314 | bionic/ptrace.c.arm |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 315 | |
| 316 | # these are used by the static and dynamic versions of the libc |
| 317 | # respectively |
| 318 | libc_arch_static_src_files := \ |
| 319 | arch-arm/bionic/exidx_static.c |
| 320 | |
| 321 | libc_arch_dynamic_src_files := \ |
| 322 | arch-arm/bionic/exidx_dynamic.c |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 323 | else # !arm |
| 324 | |
| 325 | ifeq ($(TARGET_ARCH),x86) |
| 326 | libc_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 \ |
| 336 | arch-x86/string/bzero.S \ |
| 337 | arch-x86/string/memset.S \ |
| 338 | arch-x86/string/memcmp.S \ |
| 339 | arch-x86/string/memcpy.S \ |
| 340 | arch-x86/string/strlen.S \ |
Shin-ichiro KAWASAKI | 1009327 | 2009-09-28 16:11:39 +0900 | [diff] [blame] | 341 | string/memmove.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 342 | bionic/pthread.c \ |
| 343 | bionic/pthread-timers.c \ |
| 344 | bionic/ptrace.c |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 345 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 346 | # this is needed for static versions of libc |
| 347 | libc_arch_static_src_files := \ |
| 348 | arch-x86/bionic/dl_iterate_phdr_static.c |
| 349 | |
| 350 | libc_arch_dynamic_src_files := |
Shin-ichiro KAWASAKI | 1009327 | 2009-09-28 16:11:39 +0900 | [diff] [blame] | 351 | else # !x86 |
| 352 | |
| 353 | ifeq ($(TARGET_ARCH),sh) |
| 354 | libc_common_src_files += \ |
| 355 | arch-sh/bionic/__get_pc.S \ |
| 356 | arch-sh/bionic/__get_sp.S \ |
| 357 | arch-sh/bionic/_exit_with_stack_teardown.S \ |
| 358 | arch-sh/bionic/_setjmp.S \ |
| 359 | arch-sh/bionic/atomics_sh.c \ |
| 360 | arch-sh/bionic/atomic_cmpxchg.S \ |
| 361 | arch-sh/bionic/clone.S \ |
| 362 | arch-sh/bionic/pipe.S \ |
| 363 | arch-sh/bionic/memcpy.S \ |
| 364 | arch-sh/bionic/memset.S \ |
| 365 | arch-sh/bionic/bzero.S \ |
| 366 | arch-sh/bionic/setjmp.S \ |
| 367 | arch-sh/bionic/sigsetjmp.S \ |
| 368 | arch-sh/bionic/syscall.S \ |
| 369 | arch-sh/bionic/memmove.S \ |
| 370 | arch-sh/bionic/__set_tls.c \ |
| 371 | arch-sh/bionic/__get_tls.c \ |
| 372 | arch-sh/bionic/ffs.S \ |
| 373 | string/memcmp.c \ |
| 374 | string/strlen.c \ |
| 375 | bionic/eabi.c \ |
| 376 | bionic/pthread.c \ |
| 377 | bionic/pthread-timers.c \ |
| 378 | bionic/ptrace.c \ |
| 379 | unistd/socketcalls.c |
| 380 | endif # sh |
| 381 | |
| 382 | endif # !x86 |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 383 | endif # !arm |
| 384 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 385 | # Define some common cflags |
| 386 | # ======================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 387 | libc_common_cflags := \ |
| 388 | -DWITH_ERRLIST \ |
| 389 | -DANDROID_CHANGES \ |
| 390 | -DUSE_LOCKS \ |
| 391 | -DREALLOC_ZERO_BYTES_FREES \ |
| 392 | -D_LIBC=1 \ |
| 393 | -DSOFTFLOAT \ |
| 394 | -DFLOATING_POINT \ |
| 395 | -DNEED_PSELECT=1 \ |
| 396 | -DINET6 \ |
| 397 | -I$(LOCAL_PATH)/private \ |
Colin Cross | 4fa7b10 | 2010-01-12 18:59:25 -0800 | [diff] [blame^] | 398 | -DUSE_DL_PREFIX \ |
| 399 | -DPOSIX_MISTAKE |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 400 | |
Dave Bort | d2c9dcc | 2009-04-23 15:50:03 -0700 | [diff] [blame] | 401 | ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 402 | libc_common_cflags += -DDEBUG |
| 403 | endif |
| 404 | |
| 405 | ifeq ($(TARGET_ARCH),arm) |
| 406 | libc_common_cflags += -fstrict-aliasing |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 407 | libc_crt_target_cflags := -mthumb-interwork |
David 'Digit' Turner | 4a05d12 | 2009-09-18 13:35:05 -0700 | [diff] [blame] | 408 | # |
| 409 | # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library |
| 410 | # that it should access the hardware TLS register directly in |
| 411 | # private/bionic_tls.h |
| 412 | # |
| 413 | # The value must match your kernel configuration |
| 414 | # |
| 415 | ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) |
| 416 | libc_common_cflags += -DHAVE_ARM_TLS_REGISTER |
| 417 | endif |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 418 | else # !arm |
| 419 | ifeq ($(TARGET_ARCH),x86) |
| 420 | libc_crt_target_cflags := -m32 |
| 421 | endif # x86 |
| 422 | endif # !arm |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 423 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 424 | # Define some common includes |
| 425 | # ======================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 426 | libc_common_c_includes := \ |
| 427 | $(LOCAL_PATH)/stdlib \ |
| 428 | $(LOCAL_PATH)/string \ |
| 429 | $(LOCAL_PATH)/stdio |
| 430 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 431 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 432 | # Define the libc run-time (crt) support object files that must be built, |
| 433 | # which are needed to build all other objects (shared/static libs and |
| 434 | # executables) |
| 435 | # ========================================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 436 | |
| 437 | ifeq ($(TARGET_ARCH),x86) |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 438 | # we only need begin_so/end_so for x86, since it needs an appropriate .init |
| 439 | # section in the shared library with a function to call all the entries in |
| 440 | # .ctors section. ARM uses init_array, and does not need the function. |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 441 | GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o |
| 442 | $(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S |
| 443 | @mkdir -p $(dir $@) |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 444 | $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $< |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 445 | ALL_GENERATED_SOURCES += $(GEN) |
| 446 | |
| 447 | GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o |
| 448 | $(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S |
| 449 | @mkdir -p $(dir $@) |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 450 | $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $< |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 451 | ALL_GENERATED_SOURCES += $(GEN) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 452 | endif # TARGET_ARCH == x86 |
| 453 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 454 | |
| 455 | GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o |
| 456 | $(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S |
| 457 | @mkdir -p $(dir $@) |
| 458 | $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $< |
| 459 | ALL_GENERATED_SOURCES += $(GEN) |
| 460 | |
| 461 | GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o |
| 462 | $(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S |
| 463 | @mkdir -p $(dir $@) |
| 464 | $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $< |
| 465 | ALL_GENERATED_SOURCES += $(GEN) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 466 | |
| 467 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 468 | # We rename crtend.o to crtend_android.o to avoid a |
| 469 | # name clash between gcc and bionic. |
| 470 | GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o |
| 471 | $(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S |
| 472 | @mkdir -p $(dir $@) |
| 473 | $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $< |
| 474 | ALL_GENERATED_SOURCES += $(GEN) |
| 475 | |
| 476 | |
| 477 | # To enable malloc leak check for statically linked programs, add |
| 478 | # "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk |
| 479 | WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A)) |
| 480 | |
| 481 | # ======================================================== |
| 482 | # libc_common.a |
| 483 | # ======================================================== |
| 484 | include $(CLEAR_VARS) |
| 485 | |
| 486 | LOCAL_SRC_FILES := $(libc_common_src_files) |
| 487 | LOCAL_CFLAGS := $(libc_common_cflags) |
| 488 | LOCAL_C_INCLUDES := $(libc_common_c_includes) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 489 | LOCAL_MODULE := libc_common |
| 490 | LOCAL_SYSTEM_SHARED_LIBRARIES := |
| 491 | |
| 492 | include $(BUILD_STATIC_LIBRARY) |
| 493 | |
| 494 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 495 | # ======================================================== |
Dima Zavin | 49e5533 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 496 | # libc_nomalloc.a |
| 497 | # ======================================================== |
| 498 | # |
| 499 | # This is a version of the static C library that does not |
| 500 | # include malloc. It's useful in situations when calling |
| 501 | # the user wants to provide their own malloc implementation, |
| 502 | # or wants to explicitly disallow the use of the use of malloc, |
| 503 | # like the dynamic loader. |
| 504 | |
| 505 | include $(CLEAR_VARS) |
| 506 | |
| 507 | LOCAL_SRC_FILES := \ |
| 508 | $(libc_arch_static_src_files) \ |
| 509 | bionic/libc_init_static.c |
| 510 | |
| 511 | LOCAL_C_INCLUDES := $(libc_common_c_includes) |
| 512 | LOCAL_CFLAGS := $(libc_common_cflags) |
| 513 | |
| 514 | LOCAL_MODULE := libc_nomalloc |
| 515 | LOCAL_WHOLE_STATIC_LIBRARIES := libc_common |
| 516 | LOCAL_SYSTEM_SHARED_LIBRARIES := |
| 517 | |
| 518 | include $(BUILD_STATIC_LIBRARY) |
| 519 | |
| 520 | |
| 521 | # ======================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 522 | # libc.a |
| 523 | # ======================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 524 | include $(CLEAR_VARS) |
| 525 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 526 | LOCAL_SRC_FILES := \ |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 527 | $(libc_arch_static_src_files) \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 528 | bionic/dlmalloc.c \ |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 529 | bionic/malloc_debug_common.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 530 | bionic/libc_init_static.c |
| 531 | |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 532 | LOCAL_CFLAGS := $(libc_common_cflags) \ |
| 533 | -DLIBC_STATIC |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 534 | LOCAL_C_INCLUDES := $(libc_common_c_includes) |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 535 | LOCAL_MODULE := libc |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 536 | LOCAL_WHOLE_STATIC_LIBRARIES := libc_common |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 537 | LOCAL_SYSTEM_SHARED_LIBRARIES := |
| 538 | |
| 539 | include $(BUILD_STATIC_LIBRARY) |
| 540 | |
| 541 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 542 | # ======================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 543 | # libc.so |
| 544 | # ======================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 545 | include $(CLEAR_VARS) |
| 546 | |
| 547 | LOCAL_CFLAGS := $(libc_common_cflags) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 548 | LOCAL_C_INCLUDES := $(libc_common_c_includes) |
| 549 | |
| 550 | LOCAL_SRC_FILES := \ |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 551 | $(libc_arch_dynamic_src_files) \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 552 | bionic/dlmalloc.c \ |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 553 | bionic/malloc_debug_common.c \ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 554 | bionic/libc_init_dynamic.c |
| 555 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 556 | LOCAL_MODULE:= libc |
| 557 | |
| 558 | # WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries, |
| 559 | # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This |
| 560 | # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared |
| 561 | # external; if that were the case, then libc would not pull those symbols from libgcc.a as it |
| 562 | # should, instead relying on the external symbols from the dependent libraries. That would |
| 563 | # create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what |
| 564 | # you wanted! |
| 565 | |
| 566 | LOCAL_SHARED_LIBRARIES := libdl |
| 567 | LOCAL_WHOLE_STATIC_LIBRARIES := libc_common |
| 568 | LOCAL_SYSTEM_SHARED_LIBRARIES := |
| 569 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 570 | include $(BUILD_SHARED_LIBRARY) |
| 571 | |
| 572 | |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 573 | # For all builds, except for the -user build we will enable memory |
| 574 | # allocation checking (including memory leaks, buffer overwrites, etc.) |
| 575 | # Note that all these checks are also controlled by env. settings |
| 576 | # that can enable, or disable specific checks. Note also that some of |
| 577 | # the checks are available only in emulator and are implemeted in |
| 578 | # libc_malloc_qemu_instrumented.so. |
| 579 | ifneq ($(TARGET_BUILD_VARIANT),user) |
| 580 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 581 | # ======================================================== |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 582 | # libc_malloc_debug_leak.so |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 583 | # ======================================================== |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 584 | include $(CLEAR_VARS) |
| 585 | |
Dima Zavin | ca122b0 | 2009-05-27 10:52:37 -0700 | [diff] [blame] | 586 | LOCAL_CFLAGS := \ |
| 587 | $(libc_common_cflags) \ |
| 588 | -DMALLOC_LEAK_CHECK |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 589 | |
| 590 | LOCAL_C_INCLUDES := $(libc_common_c_includes) |
| 591 | |
| 592 | LOCAL_SRC_FILES := \ |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 593 | bionic/malloc_debug_leak.c |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 594 | |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 595 | LOCAL_MODULE:= libc_malloc_debug_leak |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 596 | |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 597 | LOCAL_SHARED_LIBRARIES := libc |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 598 | LOCAL_WHOLE_STATIC_LIBRARIES := libc_common |
| 599 | LOCAL_SYSTEM_SHARED_LIBRARIES := |
| 600 | # Don't prelink |
| 601 | LOCAL_PRELINK_MODULE := false |
| 602 | # Don't install on release build |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 603 | LOCAL_MODULE_TAGS := eng debug |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 604 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 605 | include $(BUILD_SHARED_LIBRARY) |
| 606 | |
Vladimir Chtchetkine | b74ceb2 | 2009-11-17 14:13:38 -0800 | [diff] [blame] | 607 | |
| 608 | # ======================================================== |
| 609 | # libc_malloc_debug_qemu.so |
| 610 | # ======================================================== |
| 611 | include $(CLEAR_VARS) |
| 612 | |
| 613 | LOCAL_CFLAGS := \ |
| 614 | $(libc_common_cflags) \ |
| 615 | -DMALLOC_QEMU_INSTRUMENT |
| 616 | |
| 617 | LOCAL_C_INCLUDES := $(libc_common_c_includes) |
| 618 | |
| 619 | LOCAL_SRC_FILES := \ |
| 620 | bionic/malloc_debug_qemu.c |
| 621 | |
| 622 | LOCAL_MODULE:= libc_malloc_debug_qemu |
| 623 | |
| 624 | LOCAL_SHARED_LIBRARIES := libc |
| 625 | LOCAL_WHOLE_STATIC_LIBRARIES := libc_common |
| 626 | LOCAL_SYSTEM_SHARED_LIBRARIES := |
| 627 | # Don't prelink |
| 628 | LOCAL_PRELINK_MODULE := false |
| 629 | # Don't install on release build |
| 630 | LOCAL_MODULE_TAGS := eng debug |
| 631 | |
| 632 | include $(BUILD_SHARED_LIBRARY) |
| 633 | |
| 634 | endif #!user |
| 635 | |
| 636 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 637 | # ======================================================== |
| 638 | include $(call all-makefiles-under,$(LOCAL_PATH)) |