1LOCAL_PATH:= $(call my-dir)
2
3COMMON_C_INCLUDES := \
4	bionic \
5	$(LOCAL_PATH)/../../../include \
6	$(LOCAL_PATH)/../ \
7	$(LOCAL_PATH)/../../ \
8	$(LOCAL_PATH)/../../../third_party/LLVM/include-android \
9	$(LOCAL_PATH)/../../../third_party/LLVM/include \
10	$(LOCAL_PATH)/../../../third_party/LLVM/lib/Target/X86 \
11	$(LOCAL_PATH)/../../Renderer/ \
12	$(LOCAL_PATH)/../../Common/ \
13	$(LOCAL_PATH)/../../Shader/ \
14	$(LOCAL_PATH)/../../Main/
15
16# Marshmallow does not have stlport, but comes with libc++ by default
17ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
18COMMON_C_INCLUDES += external/stlport/stlport
19endif
20
21COMMON_CFLAGS := \
22	-DLOG_TAG=\"swiftshader_compiler\" \
23	-Wno-unused-parameter \
24	-Wno-implicit-exception-spec-mismatch \
25	-Wno-overloaded-virtual \
26	-fno-operator-names \
27	-msse2 \
28	-D__STDC_CONSTANT_MACROS \
29	-D__STDC_LIMIT_MACROS \
30	-std=c++11 \
31	-DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
32
33ifneq (16,${PLATFORM_SDK_VERSION})
34COMMON_CFLAGS += -Xclang -fuse-init-array
35else
36COMMON_CFLAGS += -D__STDC_INT64__
37endif
38
39COMMON_SRC_FILES := \
40	preprocessor/Diagnostics.cpp \
41	preprocessor/DirectiveHandler.cpp \
42	preprocessor/DirectiveParser.cpp \
43	preprocessor/ExpressionParser.cpp \
44	preprocessor/Input.cpp \
45	preprocessor/Lexer.cpp \
46	preprocessor/Macro.cpp \
47	preprocessor/MacroExpander.cpp \
48	preprocessor/Preprocessor.cpp \
49	preprocessor/Token.cpp \
50	preprocessor/Tokenizer.cpp \
51	AnalyzeCallDepth.cpp \
52	Compiler.cpp \
53	debug.cpp \
54	Diagnostics.cpp \
55	DirectiveHandler.cpp \
56	glslang_lex.cpp \
57	glslang_tab.cpp \
58	InfoSink.cpp \
59	Initialize.cpp \
60	InitializeParseContext.cpp \
61	IntermTraverse.cpp \
62	Intermediate.cpp \
63	intermOut.cpp \
64	ossource_posix.cpp \
65	OutputASM.cpp \
66	parseConst.cpp \
67	ParseHelper.cpp \
68	PoolAlloc.cpp \
69	SymbolTable.cpp \
70	TranslatorASM.cpp \
71	util.cpp \
72	ValidateGlobalInitializer.cpp \
73	ValidateLimitations.cpp \
74	ValidateSwitch.cpp \
75
76include $(CLEAR_VARS)
77LOCAL_CLANG := true
78LOCAL_MODULE := swiftshader_compiler_release
79LOCAL_MODULE_TAGS := optional
80LOCAL_SRC_FILES := $(COMMON_SRC_FILES)
81LOCAL_CFLAGS += \
82	$(COMMON_CFLAGS) \
83	-ffunction-sections \
84	-fdata-sections \
85	-DANGLE_DISABLE_TRACE
86LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
87include $(BUILD_STATIC_LIBRARY)
88
89include $(CLEAR_VARS)
90LOCAL_CLANG := true
91LOCAL_MODULE := swiftshader_compiler_debug
92LOCAL_MODULE_TAGS := optional
93LOCAL_SRC_FILES := $(COMMON_SRC_FILES)
94
95LOCAL_CFLAGS += \
96	$(COMMON_CFLAGS) \
97	-UNDEBUG \
98	-g \
99	-O0
100
101LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES)
102include $(BUILD_STATIC_LIBRARY)
103