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 23ifneq ($(TARGET_BUILD_VARIANT),eng) 24local_cflags_for_slang += -D__DISABLE_ASSERTS 25endif 26local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT) 27 28ifeq "REL" "$(PLATFORM_VERSION_CODENAME)" 29 RS_VERSION := $(PLATFORM_SDK_VERSION) 30else 31 # Increment by 1 whenever this is not a final release build, since we want to 32 # be able to see the RS version number change during development. 33 # See build/core/version_defaults.mk for more information about this. 34 RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))" 35endif 36local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION) 37 38static_libraries_needed_by_slang := \ 39 libLLVMLinker \ 40 libLLVMipo \ 41 libLLVMBitWriter \ 42 libLLVMBitWriter_2_9 \ 43 libLLVMBitReader \ 44 libLLVMARMCodeGen \ 45 libLLVMARMAsmPrinter \ 46 libLLVMARMInfo \ 47 libLLVMARMDesc \ 48 libLLVMX86CodeGen \ 49 libLLVMX86AsmPrinter \ 50 libLLVMX86Info \ 51 libLLVMX86Desc \ 52 libLLVMX86Utils \ 53 libLLVMAsmPrinter \ 54 libLLVMSelectionDAG \ 55 libLLVMCodeGen \ 56 libLLVMScalarOpts \ 57 libLLVMInstCombine \ 58 libLLVMTransformUtils \ 59 libLLVMInstrumentation \ 60 libLLVMipa \ 61 libLLVMAnalysis \ 62 libLLVMTarget \ 63 libLLVMMC \ 64 libLLVMMCParser \ 65 libLLVMCore \ 66 libclangParse \ 67 libclangSema \ 68 libclangAnalysis \ 69 libclangAST \ 70 libclangLex \ 71 libclangFrontend \ 72 libclangCodeGen \ 73 libclangBasic \ 74 libLLVMSupport 75 76# Static library libslang for host 77# ======================================================== 78include $(CLEAR_VARS) 79include $(CLEAR_TBLGEN_VARS) 80 81LLVM_ROOT_PATH := external/llvm 82CLANG_ROOT_PATH := external/clang 83 84include $(CLANG_ROOT_PATH)/clang.mk 85 86LOCAL_MODULE := libslang 87LOCAL_MODULE_TAGS := optional 88 89LOCAL_CFLAGS += $(local_cflags_for_slang) 90 91TBLGEN_TABLES := \ 92 AttrList.inc \ 93 Attrs.inc \ 94 DeclNodes.inc \ 95 DiagnosticCommonKinds.inc \ 96 DiagnosticFrontendKinds.inc \ 97 DiagnosticSemaKinds.inc \ 98 StmtNodes.inc 99 100LOCAL_SRC_FILES := \ 101 slang.cpp \ 102 slang_utils.cpp \ 103 slang_backend.cpp \ 104 slang_pragma_recorder.cpp \ 105 slang_diagnostic_buffer.cpp 106 107LOCAL_LDLIBS := -ldl -lpthread 108 109include $(CLANG_HOST_BUILD_MK) 110include $(CLANG_TBLGEN_RULES_MK) 111include $(LLVM_GEN_INTRINSICS_MK) 112include $(BUILD_HOST_STATIC_LIBRARY) 113 114# Host static library containing rslib.bc 115# ======================================================== 116include $(CLEAR_VARS) 117 118input_data_file := frameworks/compile/slang/rslib.bc 119slangdata_output_var_name := rslib_bc 120 121LOCAL_IS_HOST_MODULE := true 122LOCAL_MODULE := librslib 123LOCAL_MODULE_TAGS := optional 124 125LOCAL_MODULE_CLASS := STATIC_LIBRARIES 126 127include $(LOCAL_PATH)/SlangData.mk 128include $(BUILD_HOST_STATIC_LIBRARY) 129 130# Executable slang-data for host 131# ======================================================== 132include $(CLEAR_VARS) 133 134LOCAL_MODULE := slang-data 135LOCAL_MODULE_TAGS := optional 136 137LOCAL_MODULE_CLASS := EXECUTABLES 138 139LOCAL_SRC_FILES := slang-data.c 140 141include $(BUILD_HOST_EXECUTABLE) 142 143# Executable llvm-rs-link for host 144# ======================================================== 145include $(CLEAR_VARS) 146include $(CLEAR_TBLGEN_VARS) 147 148include $(LLVM_ROOT_PATH)/llvm.mk 149 150LOCAL_MODULE := llvm-rs-link 151LOCAL_MODULE_TAGS := optional 152 153LOCAL_MODULE_CLASS := EXECUTABLES 154 155LOCAL_SRC_FILES := \ 156 llvm-rs-link.cpp 157 158LOCAL_STATIC_LIBRARIES := \ 159 librslib libslang \ 160 $(static_libraries_needed_by_slang) 161 162LOCAL_LDLIBS := -ldl -lpthread 163 164include $(LLVM_HOST_BUILD_MK) 165include $(LLVM_GEN_INTRINSICS_MK) 166include $(BUILD_HOST_EXECUTABLE) 167 168# Executable rs-spec-gen for host 169# ======================================================== 170include $(CLEAR_VARS) 171 172LOCAL_MODULE := rs-spec-gen 173LOCAL_MODULE_TAGS := optional 174 175LOCAL_MODULE_CLASS := EXECUTABLES 176 177LOCAL_SRC_FILES := \ 178 slang_rs_spec_table.cpp 179 180include $(BUILD_HOST_EXECUTABLE) 181 182# Executable llvm-rs-cc for host 183# ======================================================== 184include $(CLEAR_VARS) 185include $(CLEAR_TBLGEN_VARS) 186 187LOCAL_IS_HOST_MODULE := true 188LOCAL_MODULE := llvm-rs-cc 189LOCAL_MODULE_TAGS := optional 190 191LOCAL_MODULE_CLASS := EXECUTABLES 192 193LOCAL_CFLAGS += $(local_cflags_for_slang) 194 195TBLGEN_TABLES := \ 196 AttrList.inc \ 197 Attrs.inc \ 198 DeclNodes.inc \ 199 DiagnosticCommonKinds.inc \ 200 DiagnosticDriverKinds.inc \ 201 DiagnosticFrontendKinds.inc \ 202 DiagnosticSemaKinds.inc \ 203 StmtNodes.inc \ 204 RSCCOptions.inc 205 206RS_SPEC_TABLES := \ 207 RSClangBuiltinEnums.inc \ 208 RSDataTypeEnums.inc \ 209 RSDataElementEnums.inc \ 210 RSDataKindEnums.inc \ 211 RSMatrixTypeEnums.inc \ 212 RSObjectTypeEnums.inc 213 214LOCAL_SRC_FILES := \ 215 llvm-rs-cc.cpp \ 216 slang_rs.cpp \ 217 slang_rs_ast_replace.cpp \ 218 slang_rs_context.cpp \ 219 slang_rs_pragma_handler.cpp \ 220 slang_rs_backend.cpp \ 221 slang_rs_exportable.cpp \ 222 slang_rs_export_type.cpp \ 223 slang_rs_export_element.cpp \ 224 slang_rs_export_var.cpp \ 225 slang_rs_export_func.cpp \ 226 slang_rs_export_foreach.cpp \ 227 slang_rs_object_ref_count.cpp \ 228 slang_rs_reflection.cpp \ 229 slang_rs_reflect_utils.cpp \ 230 231LOCAL_STATIC_LIBRARIES := \ 232 libclangDriver libslang \ 233 $(static_libraries_needed_by_slang) 234 235ifeq ($(HOST_OS),windows) 236 LOCAL_LDLIBS := -limagehlp -lpsapi 237else 238 LOCAL_LDLIBS := -ldl -lpthread 239endif 240 241# For build RSCCOptions.inc from RSCCOptions.td 242intermediates := $(call local-intermediates-dir) 243LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc 244$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(TBLGEN) 245 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen" 246 $(call transform-host-td-to-out,opt-parser-defs) 247 248include frameworks/compile/slang/RSSpec.mk 249include $(CLANG_HOST_BUILD_MK) 250include $(CLANG_TBLGEN_RULES_MK) 251include $(BUILD_HOST_EXECUTABLE) 252 253endif # TARGET_BUILD_APPS 254 255#===================================================================== 256# Include Subdirectories 257#===================================================================== 258include $(call all-makefiles-under,$(LOCAL_PATH)) 259