]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blob - libc/Android.mk
Merge "Implement some of the missing LFS64 support."
[android-sdk/platform-bionic.git] / libc / Android.mk
1 LOCAL_PATH := $(call my-dir)
3 # Make everything depend on any changes to included makefiles.
4 libc_common_additional_dependencies := $(LOCAL_PATH)/Android.mk
6 # Load config for TARGET_ARCH
7 my_2nd_arch_prefix :=
8 include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
9 libc_common_additional_dependencies += \
10     $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
13 ifdef TARGET_2ND_ARCH
14 # Load config for TARGET_2ND_ARCH
15 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
16 include $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
17 my_2nd_arch_prefix :=
18 libc_common_additional_dependencies += \
19     $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
20 endif
22 # crt obj files
23 # ========================================================
24 # crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
25 libc_crt_target_cflags := \
26     -I$(LOCAL_PATH)/include \
27     -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
29 my_2nd_arch_prefix :=
30 include $(LOCAL_PATH)/crt.mk
31 ifdef TARGET_2ND_ARCH
32 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
33 include $(LOCAL_PATH)/crt.mk
34 my_2nd_arch_prefix :=
35 endif
37 # Define the common source files for all the libc instances
38 # =========================================================
39 libc_common_src_files := \
40     bionic/arc4random.c \
41     bionic/atoi.c \
42     bionic/atol.c \
43     bionic/atoll.c \
44     bionic/bindresvport.c \
45     bionic/clearenv.c \
46     bionic/daemon.c \
47     bionic/err.c \
48     bionic/ether_aton.c \
49     bionic/ether_ntoa.c \
50     bionic/fdprintf.c \
51     bionic/flockfile.c \
52     bionic/ftime.c \
53     bionic/ftok.c \
54     bionic/fts.c \
55     bionic/getdtablesize.c \
56     bionic/gethostname.c \
57     bionic/getpgrp.c \
58     bionic/getpriority.c \
59     bionic/getpt.c \
60     bionic/if_indextoname.c \
61     bionic/if_nametoindex.c \
62     bionic/initgroups.c \
63     bionic/ioctl.c \
64     bionic/isatty.c \
65     bionic/issetugid.c \
66     bionic/ldexp.c \
67     bionic/md5.c \
68     bionic/memmem.c \
69     bionic/memswap.c \
70     bionic/pathconf.c \
71     bionic/perror.c \
72     bionic/ptsname.c \
73     bionic/ptsname_r.c \
74     bionic/pututline.c \
75     bionic/recv.c \
76     bionic/sched_cpualloc.c \
77     bionic/sched_cpucount.c \
78     bionic/semaphore.c \
79     bionic/send.c \
80     bionic/setpgrp.c \
81     bionic/sigblock.c \
82     bionic/siginterrupt.c \
83     bionic/sigsetmask.c \
84     bionic/strndup.c \
85     bionic/strntoimax.c \
86     bionic/strntoumax.c \
87     bionic/strtotimeval.c \
88     bionic/system_properties.c \
89     bionic/system_properties_compat.c \
90     bionic/tcgetpgrp.c \
91     bionic/tcsetpgrp.c \
92     bionic/time64.c \
93     bionic/umount.c \
94     bionic/unlockpt.c \
95     bionic/utmp.c \
96     bionic/wcscoll.c \
97     stdio/asprintf.c \
98     stdio/fflush.c \
99     stdio/fgetc.c \
100     stdio/findfp.c \
101     stdio/fprintf.c \
102     stdio/fputc.c \
103     stdio/fread.c \
104     stdio/freopen.c \
105     stdio/fscanf.c \
106     stdio/fseek.c \
107     stdio/ftell.c \
108     stdio/fvwrite.c \
109     stdio/gets.c \
110     stdio/printf.c \
111     stdio/refill.c \
112     stdio/rewind.c \
113     stdio/scanf.c \
114     stdio/snprintf.c\
115     stdio/sprintf.c \
116     stdio/sscanf.c \
117     stdio/stdio.c \
118     stdio/ungetc.c \
119     stdio/vasprintf.c \
120     stdio/vfprintf.c \
121     stdio/vfscanf.c \
122     stdio/vprintf.c \
123     stdio/vscanf.c \
124     stdio/vsnprintf.c \
125     stdio/vsprintf.c \
126     stdio/vsscanf.c \
127     stdio/wbuf.c \
128     stdlib/atexit.c \
129     stdlib/ctype_.c \
130     stdlib/getenv.c \
131     stdlib/putenv.c \
132     stdlib/setenv.c \
133     stdlib/strtod.c \
134     stdlib/strtoimax.c \
135     stdlib/strtol.c \
136     stdlib/strtoll.c \
137     stdlib/strtoul.c \
138     stdlib/strtoull.c \
139     stdlib/strtoumax.c \
140     stdlib/tolower_.c \
141     stdlib/toupper_.c \
142     string/strcasecmp.c \
143     string/strcspn.c \
144     string/strdup.c \
145     string/strpbrk.c \
146     string/strsep.c \
147     string/strspn.c \
148     string/strstr.c \
149     string/strtok.c \
150     unistd/alarm.c \
151     unistd/exec.c \
152     unistd/fnmatch.c \
153     unistd/syslog.c \
154     unistd/system.c \
155     unistd/time.c \
156     wchar/wcswidth.c \
157     wchar/wcsxfrm.c \
160 libc_dns_src_files += \
161     netbsd/gethnamaddr.c \
162     netbsd/inet/nsap_addr.c \
163     netbsd/nameser/ns_name.c \
164     netbsd/nameser/ns_netint.c \
165     netbsd/nameser/ns_parse.c \
166     netbsd/nameser/ns_print.c \
167     netbsd/nameser/ns_samedomain.c \
168     netbsd/nameser/ns_ttl.c \
169     netbsd/net/base64.c \
170     netbsd/net/getaddrinfo.c \
171     netbsd/net/getnameinfo.c \
172     netbsd/net/getservbyname.c \
173     netbsd/net/getservbyport.c \
174     netbsd/net/getservent.c \
175     netbsd/net/nsdispatch.c \
176     netbsd/resolv/__dn_comp.c \
177     netbsd/resolv/herror.c \
178     netbsd/resolv/res_cache.c \
179     netbsd/resolv/__res_close.c \
180     netbsd/resolv/res_comp.c \
181     netbsd/resolv/res_data.c \
182     netbsd/resolv/res_debug.c \
183     netbsd/resolv/res_init.c \
184     netbsd/resolv/res_mkquery.c \
185     netbsd/resolv/res_query.c \
186     netbsd/resolv/__res_send.c \
187     netbsd/resolv/res_send.c \
188     netbsd/resolv/res_state.c \
191 # Fortify implementations of libc functions.
192 libc_common_src_files += \
193     bionic/__FD_chk.cpp \
194     bionic/__fgets_chk.cpp \
195     bionic/__memmove_chk.cpp \
196     bionic/__read_chk.cpp \
197     bionic/__recvfrom_chk.cpp \
198     bionic/__strchr_chk.cpp \
199     bionic/__strlcat_chk.cpp \
200     bionic/__strlcpy_chk.cpp \
201     bionic/__strlen_chk.cpp \
202     bionic/__strncat_chk.cpp \
203     bionic/__strncpy_chk.cpp \
204     bionic/__strrchr_chk.cpp \
205     bionic/__umask_chk.cpp \
206     bionic/__vsnprintf_chk.cpp \
207     bionic/__vsprintf_chk.cpp \
209 libc_bionic_src_files := \
210     bionic/abort.cpp \
211     bionic/access.cpp \
212     bionic/assert.cpp \
213     bionic/__bionic_name_mem.cpp \
214     bionic/bionic_time_conversions.cpp \
215     bionic/brk.cpp \
216     bionic/chmod.cpp \
217     bionic/chown.cpp \
218     bionic/clone.cpp \
219     bionic/dirent.cpp \
220     bionic/dup2.cpp \
221     bionic/epoll_create.cpp \
222     bionic/epoll_pwait.cpp \
223     bionic/epoll_wait.cpp \
224     bionic/__errno.cpp \
225     bionic/eventfd_read.cpp \
226     bionic/eventfd_write.cpp \
227     bionic/ffs.cpp \
228     bionic/fork.cpp \
229     bionic/futimens.cpp \
230     bionic/getauxval.cpp \
231     bionic/getcwd.cpp \
232     bionic/inotify_init.cpp \
233     bionic/lchown.cpp \
234     bionic/libc_init_common.cpp \
235     bionic/libc_logging.cpp \
236     bionic/libgen.cpp \
237     bionic/link.cpp \
238     bionic/lstat.cpp \
239     bionic/mkdir.cpp \
240     bionic/mkfifo.cpp \
241     bionic/mknod.cpp \
242     bionic/open.cpp \
243     bionic/pause.cpp \
244     bionic/pipe.cpp \
245     bionic/poll.cpp \
246     bionic/posix_fallocate.cpp \
247     bionic/pthread_atfork.cpp \
248     bionic/pthread_attr.cpp \
249     bionic/pthread_cond.cpp \
250     bionic/pthread_create.cpp \
251     bionic/pthread_detach.cpp \
252     bionic/pthread_equal.cpp \
253     bionic/pthread_exit.cpp \
254     bionic/pthread_getcpuclockid.cpp \
255     bionic/pthread_getschedparam.cpp \
256     bionic/pthread_internals.cpp \
257     bionic/pthread_join.cpp \
258     bionic/pthread_key.cpp \
259     bionic/pthread_kill.cpp \
260     bionic/pthread_mutex.cpp \
261     bionic/pthread_once.cpp \
262     bionic/pthread_rwlock.cpp \
263     bionic/pthread_self.cpp \
264     bionic/pthread_setname_np.cpp \
265     bionic/pthread_setschedparam.cpp \
266     bionic/pthread_sigmask.cpp \
267     bionic/ptrace.cpp \
268     bionic/raise.cpp \
269     bionic/readlink.cpp \
270     bionic/reboot.cpp \
271     bionic/rename.cpp \
272     bionic/rmdir.cpp \
273     bionic/sbrk.cpp \
274     bionic/scandir.cpp \
275     bionic/sched_getaffinity.cpp \
276     bionic/sched_getcpu.cpp \
277     bionic/setegid.cpp \
278     bionic/__set_errno.cpp \
279     bionic/seteuid.cpp \
280     bionic/setlocale.cpp \
281     bionic/sigaction.cpp \
282     bionic/sigaddset.cpp \
283     bionic/sigdelset.cpp \
284     bionic/sigemptyset.cpp \
285     bionic/sigfillset.cpp \
286     bionic/sigismember.cpp \
287     bionic/signal.cpp \
288     bionic/signalfd.cpp \
289     bionic/sigpending.cpp \
290     bionic/sigprocmask.cpp \
291     bionic/sigsuspend.cpp \
292     bionic/sigwait.cpp \
293     bionic/stat.cpp \
294     bionic/statvfs.cpp \
295     bionic/strerror.cpp \
296     bionic/strerror_r.cpp \
297     bionic/strsignal.cpp \
298     bionic/stubs.cpp \
299     bionic/symlink.cpp \
300     bionic/sysconf.cpp \
301     bionic/sys_siglist.c \
302     bionic/sys_signame.c \
303     bionic/tdestroy.cpp \
304     bionic/thread_atexit.cpp \
305     bionic/timer.cpp \
306     bionic/tmpfile.cpp \
307     bionic/unlink.cpp \
308     bionic/utimes.cpp \
309     bionic/wait.cpp \
310     bionic/wchar.cpp \
313 libc_upstream_freebsd_src_files := \
314     upstream-freebsd/lib/libc/gen/sleep.c \
315     upstream-freebsd/lib/libc/gen/usleep.c \
316     upstream-freebsd/lib/libc/stdio/clrerr.c \
317     upstream-freebsd/lib/libc/stdio/fclose.c \
318     upstream-freebsd/lib/libc/stdio/fdopen.c \
319     upstream-freebsd/lib/libc/stdio/feof.c \
320     upstream-freebsd/lib/libc/stdio/ferror.c \
321     upstream-freebsd/lib/libc/stdio/fgetln.c \
322     upstream-freebsd/lib/libc/stdio/fgetpos.c \
323     upstream-freebsd/lib/libc/stdio/fgets.c \
324     upstream-freebsd/lib/libc/stdio/fileno.c \
325     upstream-freebsd/lib/libc/stdio/flags.c \
326     upstream-freebsd/lib/libc/stdio/fopen.c \
327     upstream-freebsd/lib/libc/stdio/fpurge.c \
328     upstream-freebsd/lib/libc/stdio/fputs.c \
329     upstream-freebsd/lib/libc/stdio/fsetpos.c \
330     upstream-freebsd/lib/libc/stdio/funopen.c \
331     upstream-freebsd/lib/libc/stdio/fwalk.c \
332     upstream-freebsd/lib/libc/stdio/fwrite.c \
333     upstream-freebsd/lib/libc/stdio/getc.c \
334     upstream-freebsd/lib/libc/stdio/getchar.c \
335     upstream-freebsd/lib/libc/stdio/makebuf.c \
336     upstream-freebsd/lib/libc/stdio/mktemp.c \
337     upstream-freebsd/lib/libc/stdio/putc.c \
338     upstream-freebsd/lib/libc/stdio/putchar.c \
339     upstream-freebsd/lib/libc/stdio/puts.c \
340     upstream-freebsd/lib/libc/stdio/putw.c \
341     upstream-freebsd/lib/libc/stdio/remove.c \
342     upstream-freebsd/lib/libc/stdio/rget.c \
343     upstream-freebsd/lib/libc/stdio/setbuf.c \
344     upstream-freebsd/lib/libc/stdio/setbuffer.c \
345     upstream-freebsd/lib/libc/stdio/setvbuf.c \
346     upstream-freebsd/lib/libc/stdio/tempnam.c \
347     upstream-freebsd/lib/libc/stdio/tmpnam.c \
348     upstream-freebsd/lib/libc/stdio/wsetup.c \
349     upstream-freebsd/lib/libc/stdlib/abs.c \
350     upstream-freebsd/lib/libc/stdlib/getopt_long.c \
351     upstream-freebsd/lib/libc/stdlib/imaxabs.c \
352     upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
353     upstream-freebsd/lib/libc/stdlib/labs.c \
354     upstream-freebsd/lib/libc/stdlib/llabs.c \
355     upstream-freebsd/lib/libc/stdlib/qsort.c \
356     upstream-freebsd/lib/libc/stdlib/realpath.c \
357     upstream-freebsd/lib/libc/string/wcpcpy.c \
358     upstream-freebsd/lib/libc/string/wcpncpy.c \
359     upstream-freebsd/lib/libc/string/wcscasecmp.c \
360     upstream-freebsd/lib/libc/string/wcscspn.c \
361     upstream-freebsd/lib/libc/string/wcsdup.c \
362     upstream-freebsd/lib/libc/string/wcslcat.c \
363     upstream-freebsd/lib/libc/string/wcslcpy.c \
364     upstream-freebsd/lib/libc/string/wcsncasecmp.c \
365     upstream-freebsd/lib/libc/string/wcsncat.c \
366     upstream-freebsd/lib/libc/string/wcsncmp.c \
367     upstream-freebsd/lib/libc/string/wcsncpy.c \
368     upstream-freebsd/lib/libc/string/wcsnlen.c \
369     upstream-freebsd/lib/libc/string/wcspbrk.c \
370     upstream-freebsd/lib/libc/string/wcsspn.c \
371     upstream-freebsd/lib/libc/string/wcsstr.c \
372     upstream-freebsd/lib/libc/string/wcstok.c \
373     upstream-freebsd/lib/libc/string/wmemchr.c \
374     upstream-freebsd/lib/libc/string/wmemcpy.c \
375     upstream-freebsd/lib/libc/string/wmemmove.c \
376     upstream-freebsd/lib/libc/string/wmemset.c \
378 libc_upstream_netbsd_src_files := \
379     upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
380     upstream-netbsd/common/lib/libc/inet/inet_addr.c \
381     upstream-netbsd/libc/gen/ftw.c \
382     upstream-netbsd/libc/gen/nftw.c \
383     upstream-netbsd/libc/gen/nice.c \
384     upstream-netbsd/libc/gen/popen.c \
385     upstream-netbsd/libc/gen/psignal.c \
386     upstream-netbsd/libc/gen/setjmperr.c \
387     upstream-netbsd/libc/gen/utime.c \
388     upstream-netbsd/libc/inet/inet_ntoa.c \
389     upstream-netbsd/libc/inet/inet_ntop.c \
390     upstream-netbsd/libc/inet/inet_pton.c \
391     upstream-netbsd/libc/isc/ev_streams.c \
392     upstream-netbsd/libc/isc/ev_timers.c \
393     upstream-netbsd/libc/regex/regcomp.c \
394     upstream-netbsd/libc/regex/regerror.c \
395     upstream-netbsd/libc/regex/regexec.c \
396     upstream-netbsd/libc/regex/regfree.c \
397     upstream-netbsd/libc/stdio/getdelim.c \
398     upstream-netbsd/libc/stdio/getline.c \
399     upstream-netbsd/libc/stdlib/bsearch.c \
400     upstream-netbsd/libc/stdlib/div.c \
401     upstream-netbsd/libc/stdlib/drand48.c \
402     upstream-netbsd/libc/stdlib/erand48.c \
403     upstream-netbsd/libc/stdlib/exit.c \
404     upstream-netbsd/libc/stdlib/jrand48.c \
405     upstream-netbsd/libc/stdlib/ldiv.c \
406     upstream-netbsd/libc/stdlib/lldiv.c \
407     upstream-netbsd/libc/stdlib/lrand48.c \
408     upstream-netbsd/libc/stdlib/mrand48.c \
409     upstream-netbsd/libc/stdlib/nrand48.c \
410     upstream-netbsd/libc/stdlib/_rand48.c \
411     upstream-netbsd/libc/stdlib/seed48.c \
412     upstream-netbsd/libc/stdlib/srand48.c \
413     upstream-netbsd/libc/stdlib/tdelete.c \
414     upstream-netbsd/libc/stdlib/tfind.c \
415     upstream-netbsd/libc/stdlib/tsearch.c \
416     upstream-netbsd/libc/string/memccpy.c \
417     upstream-netbsd/libc/string/strcasestr.c \
418     upstream-netbsd/libc/string/strcoll.c \
419     upstream-netbsd/libc/string/strxfrm.c \
420     upstream-netbsd/libc/thread-stub/__isthreaded.c \
421     upstream-netbsd/libc/unistd/killpg.c \
423 libc_arch_static_src_files := \
424     bionic/dl_iterate_phdr_static.cpp \
426 # Define some common cflags
427 # ========================================================
428 libc_common_cflags := \
429     -DANDROID_CHANGES \
430     -D_LIBC=1 \
431     -Wall -Wextra \
433 # Try to catch typical 32-bit assumptions that break with 64-bit pointers.
434 libc_common_cflags += \
435     -Werror=pointer-to-int-cast \
436     -Werror=int-to-pointer-cast \
437     -Werror=type-limits \
439 ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
440   libc_common_cflags += -DDEBUG
441 endif
443 # To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
444 # the appropriate BoardConfig.mk file.
446 ifneq ($(BOARD_MALLOC_ALIGNMENT),)
447   libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
448 endif
450 # Define ANDROID_SMP appropriately.
451 ifeq ($(TARGET_CPU_SMP),true)
452     libc_common_cflags += -DANDROID_SMP=1
453 else
454     libc_common_cflags += -DANDROID_SMP=0
455 endif
457 # Define some common conlyflags
458 libc_common_conlyflags := \
459     -std=gnu99
461 # Define some common cppflags
462 libc_common_cppflags := \
463     -std=gnu++11
465 # Define some common includes
466 # ========================================================
467 libc_common_c_includes := \
468     $(LOCAL_PATH)/stdlib  \
469     $(LOCAL_PATH)/string  \
470     $(LOCAL_PATH)/stdio   \
471     external/safe-iop/include
473 # ========================================================
474 # Add in the arch-specific flags.
475 # Must be called with $(eval).
476 # $(1): the LOCAL_ variable name
477 # $(2): the bionic variable name to pull in
478 define patch-up-arch-specific-flags
479 $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
480 ifdef TARGET_2ND_ARCH
481 $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
482 endif
483 endef
486 # ========================================================
487 # libbionic_ssp.a - stack protector code
488 # ========================================================
490 # The stack protector code needs to be compiled
491 # with -fno-stack-protector, since it modifies the
492 # stack canary.
494 include $(CLEAR_VARS)
496 LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
497 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector -Werror
498 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
499 LOCAL_CPPFLAGS := $(libc_common_cppflags)
500 LOCAL_C_INCLUDES := $(libc_common_c_includes)
501 LOCAL_MODULE := libbionic_ssp
502 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
503 LOCAL_SYSTEM_SHARED_LIBRARIES :=
505 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
506 include $(BUILD_STATIC_LIBRARY)
509 # ========================================================
510 # libc_tzcode.a - upstream 'tzcode' code
511 # ========================================================
513 include $(CLEAR_VARS)
515 LOCAL_SRC_FILES := \
516     tzcode/asctime.c \
517     tzcode/difftime.c \
518     tzcode/localtime.c \
519     tzcode/strftime.c \
520     tzcode/strptime.c \
522 LOCAL_CFLAGS := \
523     $(libc_common_cflags) \
524     -DSTD_INSPIRED=1 \
525     -DTZDIR=\"/system/usr/share/zoneinfo\" \
526     -DTM_GMTOFF=tm_gmtoff \
527     -DUSG_COMPAT=1
528 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
529 LOCAL_CPPFLAGS := $(libc_common_cppflags)
530 LOCAL_C_INCLUDES := $(libc_common_c_includes)
531 LOCAL_MODULE := libc_tzcode
532 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
533 LOCAL_SYSTEM_SHARED_LIBRARIES :=
535 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
536 include $(BUILD_STATIC_LIBRARY)
539 # ========================================================
540 # libc_dns.a - modified NetBSD DNS code
541 # ========================================================
543 include $(CLEAR_VARS)
545 LOCAL_SRC_FILES := $(libc_dns_src_files)
546 LOCAL_CFLAGS := \
547     $(libc_common_cflags) \
548     -DINET6 \
549     -I$(LOCAL_PATH)/private \
550     -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for NetBSD private headers
552 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
553 LOCAL_CPPFLAGS := $(libc_common_cppflags)
554 LOCAL_C_INCLUDES := $(libc_common_c_includes)
555 LOCAL_MODULE := libc_dns
556 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
557 LOCAL_SYSTEM_SHARED_LIBRARIES :=
559 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
560 include $(BUILD_STATIC_LIBRARY)
563 # ========================================================
564 # libc_freebsd.a - upstream FreeBSD C library code
565 # ========================================================
567 # These files are built with the freebsd-compat.h header file
568 # automatically included.
570 include $(CLEAR_VARS)
572 LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
573 LOCAL_CFLAGS := \
574     $(libc_common_cflags) \
575     -I$(LOCAL_PATH)/upstream-freebsd \
576     -I$(LOCAL_PATH)/upstream-freebsd/libc/include \
577     -include upstream-freebsd/freebsd-compat.h
578 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
579 LOCAL_CPPFLAGS := $(libc_common_cppflags)
580 LOCAL_C_INCLUDES := $(libc_common_c_includes)
581 LOCAL_MODULE := libc_freebsd
582 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
583 LOCAL_SYSTEM_SHARED_LIBRARIES :=
585 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
586 include $(BUILD_STATIC_LIBRARY)
589 # ========================================================
590 # libc_netbsd.a - upstream NetBSD C library code
591 # ========================================================
593 # These files are built with the netbsd-compat.h header file
594 # automatically included.
596 include $(CLEAR_VARS)
598 LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
599 LOCAL_CFLAGS := \
600     $(libc_common_cflags) \
601     -DPOSIX_MISTAKE \
602     -I$(LOCAL_PATH)/upstream-netbsd \
603     -I$(LOCAL_PATH)/upstream-netbsd/libc/include \
604     -include upstream-netbsd/netbsd-compat.h
605 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
606 LOCAL_CPPFLAGS := $(libc_common_cppflags)
607 LOCAL_C_INCLUDES := $(libc_common_c_includes)
608 LOCAL_MODULE := libc_netbsd
609 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
610 LOCAL_SYSTEM_SHARED_LIBRARIES :=
612 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
613 include $(BUILD_STATIC_LIBRARY)
616 # ========================================================
617 # libc_bionic.a - home-grown C library code
618 # ========================================================
620 include $(CLEAR_VARS)
622 LOCAL_SRC_FILES := $(libc_bionic_src_files)
623 LOCAL_CFLAGS := $(libc_common_cflags) -Werror
624 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
625 LOCAL_CPPFLAGS := $(libc_common_cppflags)
626 LOCAL_C_INCLUDES := $(libc_common_c_includes)
627 LOCAL_MODULE := libc_bionic
628 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
629 LOCAL_SYSTEM_SHARED_LIBRARIES :=
631 # Set -DPTHREAD_DEBUG_ENABLED=true to enable support for pthread deadlock prediction.
632 # Since this code is experimental it is disabled by default.
633 LOCAL_CFLAGS += -DPTHREAD_DEBUG_ENABLED=false
635 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
636 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
637 include $(BUILD_STATIC_LIBRARY)
640 # ========================================================
641 # libc_syscalls.a
642 # ========================================================
644 include $(CLEAR_VARS)
646 LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
647 ifdef TARGET_2ND_ARCH
648 LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
649 endif
650 LOCAL_MODULE := libc_syscalls
651 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
652 LOCAL_SYSTEM_SHARED_LIBRARIES :=
654 include $(BUILD_STATIC_LIBRARY)
657 # ========================================================
658 # libc_common.a
659 # ========================================================
661 include $(CLEAR_VARS)
663 LOCAL_SRC_FILES := $(libc_common_src_files)
664 LOCAL_CFLAGS := $(libc_common_cflags)
665 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
666 LOCAL_CPPFLAGS := $(libc_common_cppflags)
667 LOCAL_C_INCLUDES := $(libc_common_c_includes)
668 LOCAL_MODULE := libc_common
669 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
670 LOCAL_WHOLE_STATIC_LIBRARIES := \
671     libbionic_ssp \
672     libc_bionic \
673     libc_dns \
674     libc_freebsd \
675     libc_netbsd \
676     libc_syscalls \
677     libc_tzcode \
679 LOCAL_SYSTEM_SHARED_LIBRARIES :=
681 # TODO: split out the asflags.
682 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
684 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
685 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
686 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
687 include $(BUILD_STATIC_LIBRARY)
690 # ========================================================
691 # libc_nomalloc.a
692 # ========================================================
694 # This is a version of the static C library that does not
695 # include malloc. It's useful in situations when the user wants
696 # to provide their own malloc implementation, or wants to
697 # explicitly disallow the use of the use of malloc,
698 # such as in the dynamic loader.
700 include $(CLEAR_VARS)
702 LOCAL_SRC_FILES := \
703     $(libc_arch_static_src_files) \
704     $(libc_static_common_src_files) \
705     bionic/libc_init_static.cpp
707 LOCAL_C_INCLUDES := $(libc_common_c_includes)
708 LOCAL_CFLAGS := $(libc_common_cflags) \
709                 -DLIBC_STATIC
710 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
711 LOCAL_CPPFLAGS := $(libc_common_cppflags)
713 LOCAL_MODULE := libc_nomalloc
714 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
715 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
716 LOCAL_SYSTEM_SHARED_LIBRARIES :=
718 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
719 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
720 include $(BUILD_STATIC_LIBRARY)
723 # ========================================================
724 # libc.a
725 # ========================================================
726 include $(CLEAR_VARS)
728 LOCAL_SRC_FILES := \
729     $(libc_arch_static_src_files) \
730     $(libc_static_common_src_files) \
731     bionic/dlmalloc.c \
732     bionic/malloc_debug_common.cpp \
733     bionic/libc_init_static.cpp \
735 LOCAL_CFLAGS := $(libc_common_cflags) \
736                 -DLIBC_STATIC
737 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
738 LOCAL_CPPFLAGS := $(libc_common_cppflags)
739 LOCAL_C_INCLUDES := $(libc_common_c_includes)
740 LOCAL_MODULE := libc
741 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
742 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
743 LOCAL_SYSTEM_SHARED_LIBRARIES :=
745 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
746 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
747 include $(BUILD_STATIC_LIBRARY)
750 # ========================================================
751 # libc.so
752 # ========================================================
753 include $(CLEAR_VARS)
755 LOCAL_CFLAGS := $(libc_common_cflags)
756 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
757 LOCAL_CPPFLAGS := $(libc_common_cppflags)
758 LOCAL_C_INCLUDES := $(libc_common_c_includes)
760 LOCAL_SRC_FILES := \
761     $(libc_arch_dynamic_src_files) \
762     $(libc_static_common_src_files) \
763     bionic/dlmalloc.c \
764     bionic/malloc_debug_common.cpp \
765     bionic/debug_mapinfo.cpp \
766     bionic/debug_stacktrace.cpp \
767     bionic/pthread_debug.cpp \
768     bionic/libc_init_dynamic.cpp \
770 LOCAL_MODULE:= libc
771 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
772 LOCAL_REQUIRED_MODULES := tzdata
774 # WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
775 # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
776 # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
777 # external; if that were the case, then libc would not pull those symbols from libgcc.a as it
778 # should, instead relying on the external symbols from the dependent libraries.  That would
779 # create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
780 # you wanted!
782 LOCAL_SHARED_LIBRARIES := libdl
783 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
784 LOCAL_SYSTEM_SHARED_LIBRARIES :=
786 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
787 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
788 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
789 # special for arm
790 LOCAL_NO_CRT_arm := true
791 LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
792 LOCAL_SRC_FILES_arm += \
793     arch-common/bionic/crtbegin_so.c \
794     arch-arm/bionic/atexit_legacy.c \
795     arch-common/bionic/crtend_so.S
797 include $(BUILD_SHARED_LIBRARY)
800 # For all builds, except for the -user build we will enable memory
801 # allocation checking (including memory leaks, buffer overwrites, etc.)
802 # Note that all these checks are also controlled by env. settings
803 # that can enable, or disable specific checks. Note also that some of
804 # the checks are available only in emulator and are implemeted in
805 # libc_malloc_qemu_instrumented.so.
806 ifneq ($(TARGET_BUILD_VARIANT),user)
808 # ========================================================
809 # libc_malloc_debug_leak.so
810 # ========================================================
811 include $(CLEAR_VARS)
813 LOCAL_CFLAGS := \
814     $(libc_common_cflags) \
815     -DMALLOC_LEAK_CHECK
816 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
817 LOCAL_CPPFLAGS := $(libc_common_cppflags)
819 LOCAL_C_INCLUDES := $(libc_common_c_includes)
821 LOCAL_SRC_FILES := \
822     bionic/debug_mapinfo.cpp \
823     bionic/debug_stacktrace.cpp \
824     bionic/malloc_debug_leak.cpp \
825     bionic/malloc_debug_check.cpp \
827 LOCAL_MODULE:= libc_malloc_debug_leak
828 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
830 LOCAL_SHARED_LIBRARIES := libc libdl
831 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
832 LOCAL_SYSTEM_SHARED_LIBRARIES :=
833 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
835 # Don't install on release build
836 LOCAL_MODULE_TAGS := eng debug
838 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
839 include $(BUILD_SHARED_LIBRARY)
842 # ========================================================
843 # libc_malloc_debug_qemu.so
844 # ========================================================
845 include $(CLEAR_VARS)
847 LOCAL_CFLAGS := \
848     $(libc_common_cflags) \
849     -DMALLOC_QEMU_INSTRUMENT
850 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
851 LOCAL_CPPFLAGS := $(libc_common_cppflags)
853 LOCAL_C_INCLUDES := $(libc_common_c_includes)
855 LOCAL_SRC_FILES := \
856     bionic/malloc_debug_qemu.cpp
858 LOCAL_MODULE:= libc_malloc_debug_qemu
859 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
861 LOCAL_SHARED_LIBRARIES := libc libdl
862 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
863 LOCAL_SYSTEM_SHARED_LIBRARIES :=
865 # Don't install on release build
866 LOCAL_MODULE_TAGS := eng debug
868 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
869 include $(BUILD_SHARED_LIBRARY)
871 endif  #!user
874 # ========================================================
875 include $(call all-makefiles-under,$(LOCAL_PATH))