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 # 16 LOCAL_PATH := $(call my-dir) 17 SLANG_ENABLE_ASSERTIONS := false 18 19 # The prebuilt tools should be used when we are doing app-only build. 20 ifeq ($(TARGET_BUILD_APPS),) 21 22 23 local_cflags_for_slang := -Wall -Werror -std=c++11 24 ifeq ($(TARGET_BUILD_VARIANT),eng) 25 local_cflags_for_slang += -O0 26 else 27 ifeq ($(TARGET_BUILD_VARIANT),userdebug) 28 else 29 local_cflags_for_slang += -D__DISABLE_ASSERTS 30 endif 31 endif 32 local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT) 33 34 include $(LOCAL_PATH)/rs_version.mk 35 local_cflags_for_slang += $(RS_VERSION_DEFINE) 36 37 ifeq ($(SLANG_ENABLE_ASSERTIONS),true) 38 local_cflags_for_slang += -D_DEBUG -UNDEBUG 39 endif 40 41 static_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 # ======================================================== 48 include $(CLEAR_VARS) 49 include $(CLEAR_TBLGEN_VARS) 50 51 LLVM_ROOT_PATH := external/llvm 52 CLANG_ROOT_PATH := external/clang 53 54 include $(CLANG_ROOT_PATH)/clang.mk 55 56 LOCAL_MODULE := libslang 57 LOCAL_MODULE_TAGS := optional 58 ifneq ($(HOST_OS),windows) 59 LOCAL_CLANG := true 60 endif 61 62 LOCAL_CFLAGS += $(local_cflags_for_slang) 63 64 TBLGEN_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 75 LOCAL_SRC_FILES := \ 76 slang.cpp \ 77 slang_backend.cpp \ 78 slang_pragma_recorder.cpp \ 79 slang_diagnostic_buffer.cpp 80 81 LOCAL_C_INCLUDES += frameworks/compile/libbcc/include 82 83 LOCAL_LDLIBS := -ldl -lpthread 84 ifneq ($(HOST_OS),windows) 85 LOCAL_CXX_STL := libc++ 86 endif 87 88 include $(CLANG_HOST_BUILD_MK) 89 include $(CLANG_TBLGEN_RULES_MK) 90 include $(LLVM_GEN_INTRINSICS_MK) 91 include $(BUILD_HOST_STATIC_LIBRARY) 92 93 # ======================================================== 94 include $(CLEAR_VARS) 95 96 LOCAL_MODULE := llvm-rs-as 97 LOCAL_MODULE_TAGS := optional 98 99 LOCAL_MODULE_CLASS := EXECUTABLES 100 101 LOCAL_SRC_FILES := \ 102 llvm-rs-as.cpp 103 104 LOCAL_CFLAGS += $(local_cflags_for_slang) 105 LOCAL_STATIC_LIBRARIES := \ 106 libslang \ 107 $(static_libraries_needed_by_slang) 108 LOCAL_SHARED_LIBRARIES := \ 109 libLLVM 110 111 include $(CLANG_HOST_BUILD_MK) 112 include $(BUILD_HOST_EXECUTABLE) 113 114 # Executable llvm-rs-cc for host 115 # ======================================================== 116 include $(CLEAR_VARS) 117 include $(CLEAR_TBLGEN_VARS) 118 119 LOCAL_IS_HOST_MODULE := true 120 LOCAL_MODULE := llvm-rs-cc 121 ifneq ($(HOST_OS),windows) 122 LOCAL_CLANG := true 123 endif 124 LOCAL_MODULE_TAGS := optional 125 126 LOCAL_MODULE_CLASS := EXECUTABLES 127 128 LOCAL_CFLAGS += $(local_cflags_for_slang) 129 130 TBLGEN_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 143 LOCAL_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 162 LOCAL_C_INCLUDES += frameworks/compile/libbcc/include 163 164 LOCAL_STATIC_LIBRARIES := \ 165 libslang \ 166 $(static_libraries_needed_by_slang) 167 168 LOCAL_SHARED_LIBRARIES := \ 169 libclang \ 170 libLLVM 171 172 ifeq ($(HOST_OS),windows) 173 LOCAL_LDLIBS := -limagehlp -lpsapi 174 else 175 LOCAL_LDLIBS := -ldl -lpthread 176 endif 177 178 # For build RSCCOptions.inc from RSCCOptions.td 179 intermediates := $(call local-generated-sources-dir) 180 LOCAL_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 185 include $(CLANG_HOST_BUILD_MK) 186 include $(CLANG_TBLGEN_RULES_MK) 187 include $(BUILD_HOST_EXECUTABLE) 188 189 endif # TARGET_BUILD_APPS 190 191 #===================================================================== 192 # Include Subdirectories 193 #===================================================================== 194 include $(call all-makefiles-under,$(LOCAL_PATH)) 195