1# Copyright (C) 2014 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16# this file is used to prepare the NDK to build with the arm64 gcc-4.9
17# toolchain any number of source files
18#
19# its purpose is to define (or re-define) templates used to build
20# various sources into target object files, libraries or executables.
21#
22# Note that this file may end up being parsed several times in future
23# revisions of the NDK.
24#
25
26TOOLCHAIN_NAME   := aarch64-linux-android-4.9
27TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/aarch64-linux-android-
28
29TARGET_CFLAGS := \
30    -fpic \
31    -ffunction-sections \
32    -funwind-tables \
33    -fstack-protector-strong \
34    -no-canonical-prefixes
35
36TARGET_C_INCLUDES := \
37    $(SYSROOT_INC)/usr/include
38
39TARGET_LDFLAGS := -no-canonical-prefixes
40
41TARGET_arm64_release_CFLAGS := -O2 \
42                               -g \
43                               -DNDEBUG \
44                               -fomit-frame-pointer \
45                               -fstrict-aliasing    \
46                               -funswitch-loops     \
47                               -finline-limit=300
48
49TARGET_arm64_debug_CFLAGS := $(TARGET_arm64_release_CFLAGS) \
50                             -O0 \
51                             -UNDEBUG \
52                             -fno-omit-frame-pointer \
53                             -fno-strict-aliasing
54
55# This function will be called to determine the target CFLAGS used to build
56# a C or Assembler source file, based on its tags.
57#
58TARGET-process-src-files-tags = \
59$(eval __debug_sources := $(call get-src-files-with-tag,debug)) \
60$(eval __release_sources := $(call get-src-files-without-tag,debug)) \
61$(call set-src-files-target-cflags, $(__debug_sources), $(TARGET_arm64_debug_CFLAGS)) \
62$(call set-src-files-target-cflags, $(__release_sources),$(TARGET_arm64_release_CFLAGS)) \
63