blob: faca33312c25892afd6c3b94e717882ffead888c [file] [log] [blame]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -07001LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-arm/syscalls.mk
4libc_common_src_files := \
5 $(syscall_src) \
6 unistd/abort.c \
7 unistd/alarm.c \
8 unistd/brk.c \
9 unistd/creat.c \
10 unistd/daemon.c \
11 unistd/exec.c \
12 unistd/fcntl.c \
13 unistd/fnmatch.c \
14 unistd/ftok.c \
15 unistd/getcwd.c \
16 unistd/getdtablesize.c \
17 unistd/gethostname.c \
18 unistd/getopt_long.c \
19 unistd/getpgrp.c \
20 unistd/getpriority.c \
21 unistd/getpt.c \
22 unistd/isatty.c \
23 unistd/issetugid.c \
24 unistd/lseek64.c \
25 unistd/mmap.c \
26 unistd/nice.c \
27 unistd/open.c \
28 unistd/openat.c \
29 unistd/opendir.c \
30 unistd/pathconf.c \
31 unistd/perror.c \
32 unistd/popen.c \
33 unistd/pread.c \
34 unistd/pselect.c \
35 unistd/ptsname.c \
36 unistd/ptsname_r.c \
37 unistd/pwrite.c \
38 unistd/raise.c \
39 unistd/reboot.c \
40 unistd/recv.c \
41 unistd/sbrk.c \
42 unistd/send.c \
43 unistd/setegid.c \
44 unistd/seteuid.c \
45 unistd/setpgrp.c \
46 unistd/sigblock.c \
47 unistd/siglist.c \
48 unistd/signal.c \
49 unistd/sigsetmask.c \
50 unistd/sigsuspend.c \
51 unistd/sigwait.c \
52 unistd/sleep.c \
53 unistd/socketcalls.c \
54 unistd/statfs.c \
55 unistd/strsignal.c \
56 unistd/sysconf.c \
57 unistd/syslog.c \
58 unistd/system.c \
59 unistd/time.c \
60 unistd/umount.c \
61 unistd/unlockpt.c \
62 unistd/usleep.c \
63 unistd/wait.c \
64 stdio/asprintf.c \
65 stdio/fclose.c \
66 stdio/fdopen.c \
67 stdio/feof.c \
68 stdio/ferror.c \
69 stdio/fflush.c \
70 stdio/fgetc.c \
71 stdio/fgetln.c \
72 stdio/fgetpos.c \
73 stdio/fgets.c \
74 stdio/fileno.c \
75 stdio/findfp.c \
76 stdio/flags.c \
77 stdio/fopen.c \
78 stdio/fprintf.c \
79 stdio/fpurge.c \
80 stdio/fputc.c \
81 stdio/fputs.c \
82 stdio/fread.c \
83 stdio/freopen.c \
84 stdio/fscanf.c \
85 stdio/fseek.c \
86 stdio/fsetpos.c \
87 stdio/ftell.c \
88 stdio/funopen.c \
89 stdio/fvwrite.c \
90 stdio/fwalk.c \
91 stdio/fwrite.c \
92 stdio/getc.c \
93 stdio/getchar.c \
94 stdio/gets.c \
95 stdio/makebuf.c \
96 stdio/mktemp.c \
97 stdio/printf.c \
98 stdio/putc.c \
99 stdio/putchar.c \
100 stdio/puts.c \
101 stdio/putw.c \
102 stdio/refill.c \
103 stdio/remove.c \
104 stdio/rewind.c \
105 stdio/rget.c \
106 stdio/scanf.c \
107 stdio/setbuf.c \
108 stdio/setbuffer.c \
109 stdio/setvbuf.c \
110 stdio/snprintf.c\
111 stdio/sprintf.c \
112 stdio/sscanf.c \
113 stdio/stdio.c \
114 stdio/tempnam.c \
115 stdio/tmpfile.c \
116 stdio/tmpnam.c \
117 stdio/ungetc.c \
118 stdio/vasprintf.c \
119 stdio/vfprintf.c \
120 stdio/vfscanf.c \
121 stdio/vprintf.c \
122 stdio/vsnprintf.c \
123 stdio/vsprintf.c \
124 stdio/vscanf.c \
125 stdio/wbuf.c \
126 stdio/wsetup.c \
127 stdlib/_rand48.c \
128 stdlib/assert.c \
129 stdlib/atexit.c \
130 stdlib/atoi.c \
131 stdlib/atol.c \
132 stdlib/atoll.c \
133 stdlib/bsearch.c \
134 stdlib/ctype_.c \
135 stdlib/exit.c \
136 stdlib/getenv.c \
137 stdlib/jrand48.c \
138 stdlib/locale.c \
139 stdlib/lrand48.c \
140 stdlib/mrand48.c \
141 stdlib/nrand48.c \
142 stdlib/putenv.c \
143 stdlib/qsort.c \
144 stdlib/seed48.c \
145 stdlib/setenv.c \
146 stdlib/setjmperr.c \
147 stdlib/srand48.c \
148 stdlib/strntoimax.c \
149 stdlib/strntoumax.c \
150 stdlib/strtod.c \
151 stdlib/strtoimax.c \
152 stdlib/strtol.c \
153 stdlib/strtoll.c \
154 stdlib/strtoul.c \
155 stdlib/strtoull.c \
156 stdlib/strtoumax.c \
157 stdlib/tolower_.c \
158 stdlib/toupper_.c \
159 stdlib/wchar.c \
160 string/bcopy.c \
161 string/index.c \
162 string/memccpy.c \
163 string/memchr.c \
164 string/memmem.c \
165 string/memmove.c.arm \
166 string/memrchr.c \
167 string/memswap.c \
168 string/strcasecmp.c \
169 string/strcasestr.c \
170 string/strcat.c \
171 string/strchr.c \
172 string/strcmp.c \
173 string/strcpy.c \
174 string/strcspn.c \
175 string/strdup.c \
176 string/strerror.c \
177 string/strerror_r.c \
178 string/strlcat.c \
179 string/strlcpy.c \
180 string/strncat.c \
181 string/strncmp.c \
182 string/strncpy.c \
183 string/strndup.c \
184 string/strnlen.c \
185 string/strpbrk.c \
186 string/strrchr.c \
187 string/strsep.c \
188 string/strspn.c \
189 string/strstr.c \
190 string/strtok.c \
191 string/strtotimeval.c \
192 inet/bindresvport.c \
193 inet/inet_addr.c \
194 inet/inet_aton.c \
195 inet/inet_ntoa.c \
196 inet/inet_ntop.c \
197 inet/inet_pton.c \
198 tzcode/asctime.c \
199 tzcode/difftime.c \
200 tzcode/localtime.c \
201 tzcode/strftime.c \
202 tzcode/strptime.c \
203 arch-arm/bionic/__get_pc.S \
204 arch-arm/bionic/__get_sp.S \
205 arch-arm/bionic/_exit_with_stack_teardown.S \
206 arch-arm/bionic/_setjmp.S \
207 arch-arm/bionic/atomics_arm.S \
208 arch-arm/bionic/clone.S \
209 arch-arm/bionic/memcmp.S \
210 arch-arm/bionic/memcmp16.S \
211 arch-arm/bionic/memcpy.S \
212 arch-arm/bionic/memset.S \
213 arch-arm/bionic/setjmp.S \
214 arch-arm/bionic/sigsetjmp.S \
215 arch-arm/bionic/strlen.c.arm \
216 arch-arm/bionic/syscall.S \
217 arch-arm/bionic/kill.S \
218 arch-arm/bionic/tkill.S \
219 bionic/__errno.c \
220 bionic/__set_errno.c \
221 bionic/_rand48.c \
222 bionic/arc4random.c \
223 bionic/basename.c \
224 bionic/basename_r.c \
225 bionic/dirname.c \
226 bionic/dirname_r.c \
227 bionic/drand48.c \
228 bionic/eabi.c \
229 bionic/erand48.c \
230 bionic/if_nametoindex.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/thread_atexit.c \
244 bionic/utime.c \
245 bionic/utmp.c \
246 netbsd/gethnamaddr.c \
247 netbsd/isc/ev_timers.c \
248 netbsd/isc/ev_streams.c \
249 netbsd/inet/nsap_addr.c \
250 netbsd/resolv/__dn_comp.c \
251 netbsd/resolv/__res_close.c \
252 netbsd/resolv/__res_send.c \
253 netbsd/resolv/herror.c \
254 netbsd/resolv/res_comp.c \
255 netbsd/resolv/res_data.c \
256 netbsd/resolv/res_debug.c \
257 netbsd/resolv/res_init.c \
258 netbsd/resolv/res_mkquery.c \
259 netbsd/resolv/res_query.c \
260 netbsd/resolv/res_send.c \
261 netbsd/resolv/res_state.c.arm \
262 netbsd/resolv/res_cache.c \
263 netbsd/net/nsdispatch.c \
264 netbsd/net/getaddrinfo.c \
265 netbsd/net/getnameinfo.c \
266 netbsd/net/getservbyname.c \
267 netbsd/net/getservent.c \
268 netbsd/net/base64.c \
269 netbsd/net/getservbyport.c \
270 netbsd/nameser/ns_name.c \
271 netbsd/nameser/ns_parse.c \
272 netbsd/nameser/ns_ttl.c \
273 netbsd/nameser/ns_netint.c \
274 netbsd/nameser/ns_print.c \
275 netbsd/nameser/ns_samedomain.c
276
277# These files need to be arm so that gdbserver
278# can set breakpoints in them without messing
279# up any thumb code.
280libc_common_src_files += \
281 bionic/pthread.c.arm \
282 bionic/ptrace.c.arm
283
284libc_common_cflags := \
285 -DWITH_ERRLIST \
286 -DANDROID_CHANGES \
287 -DUSE_LOCKS \
288 -DREALLOC_ZERO_BYTES_FREES \
289 -D_LIBC=1 \
290 -DSOFTFLOAT \
291 -DFLOATING_POINT \
292 -DNEED_PSELECT=1
293
294ifeq ($(TARGET_BUILD_TYPE),debug)
295 libc_common_cflags += -DDEBUG
296endif
297
298ifeq ($(TARGET_ARCH),arm)
299 libc_common_cflags += -fstrict-aliasing
300endif
301
302libc_common_c_includes := \
303 $(LOCAL_PATH)/stdlib \
304 $(LOCAL_PATH)/string \
305 $(LOCAL_PATH)/stdio
306
307# libc_common.a
308# ========================================================
309
310include $(CLEAR_VARS)
311
312LOCAL_SRC_FILES := $(libc_common_src_files)
313LOCAL_CFLAGS := $(libc_common_cflags) -DUSE_DL_PREFIX
314LOCAL_C_INCLUDES := $(libc_common_c_includes)
315
316# We rename crtend.o to crtend_android.o to avoid a
317# name clash between gcc and bionic.
318GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
319$(GEN): $(LOCAL_PATH)/arch-arm/bionic/crtend.S
320 @mkdir -p $(dir $@)
321 $(TARGET_CC) -mthumb-interwork -o $@ -c $<
322ALL_GENERATED_SOURCES += $(GEN)
323
324LOCAL_MODULE := libc_common
325LOCAL_SYSTEM_SHARED_LIBRARIES :=
326
327include $(BUILD_STATIC_LIBRARY)
328
329
330# libc.a
331# ========================================================
332
333include $(CLEAR_VARS)
334
335include $(LOCAL_PATH)/arch-arm/syscalls.mk
336
337# To enable malloc leak check for statically linked programs, add
338# "WITH_MALLOC_CHECK_LIBC_A := true" to device/buildspec.mk
339WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
340
341LOCAL_SRC_FILES := \
342 $(libc_common_src_files) \
343 bionic/dlmalloc.c \
344 arch-arm/bionic/exidx_static.c \
345 bionic/libc_init_static.c
346
347ifeq ($(WITH_MALLOC_CHECK_LIBC_A),true)
348 LOCAL_SRC_FILES += bionic/malloc_leak.c.arm
349endif
350
351GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
352$(GEN): $(LOCAL_PATH)/arch-arm/bionic/crtbegin_static.S
353 @mkdir -p $(dir $@)
354 $(TARGET_CC) -mthumb-interwork -o $@ -c $<
355ALL_GENERATED_SOURCES += $(GEN)
356
357LOCAL_CFLAGS := $(libc_common_cflags)
358
359LOCAL_C_INCLUDES := $(libc_common_c_includes)
360
361ifeq ($(WITH_MALLOC_CHECK_LIBC_A),true)
362 LOCAL_CFLAGS += -DUSE_DL_PREFIX -DMALLOC_LEAK_CHECK
363endif
364
365LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
366LOCAL_MODULE:= libc
367LOCAL_SYSTEM_SHARED_LIBRARIES :=
368
369include $(BUILD_STATIC_LIBRARY)
370
371
372# libc.so
373# ========================================================
374
375include $(CLEAR_VARS)
376
377LOCAL_CFLAGS := $(libc_common_cflags)
378
379LOCAL_CFLAGS += -DUSE_DL_PREFIX
380
381LOCAL_C_INCLUDES := $(libc_common_c_includes)
382
383LOCAL_SRC_FILES := \
384 bionic/dlmalloc.c \
385 bionic/malloc_leak.c.arm \
386 arch-arm/bionic/exidx_dynamic.c \
387 bionic/libc_init_dynamic.c
388
389LOCAL_MODULE:= libc
390
391# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
392# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
393# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
394# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
395# should, instead relying on the external symbols from the dependent libraries. That would
396# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
397# you wanted!
398
399LOCAL_SHARED_LIBRARIES := libdl
400LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
401LOCAL_SYSTEM_SHARED_LIBRARIES :=
402
403GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
404$(GEN): $(LOCAL_PATH)/arch-arm/bionic/crtbegin_dynamic.S
405 @mkdir -p $(dir $@)
406 $(TARGET_CC) -mthumb-interwork -o $@ -c $<
407ALL_GENERATED_SOURCES += $(GEN)
408
409include $(BUILD_SHARED_LIBRARY)
410
411
412# libc_debug.so
413# ========================================================
414
415include $(CLEAR_VARS)
416
417LOCAL_CFLAGS := $(libc_common_cflags)
418
419LOCAL_CFLAGS += -DUSE_DL_PREFIX -DMALLOC_LEAK_CHECK
420
421LOCAL_C_INCLUDES := $(libc_common_c_includes)
422
423LOCAL_SRC_FILES := \
424 bionic/dlmalloc.c \
425 bionic/malloc_leak.c.arm \
426 arch-arm/bionic/exidx_dynamic.c \
427 bionic/libc_init_dynamic.c
428
429LOCAL_MODULE:= libc_debug
430
431# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
432# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
433# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
434# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
435# should, instead relying on the external symbols from the dependent libraries. That would
436# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
437# you wanted!
438
439LOCAL_SHARED_LIBRARIES := libdl
440LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
441LOCAL_SYSTEM_SHARED_LIBRARIES :=
442# Don't prelink
443LOCAL_PRELINK_MODULE := false
444# Don't install on release build
445LOCAL_MODULE_TAGS := eng
446
447GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
448ALL_GENERATED_SOURCES += $(GEN)
449
450include $(BUILD_SHARED_LIBRARY)
451
452# ========================================================
453include $(call all-makefiles-under,$(LOCAL_PATH))