1LOCAL_PATH:= $(call my-dir)
2
3COMMON_CFLAGS := \
4	-DLOG_TAG=\"libGLES_CM_swiftshader\" \
5	-std=c++11 \
6	-fno-operator-names \
7	-msse2 \
8	-D__STDC_CONSTANT_MACROS \
9	-D__STDC_LIMIT_MACROS \
10	-DEGLAPI= \
11	-DGL_API= \
12	-DGL_APICALL= \
13	-DGL_GLEXT_PROTOTYPES \
14	-Wno-unused-parameter \
15	-Wno-implicit-exception-spec-mismatch \
16	-Wno-overloaded-virtual \
17	-DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
18
19ifneq (16,${PLATFORM_SDK_VERSION})
20COMMON_CFLAGS += -Xclang -fuse-init-array
21else
22COMMON_CFLAGS += -D__STDC_INT64__
23endif
24
25COMMON_SRC_FILES := \
26	Buffer.cpp \
27	Context.cpp \
28	Device.cpp \
29	Framebuffer.cpp \
30	IndexDataManager.cpp \
31	libGLES_CM.cpp \
32	main.cpp \
33	Renderbuffer.cpp \
34	ResourceManager.cpp \
35	Texture.cpp \
36	utilities.cpp \
37	VertexDataManager.cpp
38
39COMMON_C_INCLUDES := \
40	bionic \
41	$(LOCAL_PATH)/../../../include \
42	$(LOCAL_PATH)/../ \
43	$(LOCAL_PATH)/../../ \
44	$(LOCAL_PATH)/../../../third_party/LLVM/include-android \
45	$(LOCAL_PATH)/../../../third_party/LLVM/include \
46	$(LOCAL_PATH)/../../../third_party/LLVM/lib/Target/X86 \
47	$(LOCAL_PATH)/../../Renderer/ \
48	$(LOCAL_PATH)/../../Common/ \
49	$(LOCAL_PATH)/../../Shader/ \
50	$(LOCAL_PATH)/../../Main/
51
52COMMON_STATIC_LIBRARIES := libLLVM_swiftshader
53
54COMMON_SHARED_LIBRARIES := \
55	libdl \
56	liblog \
57	libcutils \
58	libhardware
59
60# Marshmallow does not have stlport, but comes with libc++ by default
61ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
62COMMON_SHARED_LIBRARIES += libstlport
63COMMON_C_INCLUDES += external/stlport/stlport
64endif
65
66COMMON_LDFLAGS := \
67	-Wl,--gc-sections \
68	-Wl,--version-script=$(LOCAL_PATH)/exports.map \
69	-Wl,--hash-style=sysv
70
71include $(CLEAR_VARS)
72LOCAL_MODULE := libGLESv1_CM_swiftshader_debug
73ifdef TARGET_2ND_ARCH
74ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
75LOCAL_MULTILIB := first
76LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/egl
77else
78LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib/egl
79LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64/egl
80endif
81else
82LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/egl
83endif
84LOCAL_MODULE_TAGS := optional
85LOCAL_CLANG := true
86LOCAL_SRC_FILES += $(COMMON_SRC_FILES)
87LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES)
88LOCAL_STATIC_LIBRARIES += swiftshader_top_debug $(COMMON_STATIC_LIBRARIES)
89LOCAL_SHARED_LIBRARIES += $(COMMON_SHARED_LIBRARIES)
90LOCAL_LDFLAGS += $(COMMON_LDFLAGS)
91LOCAL_CFLAGS += $(COMMON_CFLAGS) -UNDEBUG -g -O0
92include $(BUILD_SHARED_LIBRARY)
93
94include $(CLEAR_VARS)
95LOCAL_MODULE := libGLESv1_CM_swiftshader
96ifdef TARGET_2ND_ARCH
97ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
98LOCAL_MULTILIB := first
99LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/egl
100else
101LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib/egl
102LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64/egl
103endif
104else
105LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/egl
106endif
107LOCAL_MODULE_TAGS := optional
108LOCAL_CLANG := true
109LOCAL_SRC_FILES += $(COMMON_SRC_FILES)
110LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES)
111LOCAL_STATIC_LIBRARIES += swiftshader_top_release $(COMMON_STATIC_LIBRARIES)
112LOCAL_SHARED_LIBRARIES += $(COMMON_SHARED_LIBRARIES)
113LOCAL_LDFLAGS += $(COMMON_LDFLAGS)
114LOCAL_CFLAGS += \
115	$(COMMON_CFLAGS) \
116	-fomit-frame-pointer \
117	-ffunction-sections \
118	-fdata-sections \
119	-DANGLE_DISABLE_TRACE
120include $(BUILD_SHARED_LIBRARY)
121