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