Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2006 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 17 | # Configuration for Linux on x86 as a target. |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 18 | # Included by combo/select.mk |
| 19 | |
| 20 | ifeq ($(TARGET_SIMULATOR),true) |
| 21 | # When building for the simulator, use the HOST settings as TARGET settings |
| 22 | TARGET_CC := $(HOST_CC) |
| 23 | TARGET_CXX := $(HOST_CXX) |
| 24 | TARGET_AR := $(HOST_AR) |
Andy McFadden | 16e95bb | 2010-02-24 08:29:39 -0800 | [diff] [blame] | 25 | TARGET_GLOBAL_CFLAGS := $(HOST_GLOBAL_CFLAGS) -m32 |
Andy McFadden | 99e087b | 2010-03-08 12:42:46 -0800 | [diff] [blame] | 26 | TARGET_GLOBAL_LDFLAGS := $(HOST_GLOBAL_LDFLAGS) -m32 -lpthread |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 27 | TARGET_NO_UNDEFINED_LDFLAGS := $(HOST_NO_UNDEFINED_LDFLAGS) |
Johnnie Birch | a4716b2 | 2010-08-02 12:12:15 -0700 | [diff] [blame] | 28 | ifeq ($(strip $(TARGET_ARCH_VARIANT)),) |
Andy McFadden | ef26218 | 2010-02-26 13:26:03 -0800 | [diff] [blame] | 29 | TARGET_ARCH_VARIANT := x86 |
Johnnie Birch | a4716b2 | 2010-08-02 12:12:15 -0700 | [diff] [blame] | 30 | endif |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 31 | else #simulator |
| 32 | |
| 33 | # Provide a default variant. |
| 34 | ifeq ($(strip $(TARGET_ARCH_VARIANT)),) |
| 35 | TARGET_ARCH_VARIANT := x86 |
| 36 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 37 | |
| 38 | # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 39 | ifeq ($(strip $(TARGET_TOOLS_PREFIX)),) |
| 40 | TARGET_TOOLS_PREFIX := \ |
Bruce Beare | a17b91f | 2011-01-26 18:43:15 -0800 | [diff] [blame^] | 41 | prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-android-linux-4.4.3/bin/i686-android-linux- |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 42 | endif |
| 43 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 44 | TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX) |
| 45 | TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX) |
| 46 | TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX) |
| 47 | TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX) |
| 48 | TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX) |
Bruce Beare | 45ac434 | 2010-06-24 14:02:00 -0700 | [diff] [blame] | 49 | TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX) |
| 50 | TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 51 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 52 | ifneq ($(wildcard $(TARGET_CC)),) |
| 53 | TARGET_LIBGCC := \ |
Bruce Beare | a17b91f | 2011-01-26 18:43:15 -0800 | [diff] [blame^] | 54 | $(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 55 | endif |
| 56 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 57 | TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 58 | |
| 59 | libc_root := bionic/libc |
| 60 | libm_root := bionic/libm |
| 61 | libstdc++_root := bionic/libstdc++ |
| 62 | libthread_db_root := bionic/libthread_db |
| 63 | |
| 64 | # unless CUSTOM_KERNEL_HEADERS is defined, we're going to use |
| 65 | # symlinks located in out/ to point to the appropriate kernel |
| 66 | # headers. see 'config/kernel_headers.make' for more details |
| 67 | # |
| 68 | ifneq ($(CUSTOM_KERNEL_HEADERS),) |
| 69 | KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS) |
| 70 | KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS) |
| 71 | else |
| 72 | KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common |
| 73 | KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH) |
| 74 | endif |
| 75 | KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) |
| 76 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 77 | TARGET_GLOBAL_CFLAGS += \ |
Bruce Beare | ccec9c4 | 2010-10-14 14:12:46 -0700 | [diff] [blame] | 78 | -Ulinux \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 79 | -m32 \ |
| 80 | -fPIC \ |
| 81 | -include $(call select-android-config-h,target_linux-x86) |
| 82 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 83 | TARGET_GLOBAL_CPPFLAGS += \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 84 | -fno-use-cxa-atexit |
| 85 | |
Bruce Beare | ccec9c4 | 2010-10-14 14:12:46 -0700 | [diff] [blame] | 86 | ifeq ($(TARGET_ARCH_VARIANT),x86-atom) |
Bruce Beare | a17b91f | 2011-01-26 18:43:15 -0800 | [diff] [blame^] | 87 | TARGET_GLOBAL_CFLAGS += -march=atom -mstackrealign -DUSE_SSSE3 -DUSE_SSE2 -mfpmath=sse |
Bruce Beare | ccec9c4 | 2010-10-14 14:12:46 -0700 | [diff] [blame] | 88 | else |
| 89 | TARGET_GLOBAL_CFLAGS += -march=i686 |
| 90 | endif |
| 91 | |
| 92 | TARGET_GLOBAL_CFLAGS += -D__ANDROID__ |
| 93 | TARGET_GLOBAL_LDFLAGS += -m32 |
| 94 | |
| 95 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 96 | TARGET_C_INCLUDES := \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 97 | $(libc_root)/arch-x86/include \ |
| 98 | $(libc_root)/include \ |
| 99 | $(libstdc++_root)/include \ |
| 100 | $(KERNEL_HEADERS) \ |
| 101 | $(libm_root)/include \ |
| 102 | $(libm_root)/include/i387 \ |
| 103 | $(libthread_db_root)/include |
| 104 | |
| 105 | TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o |
| 106 | TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o |
| 107 | TARGET_CRTEND_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o |
| 108 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 109 | TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o |
| 110 | TARGET_CRTEND_SO_O := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o |
| 111 | |
Bruce Beare | 45ac434 | 2010-06-24 14:02:00 -0700 | [diff] [blame] | 112 | TARGET_STRIP_MODULE:=true |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 113 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 114 | TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 115 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 116 | TARGET_CUSTOM_LD_COMMAND := true |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 117 | define transform-o-to-shared-lib-inner |
| 118 | $(TARGET_CXX) \ |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 119 | $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 120 | -nostdlib -Wl,-soname,$(notdir $@) \ |
| 121 | -shared -Bsymbolic \ |
Bruce Beare | ccec9c4 | 2010-10-14 14:12:46 -0700 | [diff] [blame] | 122 | $(TARGET_GLOBAL_CFLAGS) \ |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 123 | $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ |
Jeff Brown | bd528a8 | 2011-02-16 14:42:40 -0800 | [diff] [blame] | 124 | $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 125 | $(PRIVATE_ALL_OBJECTS) \ |
| 126 | -Wl,--whole-archive \ |
| 127 | $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ |
| 128 | -Wl,--no-whole-archive \ |
| 129 | $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ |
| 130 | $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ |
| 131 | -o $@ \ |
| 132 | $(PRIVATE_LDFLAGS) \ |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 133 | $(PRIVATE_TARGET_LIBGCC) \ |
Jeff Brown | bd528a8 | 2011-02-16 14:42:40 -0800 | [diff] [blame] | 134 | $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 135 | endef |
| 136 | |
| 137 | |
| 138 | define transform-o-to-executable-inner |
| 139 | $(TARGET_CXX) \ |
| 140 | $(TARGET_GLOBAL_LDFLAGS) \ |
| 141 | -nostdlib -Bdynamic \ |
| 142 | -Wl,-dynamic-linker,/system/bin/linker \ |
| 143 | -Wl,-z,nocopyreloc \ |
| 144 | -o $@ \ |
| 145 | $(TARGET_GLOBAL_LD_DIRS) \ |
| 146 | -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \ |
| 147 | $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ |
Jeff Brown | bd528a8 | 2011-02-16 14:42:40 -0800 | [diff] [blame] | 148 | $(if $(filter true,$(PRIVATE_NO_CRT)),,$(TARGET_CRTBEGIN_DYNAMIC_O)) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 149 | $(PRIVATE_ALL_OBJECTS) \ |
| 150 | $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ |
| 151 | $(PRIVATE_LDFLAGS) \ |
| 152 | $(TARGET_LIBGCC) \ |
Jeff Brown | bd528a8 | 2011-02-16 14:42:40 -0800 | [diff] [blame] | 153 | $(if $(filter true,$(PRIVATE_NO_CRT)),,$(TARGET_CRTEND_O)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 154 | endef |
| 155 | |
| 156 | define transform-o-to-static-executable-inner |
| 157 | $(TARGET_CXX) \ |
| 158 | $(TARGET_GLOBAL_LDFLAGS) \ |
| 159 | -nostdlib -Bstatic \ |
| 160 | -o $@ \ |
| 161 | $(TARGET_GLOBAL_LD_DIRS) \ |
Jeff Brown | bd528a8 | 2011-02-16 14:42:40 -0800 | [diff] [blame] | 162 | $(if $(filter true,$(PRIVATE_NO_CRT)),,$(TARGET_CRTBEGIN_STATIC_O)) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 163 | $(PRIVATE_LDFLAGS) \ |
| 164 | $(PRIVATE_ALL_OBJECTS) \ |
| 165 | -Wl,--start-group \ |
| 166 | $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \ |
| 167 | $(TARGET_LIBGCC) \ |
| 168 | -Wl,--end-group \ |
Jeff Brown | bd528a8 | 2011-02-16 14:42:40 -0800 | [diff] [blame] | 169 | $(if $(filter true,$(PRIVATE_NO_CRT)),,$(TARGET_CRTEND_O)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 170 | endef |
| 171 | |
Jean-Baptiste Queru | 9b4a812 | 2010-02-23 12:36:56 -0800 | [diff] [blame] | 172 | endif #simulator |