1LOCAL_MODULE_TARGET_ARCH := $(LLVM_SUPPORTED_ARCH)
2
3LOCAL_CLANG := true
4
5LOCAL_CFLAGS :=	\
6	-D_GNU_SOURCE	\
7	-D__STDC_LIMIT_MACROS	\
8	-D__STDC_CONSTANT_MACROS	\
9	-D__STDC_FORMAT_MACROS	\
10	-O2	\
11	-fomit-frame-pointer	\
12	-Wall	\
13	-W	\
14	-Wno-unused-parameter	\
15	-Wwrite-strings	\
16	-Werror \
17        -Dsprintf=sprintf \
18	$(LOCAL_CFLAGS)
19
20# The three inline options together reduce libbcc.so almost 1MB.
21# We move them from global build/core/combo/TARGET_linux-arm.mk
22# to here.
23LOCAL_CFLAGS := -DANDROID_TARGET_BUILD \
24		-finline-functions \
25		$(LOCAL_CFLAGS)
26
27ifeq ($(TARGET_BUILD_VARIANT),eng)
28LOCAL_CFLAGS := -DANDROID_ENGINEERING_BUILD \
29                $(LOCAL_CFLAGS)
30endif
31
32ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true)
33LOCAL_CFLAGS :=	\
34	$(LOCAL_CFLAGS) \
35	-D_DEBUG	\
36	-UNDEBUG
37endif
38
39ifneq ($(REQUIRES_EH),1)
40LOCAL_CFLAGS +=	-fno-exceptions
41else
42# No action. The device target should not have exception enabled since bionic
43# doesn't support it
44REQUIRES_EH := 0
45endif
46
47ifneq ($(REQUIRES_RTTI),1)
48LOCAL_CPPFLAGS +=	-fno-rtti
49else
50REQUIRES_RTTI := 0
51endif
52
53LOCAL_CPPFLAGS :=	\
54	$(LOCAL_CPPFLAGS)	\
55	-Woverloaded-virtual	\
56	-Wno-sign-promo         \
57	-std=c++11
58
59# Make sure bionic is first so we can include system headers.
60LOCAL_C_INCLUDES :=	\
61	bionic \
62	$(LLVM_ROOT_PATH)	\
63	$(LLVM_ROOT_PATH)/include	\
64	$(LLVM_ROOT_PATH)/device/include	\
65	$(LOCAL_C_INCLUDES)
66
67###########################################################
68## Commands for running tblgen to compile a td file
69###########################################################
70define transform-device-td-to-out
71@mkdir -p $(dir $@)
72@echo "Device TableGen (gen-$(1)): $(TBLGEN_LOCAL_MODULE) <= $<"
73$(hide) $(LLVM_TBLGEN) \
74	-I $(dir $<)	\
75	-I $(LLVM_ROOT_PATH)/include	\
76	-I $(LLVM_ROOT_PATH)/device/include	\
77	-I $(LLVM_ROOT_PATH)/lib/Target	\
78    -gen-$(strip $(1)) \
79    -o $@ $<
80endef
81