1#
2# Copyright (C) 2016 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
17LOCAL_CFLAGS += \
18    -Wall \
19    -Werror \
20    \
21    -Waddress \
22    -Wempty-body \
23    -Wenum-compare \
24    -Wlogical-op \
25    -Wmissing-declarations \
26    -Wpointer-arith \
27    -Wshadow \
28    \
29    -fdata-sections \
30    -ffunction-sections \
31    -fno-strict-aliasing \
32    -fno-unwind-tables \
33    -fstack-reuse=all \
34    -fvisibility=hidden \
35
36LOCAL_CPPFLAGS +=       \
37    -std=c++11          \
38    -fno-exceptions     \
39    -fno-rtti           \
40
41LOCAL_LDFLAGS +=                        \
42    -nostartfiles                       \
43    -nostdlib                           \
44    -Wl,--gc-sections                   \
45    -Wl,--no-undefined                  \
46    -Wl,--no-allow-shlib-undefined      \
47
48LOCAL_CFLAGS_cortexm4 += \
49    -mthumb \
50    -mcpu=cortex-m4 \
51    -march=armv7e-m \
52    -mfloat-abi=softfp \
53    -mfpu=fpv4-sp-d16 \
54    -mno-thumb-interwork \
55    -ffast-math \
56    -fsingle-precision-constant \
57    -DARM \
58    -DUSE_NANOHUB_FLOAT_RUNTIME \
59    -DARM_MATH_CM4 \
60    -D__FPU_PRESENT \
61    -DCPU_NUM_PERSISTENT_RAM_BITS=32 \
62
63LOCAL_CFLAGS_x86 += \
64    -march=core2 \
65    -msse2 \
66    -DSYSCALL_VARARGS_PARAMS_PASSED_AS_PTRS \
67
68LOCAL_CFLAGS_stm32 += \
69    -DPLATFORM_HW_VER=0 \
70
71# CHRE-specific
72LOCAL_CFLAGS += \
73    -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=128 \
74    -DCHRE_NO_DOUBLE_SUPPORT \
75
76# DEBUG/RELEASE-specific
77DEBUG ?= -DDEBUG
78RELEASE ?=
79
80ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
81LOCAL_CFLAGS += \
82    $(DEBUG) \
83
84else
85LOCAL_CFLAGS += \
86    $(RELEASE) \
87
88endif
89