1LOCAL_PATH := $(call my-dir) 2swiftshader_src_root := $(LOCAL_PATH) 3 4COMMON_C_INCLUDES += \ 5 bionic \ 6 $(LOCAL_PATH)/../include \ 7 $(LOCAL_PATH)/OpenGL/ \ 8 $(LOCAL_PATH) 9 10ifeq ($(REACTOR_LLVM_VERSION),3) 11COMMON_C_INCLUDES += \ 12 $(LOCAL_PATH)/../third_party/LLVM/include 13else 14COMMON_C_INCLUDES += \ 15 $(LOCAL_PATH)/../third_party/llvm-7.0/llvm/include \ 16 $(LOCAL_PATH)/../third_party/llvm-7.0/configs/android/include \ 17 $(LOCAL_PATH)/../third_party/llvm-7.0/configs/common/include 18endif 19 20# Project Treble is introduced from Oreo MR1 21ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27 && echo OreoMR1),OreoMR1) 22COMMON_SHARED_LIBRARIES := libnativewindow liblog 23COMMON_HEADER_LIBRARIES := libhardware_headers libnativebase_headers 24COMMON_STATIC_LIBRARIES := libarect 25endif 26 27# Marshmallow does not have stlport, but comes with libc++ by default 28ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow) 29COMMON_C_INCLUDES += external/stlport/stlport 30endif 31 32COMMON_SRC_FILES := \ 33 Common/CPUID.cpp \ 34 Common/Configurator.cpp \ 35 Common/DebugAndroid.cpp \ 36 Common/GrallocAndroid.cpp \ 37 Common/Half.cpp \ 38 Common/Math.cpp \ 39 Common/Memory.cpp \ 40 Common/Resource.cpp \ 41 Common/Socket.cpp \ 42 Common/Thread.cpp \ 43 Common/Timer.cpp 44 45COMMON_SRC_FILES += \ 46 Main/Config.cpp \ 47 Main/FrameBuffer.cpp \ 48 Main/FrameBufferAndroid.cpp \ 49 Main/SwiftConfig.cpp 50 51COMMON_SRC_FILES += \ 52 Reactor/Routine.cpp \ 53 Reactor/Debug.cpp \ 54 Reactor/DebugAndroid.cpp \ 55 Reactor/ExecutableMemory.cpp 56 57COMMON_SRC_FILES += \ 58 Reactor/LLVMReactor.cpp \ 59 Reactor/LLVMRoutine.cpp \ 60 Reactor/LLVMRoutineManager.cpp \ 61 Reactor/CPUID.cpp 62 63COMMON_SRC_FILES += \ 64 Renderer/Blitter.cpp \ 65 Renderer/Clipper.cpp \ 66 Renderer/Color.cpp \ 67 Renderer/Context.cpp \ 68 Renderer/ETC_Decoder.cpp \ 69 Renderer/Matrix.cpp \ 70 Renderer/PixelProcessor.cpp \ 71 Renderer/Plane.cpp \ 72 Renderer/Point.cpp \ 73 Renderer/QuadRasterizer.cpp \ 74 Renderer/Renderer.cpp \ 75 Renderer/Sampler.cpp \ 76 Renderer/SetupProcessor.cpp \ 77 Renderer/Surface.cpp \ 78 Renderer/TextureStage.cpp \ 79 Renderer/Vector.cpp \ 80 Renderer/VertexProcessor.cpp \ 81 82COMMON_SRC_FILES += \ 83 Shader/Constants.cpp \ 84 Shader/PixelPipeline.cpp \ 85 Shader/PixelProgram.cpp \ 86 Shader/PixelRoutine.cpp \ 87 Shader/PixelShader.cpp \ 88 Shader/SamplerCore.cpp \ 89 Shader/SetupRoutine.cpp \ 90 Shader/Shader.cpp \ 91 Shader/ShaderCore.cpp \ 92 Shader/VertexPipeline.cpp \ 93 Shader/VertexProgram.cpp \ 94 Shader/VertexRoutine.cpp \ 95 Shader/VertexShader.cpp \ 96 97COMMON_SRC_FILES += \ 98 OpenGL/common/Image.cpp \ 99 OpenGL/common/Object.cpp \ 100 OpenGL/common/MatrixStack.cpp \ 101 102COMMON_CFLAGS := \ 103 -DLOG_TAG=\"swiftshader\" \ 104 -Wall \ 105 -Werror \ 106 -Wno-format \ 107 -Wno-switch \ 108 -Wno-unused-local-typedef \ 109 -Wno-unused-parameter \ 110 -Wno-unused-value \ 111 -Wno-unused-variable \ 112 -Wno-implicit-exception-spec-mismatch \ 113 -Wno-implicit-fallthrough \ 114 -Wno-overloaded-virtual \ 115 -Wno-non-virtual-dtor \ 116 -Wno-attributes \ 117 -Wno-unknown-attributes \ 118 -Wno-unknown-warning-option \ 119 -fno-operator-names \ 120 -msse2 \ 121 -D__STDC_CONSTANT_MACROS \ 122 -D__STDC_LIMIT_MACROS \ 123 -DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \ 124 -std=c++11 \ 125 -DNO_SANITIZE_FUNCTION= 126 127ifneq (16,${PLATFORM_SDK_VERSION}) 128COMMON_CFLAGS += -Xclang -fuse-init-array 129else 130COMMON_CFLAGS += -D__STDC_INT64__ 131endif 132 133# gralloc1 is introduced from N MR1 134ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 25 && echo NMR1),NMR1) 135COMMON_CFLAGS += -DHAVE_GRALLOC1 136COMMON_C_INCLUDES += \ 137 system/core/libsync/include \ 138 system/core/libsync 139endif 140 141# Common LLVM defines 142COMMON_CFLAGS += -DREACTOR_LLVM_VERSION=$(REACTOR_LLVM_VERSION) 143 144# Common Subzero defines 145COMMON_CFLAGS += -DALLOW_DUMP=0 -DALLOW_TIMERS=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_MINIMAL_BUILD=0 -DALLOW_WASM=0 -DICE_THREAD_LOCAL_HACK=1 146 147# Subzero target 148LOCAL_CFLAGS_x86 += -DSZTARGET=X8632 149LOCAL_CFLAGS_x86_64 += -DSZTARGET=X8664 150LOCAL_CFLAGS_arm += -DSZTARGET=ARM32 151 152include $(CLEAR_VARS) 153LOCAL_CLANG := true 154LOCAL_MODULE := swiftshader_top_release 155LOCAL_VENDOR_MODULE := true 156LOCAL_MODULE_TAGS := optional 157LOCAL_SRC_FILES := $(COMMON_SRC_FILES) 158LOCAL_CFLAGS := $(COMMON_CFLAGS) -fomit-frame-pointer -ffunction-sections -fdata-sections -DANGLE_DISABLE_TRACE 159LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES) 160LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) 161LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES) 162LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) 163include $(BUILD_STATIC_LIBRARY) 164 165include $(CLEAR_VARS) 166LOCAL_CLANG := true 167LOCAL_MODULE := swiftshader_top_debug 168LOCAL_VENDOR_MODULE := true 169LOCAL_MODULE_TAGS := optional 170LOCAL_SRC_FILES := $(COMMON_SRC_FILES) 171LOCAL_CFLAGS := $(COMMON_CFLAGS) -UNDEBUG -g -O0 -DDEFAULT_THREAD_COUNT=1 172LOCAL_C_INCLUDES := $(COMMON_C_INCLUDES) 173LOCAL_SHARED_LIBRARIES := $(COMMON_SHARED_LIBRARIES) 174LOCAL_HEADER_LIBRARIES := $(COMMON_HEADER_LIBRARIES) 175LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES) 176include $(BUILD_STATIC_LIBRARY) 177 178include $(swiftshader_src_root)/OpenGL/libGLESv2/Android.mk 179include $(swiftshader_src_root)/OpenGL/libGLES_CM/Android.mk 180include $(swiftshader_src_root)/OpenGL/libEGL/Android.mk 181include $(swiftshader_src_root)/OpenGL/compiler/Android.mk 182 183COMMON_CFLAGS := 184