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