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