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 17# The prebuilt tools should be used when we are doing app-only build. 18ifeq ($(TARGET_BUILD_APPS),) 19 20LOCAL_PATH := $(call my-dir) 21 22local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror 23ifeq ($(TARGET_BUILD_VARIANT),eng) 24local_cflags_for_slang += -O0 25else 26local_cflags_for_slang += -D__DISABLE_ASSERTS 27endif 28local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT) 29 30ifeq "REL" "$(PLATFORM_VERSION_CODENAME)" 31 RS_VERSION := $(PLATFORM_SDK_VERSION) 32else 33 # Increment by 1 whenever this is not a final release build, since we want to 34 # be able to see the RS version number change during development. 35 # See build/core/version_defaults.mk for more information about this. 36 RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))" 37endif 38local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION) 39 40static_libraries_needed_by_slang := \ 41 libLLVMBitWriter_2_9 \ 42 libLLVMBitWriter_2_9_func \ 43 libLLVMBitWriter_3_2 44 45# Static library libslang for host 46# ======================================================== 47include $(CLEAR_VARS) 48include $(CLEAR_TBLGEN_VARS) 49 50LLVM_ROOT_PATH := external/llvm 51CLANG_ROOT_PATH := external/clang 52 53include $(CLANG_ROOT_PATH)/clang.mk 54 55LOCAL_MODULE := libslang 56LOCAL_MODULE_TAGS := optional 57 58LOCAL_CFLAGS += $(local_cflags_for_slang) 59 60TBLGEN_TABLES := \ 61 AttrList.inc \ 62 Attrs.inc \ 63 CommentCommandList.inc \ 64 CommentNodes.inc \ 65 DeclNodes.inc \ 66 DiagnosticCommonKinds.inc \ 67 DiagnosticFrontendKinds.inc \ 68 DiagnosticSemaKinds.inc \ 69 StmtNodes.inc 70 71LOCAL_SRC_FILES := \ 72 slang.cpp \ 73 slang_utils.cpp \ 74 slang_backend.cpp \ 75 slang_pragma_recorder.cpp \ 76 slang_diagnostic_buffer.cpp 77 78LOCAL_C_INCLUDES += frameworks/compile/libbcc/include 79 80LOCAL_LDLIBS := -ldl -lpthread 81 82include $(CLANG_HOST_BUILD_MK) 83include $(CLANG_TBLGEN_RULES_MK) 84include $(LLVM_GEN_INTRINSICS_MK) 85include $(BUILD_HOST_STATIC_LIBRARY) 86 87# Host static library containing rslib.bc 88# ======================================================== 89include $(CLEAR_VARS) 90 91input_data_file := frameworks/compile/slang/rslib.bc 92slangdata_output_var_name := rslib_bc 93 94LOCAL_IS_HOST_MODULE := true 95LOCAL_MODULE := librslib 96LOCAL_MODULE_TAGS := optional 97 98LOCAL_MODULE_CLASS := STATIC_LIBRARIES 99 100include $(LOCAL_PATH)/SlangData.mk 101include $(BUILD_HOST_STATIC_LIBRARY) 102 103# Executable slang-data for host 104# ======================================================== 105include $(CLEAR_VARS) 106 107LOCAL_MODULE := slang-data 108LOCAL_MODULE_TAGS := optional 109 110LOCAL_MODULE_CLASS := EXECUTABLES 111 112LOCAL_SRC_FILES := slang-data.c 113 114include $(BUILD_HOST_EXECUTABLE) 115 116# Executable rs-spec-gen for host 117# ======================================================== 118include $(CLEAR_VARS) 119 120LOCAL_MODULE := rs-spec-gen 121LOCAL_MODULE_TAGS := optional 122 123LOCAL_MODULE_CLASS := EXECUTABLES 124 125LOCAL_SRC_FILES := \ 126 slang_rs_spec_table.cpp 127 128include $(BUILD_HOST_EXECUTABLE) 129 130# Executable llvm-rs-cc for host 131# ======================================================== 132include $(CLEAR_VARS) 133include $(CLEAR_TBLGEN_VARS) 134 135LOCAL_IS_HOST_MODULE := true 136LOCAL_MODULE := llvm-rs-cc 137LOCAL_MODULE_TAGS := optional 138 139LOCAL_MODULE_CLASS := EXECUTABLES 140 141LOCAL_CFLAGS += $(local_cflags_for_slang) 142 143TBLGEN_TABLES := \ 144 AttrList.inc \ 145 Attrs.inc \ 146 CommentCommandList.inc \ 147 CommentNodes.inc \ 148 DeclNodes.inc \ 149 DiagnosticCommonKinds.inc \ 150 DiagnosticDriverKinds.inc \ 151 DiagnosticFrontendKinds.inc \ 152 DiagnosticSemaKinds.inc \ 153 StmtNodes.inc \ 154 RSCCOptions.inc 155 156RS_SPEC_TABLES := \ 157 RSClangBuiltinEnums.inc \ 158 RSDataTypeEnums.inc \ 159 RSDataElementEnums.inc \ 160 RSMatrixTypeEnums.inc \ 161 RSObjectTypeEnums.inc 162 163LOCAL_SRC_FILES := \ 164 llvm-rs-cc.cpp \ 165 slang_rs.cpp \ 166 slang_rs_ast_replace.cpp \ 167 slang_rs_check_ast.cpp \ 168 slang_rs_context.cpp \ 169 slang_rs_pragma_handler.cpp \ 170 slang_rs_backend.cpp \ 171 slang_rs_exportable.cpp \ 172 slang_rs_export_type.cpp \ 173 slang_rs_export_element.cpp \ 174 slang_rs_export_var.cpp \ 175 slang_rs_export_func.cpp \ 176 slang_rs_export_foreach.cpp \ 177 slang_rs_object_ref_count.cpp \ 178 slang_rs_reflection.cpp \ 179 slang_rs_reflection_base.cpp \ 180 slang_rs_reflection_cpp.cpp \ 181 slang_rs_reflect_utils.cpp 182 183LOCAL_STATIC_LIBRARIES := \ 184 libslang \ 185 $(static_libraries_needed_by_slang) 186 187LOCAL_SHARED_LIBRARIES := \ 188 libclang \ 189 libLLVM 190 191ifeq ($(HOST_OS),windows) 192 LOCAL_LDLIBS := -limagehlp -lpsapi 193else 194 LOCAL_LDLIBS := -ldl -lpthread 195endif 196 197# For build RSCCOptions.inc from RSCCOptions.td 198intermediates := $(call local-intermediates-dir) 199LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc 200$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN) 201 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen" 202 $(call transform-host-clang-td-to-out,opt-parser-defs) 203 204include frameworks/compile/slang/RSSpec.mk 205include $(CLANG_HOST_BUILD_MK) 206include $(CLANG_TBLGEN_RULES_MK) 207include $(BUILD_HOST_EXECUTABLE) 208 209endif # TARGET_BUILD_APPS 210 211#===================================================================== 212# Include Subdirectories 213#===================================================================== 214include $(call all-makefiles-under,$(LOCAL_PATH)) 215