external/musl/libc
Revision | 4f34e383ba89db6a00df08c2ed6aec6ef5b6aa63 (tree) |
---|---|
Time | 2019-09-05 17:00:12 |
Author | Chih-Wei Huang <cwhuang@open...> |
Commiter | Chih-Wei Huang |
Android: initial porting
@@ -0,0 +1,74 @@ | ||
1 | +# | |
2 | +# Copyright (C) 2019 The Android-x86 Open Source Project | |
3 | +# | |
4 | +# Licensed under the standard MIT license. | |
5 | +# See the COPYRIGHT in the same directory. | |
6 | +# | |
7 | + | |
8 | +LOCAL_PATH := $(call my-dir) | |
9 | + | |
10 | +include $(CLEAR_VARS) | |
11 | + | |
12 | +LOCAL_MODULE := libc-musl | |
13 | +LOCAL_MULTILIB := first | |
14 | +LOCAL_VENDOR_MODULE := true | |
15 | +LOCAL_MODULE_CLASS := SHARED_LIBRARIES | |
16 | + | |
17 | +MUSL_ARCH := $(TARGET_ARCH) | |
18 | +MUSL_SRC_DIRS := $(addprefix $(LOCAL_PATH)/,src/* ldso) | |
19 | +MUSL_BASE_SRCS := $(sort $(wildcard $(addsuffix /*.c,$(MUSL_SRC_DIRS)))) | |
20 | +MUSL_ARCH_SRCS := $(sort $(wildcard $(addsuffix /$(MUSL_ARCH)/*.[csS],$(MUSL_SRC_DIRS)))) | |
21 | +MUSL_REPLACED_SRCS = $(addsuffix .c,$(subst $(MUSL_ARCH)/,,$(basename $(MUSL_ARCH_SRCS)))) | |
22 | + | |
23 | +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(filter-out $(MUSL_REPLACED_SRCS),$(MUSL_BASE_SRCS)) $(MUSL_ARCH_SRCS)) | |
24 | + | |
25 | +LOCAL_C_INCLUDES := $(addprefix $(LOCAL_PATH)/, \ | |
26 | + arch/$(MUSL_ARCH) \ | |
27 | + arch/generic \ | |
28 | + src/include \ | |
29 | + src/internal \ | |
30 | + include) \ | |
31 | + | |
32 | +LOCAL_CFLAGS := -std=c99 -nostdinc \ | |
33 | + -ffreestanding -fexcess-precision=standard -frounding-math \ | |
34 | + -Wa,--noexecstack -D_XOPEN_SOURCE=700 -fomit-frame-pointer \ | |
35 | + -fno-unwind-tables -fno-asynchronous-unwind-tables \ | |
36 | + -ffunction-sections -fdata-sections \ | |
37 | + -Werror=implicit-function-declaration -Werror=implicit-int \ | |
38 | + -Werror=pointer-sign -Werror=pointer-arith \ | |
39 | + -Os -pipe \ | |
40 | + | |
41 | +intermediates := $(call local-generated-sources-dir) | |
42 | + | |
43 | +LOCAL_GENERATED_SOURCES := \ | |
44 | + $(intermediates)/bits/alltypes.h \ | |
45 | + $(intermediates)/bits/syscall.h \ | |
46 | + $(intermediates)/version.h | |
47 | + | |
48 | +$(intermediates)/bits/alltypes.h: $(LOCAL_PATH)/tools/mkalltypes.sed $(LOCAL_PATH)/arch/$(MUSL_ARCH)/bits/alltypes.h.in $(LOCAL_PATH)/include/alltypes.h.in | |
49 | + sed -f $^ > $@ | |
50 | + | |
51 | +$(intermediates)/bits/syscall.h: $(LOCAL_PATH)/arch/$(MUSL_ARCH)/bits/syscall.h.in | $(ACP) | |
52 | + $(ACP) $< $@ | |
53 | + sed -n -e s/__NR_/SYS_/p < $< >> $@ | |
54 | + | |
55 | +$(intermediates)/version.h: $(wildcard $(LOCAL_PATH)/VERSION $(LOCAL_PATH)/.git) | |
56 | + echo "#define VERSION \"$$(cd $(<D); sh tools/version.sh)\"" > $@ | |
57 | + | |
58 | +LOCAL_CXX_STL := none | |
59 | +LOCAL_SANITIZE := never | |
60 | +LOCAL_SYSTEM_SHARED_LIBRARIES := | |
61 | +LOCAL_NO_CRT := true | |
62 | +LOCAL_NO_DEFAULT_COMPILER_FLAGS := true | |
63 | +LOCAL_NO_LIBCOMPILER_RT := true | |
64 | +LOCAL_NO_STANDARD_LIBRARIES := true | |
65 | +LOCAL_LDFLAGS := \ | |
66 | + -Wl,--sort-common \ | |
67 | + -Wl,--gc-sections \ | |
68 | + -Wl,--hash-style=both \ | |
69 | + -Wl,--no-undefined \ | |
70 | + -Wl,--exclude-libs=ALL \ | |
71 | + -Wl,--dynamic-list=$(LOCAL_PATH)/dynamic.list \ | |
72 | + -Wl,-e,_dlstart -v | |
73 | + | |
74 | +include $(BUILD_SHARED_LIBRARY) |