blob: 507e4dd9cb4194d73c6bbed37d9df528a613cc26 [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 \
The Android Open Source Project4f85cc52009-01-09 17:50:54 -080056 -fno-short-enums \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070057 -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \
58 -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
59 -include $(call select-android-config-h,linux-arm)
60
61$(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
62
63$(combo_target)RELEASE_CFLAGS := \
64 -DSK_RELEASE -DNDEBUG \
65 -O2 -g \
66 -Wstrict-aliasing=2 \
67 -finline-functions \
68 -fno-inline-functions-called-once \
69 -fgcse-after-reload \
70 -frerun-cse-after-loop \
71 -frename-registers
72
73libc_root := bionic/libc
74libm_root := bionic/libm
75libstdc++_root := bionic/libstdc++
76libthread_db_root := bionic/libthread_db
77
78# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
79# symlinks located in out/ to point to the appropriate kernel
80# headers. see 'config/kernel_headers.make' for more details
81#
82ifneq ($(CUSTOM_KERNEL_HEADERS),)
83 KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
84 KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS)
85else
86 KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
87 KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH)
88endif
89KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
90
91$(combo_target)C_INCLUDES := \
92 $(libc_root)/arch-arm/include \
93 $(libc_root)/include \
94 $(libstdc++_root)/include \
95 $(KERNEL_HEADERS) \
96 $(libm_root)/include \
97 $(libm_root)/include/arch/arm \
98 $(libthread_db_root)/include
99
100TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
101TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
102TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
103
104TARGET_STRIP_MODULE:=true
105
106$(combo_target)DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
107
108$(combo_target)CUSTOM_LD_COMMAND := true
109define transform-o-to-shared-lib-inner
110$(TARGET_CXX) \
111 -nostdlib -Wl,-soname,$(notdir $@) -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc \
112 -Wl,--gc-sections \
113 -Wl,-shared,-Bsymbolic \
114 $(TARGET_GLOBAL_LD_DIRS) \
115 $(PRIVATE_ALL_OBJECTS) \
116 -Wl,--whole-archive \
117 $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
118 -Wl,--no-whole-archive \
119 $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
120 $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
121 -o $@ \
122 $(PRIVATE_LDFLAGS) \
123 $(TARGET_LIBGCC)
124endef
125
126define transform-o-to-executable-inner
127$(TARGET_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
128 -Wl,-dynamic-linker,/system/bin/linker \
129 -Wl,--gc-sections \
130 -Wl,-z,nocopyreloc \
131 -o $@ \
132 $(TARGET_GLOBAL_LD_DIRS) \
133 -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
134 $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
135 $(TARGET_CRTBEGIN_DYNAMIC_O) \
136 $(PRIVATE_ALL_OBJECTS) \
137 $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
138 $(PRIVATE_LDFLAGS) \
139 $(TARGET_LIBGCC) \
140 $(TARGET_CRTEND_O)
141endef
142
143define transform-o-to-static-executable-inner
144$(TARGET_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \
145 -Wl,--gc-sections \
146 -o $@ \
147 $(TARGET_GLOBAL_LD_DIRS) \
148 $(TARGET_CRTBEGIN_STATIC_O) \
149 $(PRIVATE_LDFLAGS) \
150 $(PRIVATE_ALL_OBJECTS) \
151 $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
152 $(TARGET_LIBGCC) \
153 $(TARGET_CRTEND_O)
154endef