blob: 9e331b6fab0f70fecff6c29171cf781f1a9142a2 [file] [log] [blame]
Dehao Chen25671e12014-07-23 14:28:58 -07001#
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
17# Setup FDO related flags.
18
19$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:=
Dehao Chen25671e12014-07-23 14:28:58 -070020
Dehao Chen5f5c48f2014-07-30 16:22:53 -070021ifeq ($(strip $(BUILD_FDO_INSTRUMENT)), true)
Dehao Chen25671e12014-07-23 14:28:58 -070022 # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
Dehao Chen5f5c48f2014-07-30 16:22:53 -070023 # The profile will be generated on /sdcard/fdo_profile on the device.
24 $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/sdcard/fdo_profile -DANDROID_FDO
Dehao Chenf4294cd2014-08-20 16:48:17 -070025 $(combo_2nd_arch_prefix)TARGET_FDO_LDFLAGS := -lgcov -lgcc
Dehao Chen25671e12014-07-23 14:28:58 -070026else
Dehao Chen5f5c48f2014-07-30 16:22:53 -070027 ifeq ($(strip $(BUILD_FDO_OPTIMIZE)), true)
Dehao Chen25671e12014-07-23 14:28:58 -070028 # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
29 ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),)
Dehao Chenda26f202014-08-05 15:08:06 -070030 $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := vendor/google_data/fdo_profile
Dehao Chen25671e12014-07-23 14:28:58 -070031 endif
32
Dehao Chen4e8f2ea2014-08-18 09:43:42 -070033 ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)/$(PRODUCT_OUT))),)
Dehao Chen25671e12014-07-23 14:28:58 -070034 $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO -fprofile-correction -Wcoverage-mismatch -Wno-error
Dehao Chen25671e12014-07-23 14:28:58 -070035 else
Dehao Chen4e8f2ea2014-08-18 09:43:42 -070036 $(warning Profile directory $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)/$(PRODUCT_OUT) does not exist. Turn off FDO.)
Dehao Chen25671e12014-07-23 14:28:58 -070037 endif
38 endif
39endif