setup.mk 2.44 KB
Newer Older
Bruce Beare's avatar
Bruce Beare committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

16
# this file is used to prepare the NDK to build with the x86-4.4.3
Bruce Beare's avatar
Bruce Beare committed
17 18 19 20 21 22 23 24 25
# toolchain any number of source files
#
# its purpose is to define (or re-define) templates used to build
# various sources into target object files, libraries or executables.
#
# Note that this file may end up being parsed several times in future
# revisions of the NDK.
#

26
TOOLCHAIN_NAME   := x86-4.4.3
Bruce Beare's avatar
Bruce Beare committed
27 28
TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/i686-android-linux-

29 30
TARGET_CFLAGS := \
    -D__ANDROID__ \
Bruce Beare's avatar
Bruce Beare committed
31 32 33 34 35 36 37 38
    -mbionic \
    -I$(SYSROOT)/usr/include \
    -march=atom -mstackrealign -DUSE_SSSE3 -DUSE_SSE2 -mfpmath=sse \
    -fpic \
    -ffunction-sections \
    -funwind-tables \
    -fno-short-enums

39 40 41
# Fix this after ssp.c is fixed for x86
# TARGET_CFLAGS += -fstack-protector

Bruce Beare's avatar
Bruce Beare committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
TARGET_x86_release_CFLAGS :=  -O2 \
                              -fomit-frame-pointer \
                              -fstrict-aliasing    \
                              -funswitch-loops     \
                              -finline-limit=300

# When building for debug, compile everything as x86.
TARGET_x86_debug_CFLAGS := $(TARGET_x86_release_CFLAGS) \
                           -fno-omit-frame-pointer \
                           -fno-strict-aliasing

# This function will be called to determine the target CFLAGS used to build
# a C or Assembler source file, based on its tags.
#
TARGET-process-src-files-tags = \
$(eval __debug_sources := $(call get-src-files-with-tag,debug)) \
Mark D Horn's avatar
Mark D Horn committed
58
$(eval __release_sources := $(call get-src-files-without-tag,debug)) \
Bruce Beare's avatar
Bruce Beare committed
59 60 61 62 63 64 65
$(call set-src-files-target-cflags, $(__debug_sources), $(TARGET_x86_debug_CFLAGS)) \
$(call set-src-files-target-cflags, $(__release_sources),$(TARGET_x86_release_CFLAGS)) \
$(call set-src-files-text,$(LOCAL_SRC_FILES),x86$(space)$(space)) \

# The ABI-specific sub-directory that the SDK tools recognize for
# this toolchain's generated binaries
TARGET_ABI_SUBDIR := x86