1# 2# Copyright (C) 2010 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# 16LOCAL_PATH := $(call my-dir) 17SLANG_ENABLE_ASSERTIONS := false 18 19# The prebuilt tools should be used when we are doing app-only build. 20ifeq ($(TARGET_BUILD_APPS),) 21 22 23local_cflags_for_slang := -Wall -Werror -std=c++11 24ifeq ($(TARGET_BUILD_VARIANT),eng) 25local_cflags_for_slang += -O0 26else 27ifeq ($(TARGET_BUILD_VARIANT),userdebug) 28else 29local_cflags_for_slang += -D__DISABLE_ASSERTS 30endif 31endif 32local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT) 33 34include $(LOCAL_PATH)/rs_version.mk 35local_cflags_for_slang += $(RS_VERSION_DEFINE) 36 37ifeq ($(SLANG_ENABLE_ASSERTIONS),true) 38local_cflags_for_slang += -D_DEBUG -UNDEBUG 39endif 40 41static_libraries_needed_by_slang := \ 42 libLLVMBitWriter_2_9 \ 43 libLLVMBitWriter_2_9_func \ 44 libLLVMBitWriter_3_2 45 46# Static library libslang for host 47# ======================================================== 48include $(CLEAR_VARS) 49include $(CLEAR_TBLGEN_VARS) 50 51LLVM_ROOT_PATH := external/llvm 52CLANG_ROOT_PATH := external/clang 53 54include $(CLANG_ROOT_PATH)/clang.mk 55 56LOCAL_MODULE := libslang 57LOCAL_MODULE_TAGS := optional 58ifneq ($(HOST_OS),windows) 59LOCAL_CLANG := true 60endif 61 62LOCAL_CFLAGS += $(local_cflags_for_slang) 63 64TBLGEN_TABLES := \ 65 AttrList.inc \ 66 Attrs.inc \ 67 CommentCommandList.inc \ 68 CommentNodes.inc \ 69 DeclNodes.inc \ 70 DiagnosticCommonKinds.inc \ 71 DiagnosticFrontendKinds.inc \ 72 DiagnosticSemaKinds.inc \ 73 StmtNodes.inc 74 75LOCAL_SRC_FILES := \ 76 slang.cpp \ 77 slang_backend.cpp \ 78 slang_pragma_recorder.cpp \ 79 slang_diagnostic_buffer.cpp 80 81LOCAL_C_INCLUDES += frameworks/compile/libbcc/include 82 83LOCAL_LDLIBS := -ldl -lpthread 84ifneq ($(HOST_OS),windows) 85LOCAL_CXX_STL := libc++ 86endif 87 88include $(CLANG_HOST_BUILD_MK) 89include $(CLANG_TBLGEN_RULES_MK) 90include $(LLVM_GEN_INTRINSICS_MK) 91include $(BUILD_HOST_STATIC_LIBRARY) 92 93# ======================================================== 94include $(CLEAR_VARS) 95 96LOCAL_MODULE := llvm-rs-as 97LOCAL_MODULE_TAGS := optional 98 99LOCAL_MODULE_CLASS := EXECUTABLES 100 101LOCAL_SRC_FILES := \ 102 llvm-rs-as.cpp 103 104LOCAL_CFLAGS += $(local_cflags_for_slang) 105LOCAL_STATIC_LIBRARIES := \ 106 libslang \ 107 $(static_libraries_needed_by_slang) 108LOCAL_SHARED_LIBRARIES := \ 109 libLLVM 110 111include $(CLANG_HOST_BUILD_MK) 112include $(BUILD_HOST_EXECUTABLE) 113 114# Executable llvm-rs-cc for host 115# ======================================================== 116include $(CLEAR_VARS) 117include $(CLEAR_TBLGEN_VARS) 118 119LOCAL_IS_HOST_MODULE := true 120LOCAL_MODULE := llvm-rs-cc 121ifneq ($(HOST_OS),windows) 122LOCAL_CLANG := true 123endif 124LOCAL_MODULE_TAGS := optional 125 126LOCAL_MODULE_CLASS := EXECUTABLES 127 128LOCAL_CFLAGS += $(local_cflags_for_slang) 129 130TBLGEN_TABLES := \ 131 AttrList.inc \ 132 Attrs.inc \ 133 CommentCommandList.inc \ 134 CommentNodes.inc \ 135 DeclNodes.inc \ 136 DiagnosticCommonKinds.inc \ 137 DiagnosticDriverKinds.inc \ 138 DiagnosticFrontendKinds.inc \ 139 DiagnosticSemaKinds.inc \ 140 StmtNodes.inc \ 141 RSCCOptions.inc 142 143LOCAL_SRC_FILES := \ 144 llvm-rs-cc.cpp \ 145 rs_cc_options.cpp \ 146 slang_rs_ast_replace.cpp \ 147 slang_rs_check_ast.cpp \ 148 slang_rs_context.cpp \ 149 slang_rs_pragma_handler.cpp \ 150 slang_rs_exportable.cpp \ 151 slang_rs_export_type.cpp \ 152 slang_rs_export_element.cpp \ 153 slang_rs_export_var.cpp \ 154 slang_rs_export_func.cpp \ 155 slang_rs_export_foreach.cpp \ 156 slang_rs_object_ref_count.cpp \ 157 slang_rs_reflection.cpp \ 158 slang_rs_reflection_cpp.cpp \ 159 slang_rs_reflect_utils.cpp \ 160 strip_unknown_attributes.cpp 161 162LOCAL_C_INCLUDES += frameworks/compile/libbcc/include 163 164LOCAL_STATIC_LIBRARIES := \ 165 libslang \ 166 $(static_libraries_needed_by_slang) 167 168LOCAL_SHARED_LIBRARIES := \ 169 libclang \ 170 libLLVM 171 172ifeq ($(HOST_OS),windows) 173 LOCAL_LDLIBS := -limagehlp -lpsapi 174else 175 LOCAL_LDLIBS := -ldl -lpthread 176endif 177 178# For build RSCCOptions.inc from RSCCOptions.td 179intermediates := $(call local-generated-sources-dir) 180LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc 181$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN) 182 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen" 183 $(call transform-host-td-to-out,opt-parser-defs) 184 185include $(CLANG_HOST_BUILD_MK) 186include $(CLANG_TBLGEN_RULES_MK) 187include $(BUILD_HOST_EXECUTABLE) 188 189endif # TARGET_BUILD_APPS 190 191#===================================================================== 192# Include Subdirectories 193#===================================================================== 194include $(call all-makefiles-under,$(LOCAL_PATH)) 195