14d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# Copyright (C) 2014 The Android Open Source Project
24d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#
34d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# Licensed under the Apache License, Version 2.0 (the "License");
44d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# you may not use this file except in compliance with the License.
54d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# You may obtain a copy of the License at
64d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#
74d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#      http://www.apache.org/licenses/LICENSE-2.0
84d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#
94d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# Unless required by applicable law or agreed to in writing, software
104d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# distributed under the License is distributed on an "AS IS" BASIS,
114d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# See the License for the specific language governing permissions and
134d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# limitations under the License.
144d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#
154d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
164d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# this file is used to prepare the NDK to build with the mips64el gcc-4.9
174d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# toolchain any number of source files
184d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#
194d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# its purpose is to define (or re-define) templates used to build
204d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# various sources into target object files, libraries or executables.
214d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#
224d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# Note that this file may end up being parsed several times in future
234d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# revisions of the NDK.
244d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh#
254d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
264d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew HsiehTARGET_CFLAGS := \
274d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -fpic \
284d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -fno-strict-aliasing \
294d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -finline-functions \
304d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -ffunction-sections \
314d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -funwind-tables \
324d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -fmessage-length=0 \
334d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -fno-inline-functions-called-once \
344d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -fgcse-after-reload \
354d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -frerun-cse-after-loop \
364d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -frename-registers \
374d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh        -no-canonical-prefixes
384d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
394d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew HsiehTARGET_LDFLAGS := -no-canonical-prefixes
404d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
414d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew HsiehTARGET_C_INCLUDES := \
424d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh    $(SYSROOT_INC)/usr/include
434d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
444d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew HsiehTARGET_mips64_release_CFLAGS := -O2 \
454d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh                                -g \
464d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh                                -DNDEBUG \
474d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh                                -fomit-frame-pointer \
484d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh                                -funswitch-loops     \
494d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh                                -finline-limit=300
504d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
514d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew HsiehTARGET_mips64_debug_CFLAGS := -O0 \
524d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh                              -g \
534d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh                              -fno-omit-frame-pointer
544d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
554d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh
564d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# This function will be called to determine the target CFLAGS used to build
574d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh# a C or Assembler source file, based on its tags.
584d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew HsiehTARGET-process-src-files-tags = \
594d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh$(eval __debug_sources := $(call get-src-files-with-tag,debug)) \
604d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh$(eval __release_sources := $(call get-src-files-without-tag,debug)) \
614d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh$(call set-src-files-target-cflags, \
624d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh    $(__debug_sources),\
634d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh    $(TARGET_mips64_debug_CFLAGS)) \
644d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh$(call set-src-files-target-cflags,\
654d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh    $(__release_sources),\
664d0352f01e1ab1811b83c00f37b1e4c2fc35717fAndrew Hsieh    $(TARGET_mips64_release_CFLAGS)) \
67