blob: adb82d3a40110dda4e6595829e92d859c405ae25 [file] [log] [blame]
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -07001# Configuration for Linux on ARM.
2# Included by combo/select.make
3
4# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
5ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),)
6$(combo_target)TOOLS_PREFIX := \
7 prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
8endif
9
10$(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
11$(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
12$(combo_target)AR := $($(combo_target)TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
13$(combo_target)OBJCOPY := $($(combo_target)TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
14$(combo_target)LD := $($(combo_target)TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
15
16$(combo_target)NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
17
18TARGET_arm_release_CFLAGS := -fomit-frame-pointer \
19 -fstrict-aliasing \
20 -funswitch-loops \
21 -finline-limit=300
22
23TARGET_thumb_release_CFLAGS := -mthumb \
24 -Os \
25 -fomit-frame-pointer \
26 -fno-strict-aliasing \
27 -finline-limit=64
28
29# When building for debug, compile everything as arm.
30TARGET_arm_debug_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer -fno-strict-aliasing
31TARGET_thumb_debug_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer
32
33# NOTE: if you try to build a debug build with thumb, several
34# of the libraries (libpv, libwebcore, libkjs) need to be built
35# with -mlong-calls. When built at -O0, those libraries are
36# too big for a thumb "BL <label>" to go from one end to the other.
37
38## As hopefully a temporary hack,
39## use this to force a full ARM build (for easier debugging in gdb)
40## (don't forget to do a clean build)
41##TARGET_arm_release_CFLAGS := $(TARGET_arm_release_CFLAGS) -fno-omit-frame-pointer
42##TARGET_thumb_release_CFLAGS := $(TARGET_thumb_release_CFLAGS) -marm -fno-omit-frame-pointer
43
44## on some hosts, the target cross-compiler is not available so do not run this command
45ifneq ($(wildcard $($(combo_target)CC)),)
46$(combo_target)LIBGCC := $(shell $($(combo_target)CC) -mthumb-interwork -print-libgcc-file-name)
47endif
48
49$(combo_target)GLOBAL_CFLAGS += \
50 -march=armv5te -mtune=xscale \
51 -msoft-float -fpic \
52 -mthumb-interwork \
53 -ffunction-sections \
54 -funwind-tables \
55 -fstack-protector \
56 -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \
57 -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
58 -include $(call select-android-config-h,linux-arm)
59
60$(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
61
62$(combo_target)RELEASE_CFLAGS := \
63 -DSK_RELEASE -DNDEBUG \
64 -O2 -g \
65 -Wstrict-aliasing=2 \
66 -finline-functions \
67 -fno-inline-functions-called-once \
68 -fgcse-after-reload \
69 -frerun-cse-after-loop \
70 -frename-registers
71
72libc_root := bionic/libc
73libm_root := bionic/libm
74libstdc++_root := bionic/libstdc++
75libthread_db_root := bionic/libthread_db
76
77# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
78# symlinks located in out/ to point to the appropriate kernel
79# headers. see 'config/kernel_headers.make' for more details
80#
81ifneq ($(CUSTOM_KERNEL_HEADERS),)
82 KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
83 KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS)
84else
85 KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
86 KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH)
87endif
88KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
89
90$(combo_target)C_INCLUDES := \
91 $(libc_root)/arch-arm/include \
92 $(libc_root)/include \
93 $(libstdc++_root)/include \
94 $(KERNEL_HEADERS) \
95 $(libm_root)/include \
96 $(libm_root)/include/arch/arm \
97 $(libthread_db_root)/include
98
99TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
100TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
101TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
102
103TARGET_STRIP_MODULE:=true
104
105$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
106
107$(combo_target)CUSTOM_LD_COMMAND := true
108define transform-o-to-shared-lib-inner
109$(TARGET_CXX) \
110 -nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \
111 -Wl,--gc-sections \
112 -Wl,-shared,-Bsymbolic \
113 $(TARGET_GLOBAL_LD_DIRS) \
114 $(PRIVATE_ALL_OBJECTS) \
115 -Wl,--whole-archive \
116 $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
117 -Wl,--no-whole-archive \
118 $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
119 $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
120 -o $@ \
121 $(PRIVATE_LDFLAGS) \
122 $(TARGET_LIBGCC)
123endef
124
125define transform-o-to-executable-inner
126$(TARGET_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
127 -Wl,-dynamic-linker,/system/bin/linker \
128 -Wl,--gc-sections \
129 -Wl,-z,nocopyreloc \
130 -o $@ \
131 $(TARGET_GLOBAL_LD_DIRS) \
132 -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
133 $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
134 $(TARGET_CRTBEGIN_DYNAMIC_O) \
135 $(PRIVATE_ALL_OBJECTS) \
136 $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
137 $(PRIVATE_LDFLAGS) \
138 $(TARGET_LIBGCC) \
139 $(TARGET_CRTEND_O)
140endef
141
142define transform-o-to-static-executable-inner
143$(TARGET_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
144 -Wl,--gc-sections \
145 -o $@ \
146 $(TARGET_GLOBAL_LD_DIRS) \
147 $(TARGET_CRTBEGIN_STATIC_O) \
148 $(PRIVATE_LDFLAGS) \
149 $(PRIVATE_ALL_OBJECTS) \
150 $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
151 $(TARGET_LIBGCC) \
152 $(TARGET_CRTEND_O)
153endef