Zonr Chang | e86245a | 2010-10-12 21:42:13 +0800 | [diff] [blame] | 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 | # |
Ying Wang | 94ca204 | 2014-08-01 14:20:35 -0700 | [diff] [blame] | 16 | LOCAL_PATH := $(call my-dir) |
David Gross | a0ea114 | 2015-06-12 14:29:16 -0700 | [diff] [blame] | 17 | |
| 18 | FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false |
| 19 | # Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false". |
| 20 | ifneq "$(words $(FORCE_BUILD_LLVM_DISABLE_NDEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DISABLE_NDEBUG)))" "10" |
| 21 | $(error FORCE_BUILD_LLVM_DISABLE_NDEBUG may only be true, false, or unset) |
| 22 | endif |
| 23 | |
| 24 | FORCE_BUILD_LLVM_DEBUG ?= false |
| 25 | # Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false". |
| 26 | ifneq "$(words $(FORCE_BUILD_LLVM_DEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DEBUG)))" "10" |
| 27 | $(error FORCE_BUILD_LLVM_DEBUG may only be true, false, or unset) |
| 28 | endif |
Ying Wang | a20a2fd | 2011-03-30 12:58:06 -0700 | [diff] [blame] | 29 | |
| 30 | # The prebuilt tools should be used when we are doing app-only build. |
| 31 | ifeq ($(TARGET_BUILD_APPS),) |
| 32 | |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 33 | |
Stephen Hines | 383f0b8 | 2015-06-10 17:08:16 -0700 | [diff] [blame] | 34 | local_cflags_for_slang := -Wall -Werror -std=c++11 |
Tim Murray | 881abe9 | 2012-09-28 14:14:24 -0700 | [diff] [blame] | 35 | ifeq ($(TARGET_BUILD_VARIANT),eng) |
David Gross | 2770d0e | 2015-08-03 14:58:59 -0700 | [diff] [blame] | 36 | local_cflags_for_slang += -O0 -D__ENABLE_INTERNAL_OPTIONS |
Tim Murray | 881abe9 | 2012-09-28 14:14:24 -0700 | [diff] [blame] | 37 | else |
Jean-Luc Brouillet | 4324394 | 2014-05-23 10:17:22 -0700 | [diff] [blame] | 38 | ifeq ($(TARGET_BUILD_VARIANT),userdebug) |
| 39 | else |
Alex Sakhartchouk | 9be9360 | 2011-03-17 17:03:36 -0700 | [diff] [blame] | 40 | local_cflags_for_slang += -D__DISABLE_ASSERTS |
| 41 | endif |
Jean-Luc Brouillet | 4324394 | 2014-05-23 10:17:22 -0700 | [diff] [blame] | 42 | endif |
Stephen Hines | ba7c6dc | 2011-09-07 19:57:04 -0700 | [diff] [blame] | 43 | local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT) |
Alex Sakhartchouk | 9be9360 | 2011-03-17 17:03:36 -0700 | [diff] [blame] | 44 | |
Stephen Hines | 483f47c | 2014-05-13 17:28:57 -0700 | [diff] [blame] | 45 | include $(LOCAL_PATH)/rs_version.mk |
| 46 | local_cflags_for_slang += $(RS_VERSION_DEFINE) |
Stephen Hines | 6b201eb | 2011-07-20 17:08:16 -0700 | [diff] [blame] | 47 | |
Ying Wang | 000c307 | 2011-01-27 19:06:02 -0800 | [diff] [blame] | 48 | static_libraries_needed_by_slang := \ |
Logan Chien | 9207a2e | 2011-10-21 15:39:28 +0800 | [diff] [blame] | 49 | libLLVMBitWriter_2_9 \ |
Stephen Hines | 9b044ec | 2011-11-23 16:30:16 -0800 | [diff] [blame] | 50 | libLLVMBitWriter_2_9_func \ |
Stephen Hines | bfe3e97 | 2013-02-27 13:52:15 -0800 | [diff] [blame] | 51 | libLLVMBitWriter_3_2 |
Zonr Chang | 08df36e | 2010-10-07 18:50:42 +0800 | [diff] [blame] | 52 | |
Ying Wang | 000c307 | 2011-01-27 19:06:02 -0800 | [diff] [blame] | 53 | # Static library libslang for host |
| 54 | # ======================================================== |
| 55 | include $(CLEAR_VARS) |
| 56 | include $(CLEAR_TBLGEN_VARS) |
| 57 | |
| 58 | LLVM_ROOT_PATH := external/llvm |
| 59 | CLANG_ROOT_PATH := external/clang |
| 60 | |
| 61 | include $(CLANG_ROOT_PATH)/clang.mk |
| 62 | |
| 63 | LOCAL_MODULE := libslang |
| 64 | LOCAL_MODULE_TAGS := optional |
| 65 | |
Alex Sakhartchouk | 9be9360 | 2011-03-17 17:03:36 -0700 | [diff] [blame] | 66 | LOCAL_CFLAGS += $(local_cflags_for_slang) |
Ying Wang | 000c307 | 2011-01-27 19:06:02 -0800 | [diff] [blame] | 67 | |
Stephen Hines | 505e9bd | 2015-08-14 20:40:07 -0700 | [diff] [blame] | 68 | # Skip missing-field-initializer warnings for mingw. |
Dan Willemsen | c8b0cda | 2015-08-18 16:49:38 -0700 | [diff] [blame] | 69 | LOCAL_CFLAGS_windows += -Wno-error=missing-field-initializers |
Stephen Hines | 505e9bd | 2015-08-14 20:40:07 -0700 | [diff] [blame] | 70 | |
Ying Wang | 000c307 | 2011-01-27 19:06:02 -0800 | [diff] [blame] | 71 | TBLGEN_TABLES := \ |
| 72 | AttrList.inc \ |
| 73 | Attrs.inc \ |
Stephen Hines | 0da7f6c | 2013-03-05 15:19:02 -0800 | [diff] [blame] | 74 | CommentCommandList.inc \ |
Shih-wei Liao | 43730fe | 2012-08-02 23:06:18 -0700 | [diff] [blame] | 75 | CommentNodes.inc \ |
Ying Wang | 000c307 | 2011-01-27 19:06:02 -0800 | [diff] [blame] | 76 | DeclNodes.inc \ |
| 77 | DiagnosticCommonKinds.inc \ |
| 78 | DiagnosticFrontendKinds.inc \ |
| 79 | DiagnosticSemaKinds.inc \ |
| 80 | StmtNodes.inc |
| 81 | |
| 82 | LOCAL_SRC_FILES := \ |
| 83 | slang.cpp \ |
Matt Wala | dabd246 | 2015-07-15 18:39:41 -0700 | [diff] [blame] | 84 | slang_bitcode_gen.cpp \ |
Ying Wang | 000c307 | 2011-01-27 19:06:02 -0800 | [diff] [blame] | 85 | slang_backend.cpp \ |
| 86 | slang_pragma_recorder.cpp \ |
| 87 | slang_diagnostic_buffer.cpp |
| 88 | |
Stephen Hines | 5e6d0d5 | 2011-11-22 19:42:41 -0800 | [diff] [blame] | 89 | LOCAL_C_INCLUDES += frameworks/compile/libbcc/include |
| 90 | |
Logan Chien | 231f578 | 2014-05-26 23:03:25 +0800 | [diff] [blame] | 91 | LOCAL_LDLIBS := -ldl -lpthread |
Zonr Chang | 08df36e | 2010-10-07 18:50:42 +0800 | [diff] [blame] | 92 | |
| 93 | include $(CLANG_HOST_BUILD_MK) |
| 94 | include $(CLANG_TBLGEN_RULES_MK) |
| 95 | include $(LLVM_GEN_INTRINSICS_MK) |
Ying Wang | e2201c0 | 2011-01-11 17:29:32 -0800 | [diff] [blame] | 96 | include $(BUILD_HOST_STATIC_LIBRARY) |
Zonr Chang | 08df36e | 2010-10-07 18:50:42 +0800 | [diff] [blame] | 97 | |
Tobias Grosser | c908b90 | 2013-06-21 11:28:49 -0700 | [diff] [blame] | 98 | # ======================================================== |
| 99 | include $(CLEAR_VARS) |
| 100 | |
| 101 | LOCAL_MODULE := llvm-rs-as |
| 102 | LOCAL_MODULE_TAGS := optional |
| 103 | |
| 104 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 105 | |
| 106 | LOCAL_SRC_FILES := \ |
| 107 | llvm-rs-as.cpp |
| 108 | |
| 109 | LOCAL_CFLAGS += $(local_cflags_for_slang) |
| 110 | LOCAL_STATIC_LIBRARIES := \ |
| 111 | libslang \ |
| 112 | $(static_libraries_needed_by_slang) |
| 113 | LOCAL_SHARED_LIBRARIES := \ |
| 114 | libLLVM |
| 115 | |
| 116 | include $(CLANG_HOST_BUILD_MK) |
| 117 | include $(BUILD_HOST_EXECUTABLE) |
| 118 | |
Shih-wei Liao | ffa58bb | 2010-10-10 14:15:13 -0700 | [diff] [blame] | 119 | # Executable llvm-rs-cc for host |
Shih-wei Liao | 835a7b7 | 2010-08-06 02:29:11 -0700 | [diff] [blame] | 120 | # ======================================================== |
| 121 | include $(CLEAR_VARS) |
| 122 | include $(CLEAR_TBLGEN_VARS) |
| 123 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 124 | LOCAL_IS_HOST_MODULE := true |
| 125 | LOCAL_MODULE := llvm-rs-cc |
Stephen Hines | 505e9bd | 2015-08-14 20:40:07 -0700 | [diff] [blame] | 126 | |
| 127 | LOCAL_CFLAGS += $(local_cflags_for_slang) |
| 128 | |
Stephen Hines | 505e9bd | 2015-08-14 20:40:07 -0700 | [diff] [blame] | 129 | # Skip missing-field-initializer warnings for mingw. |
| 130 | LOCAL_CFLAGS += -Wno-error=missing-field-initializers |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 131 | LOCAL_MODULE_TAGS := optional |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 132 | |
Shih-wei Liao | bdd7888 | 2010-06-06 05:55:36 -0700 | [diff] [blame] | 133 | LOCAL_MODULE_CLASS := EXECUTABLES |
| 134 | |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 135 | TBLGEN_TABLES := \ |
Shih-wei Liao | f52a620 | 2010-09-10 17:40:53 -0700 | [diff] [blame] | 136 | AttrList.inc \ |
| 137 | Attrs.inc \ |
Stephen Hines | 0da7f6c | 2013-03-05 15:19:02 -0800 | [diff] [blame] | 138 | CommentCommandList.inc \ |
Shih-wei Liao | 43730fe | 2012-08-02 23:06:18 -0700 | [diff] [blame] | 139 | CommentNodes.inc \ |
Shih-wei Liao | f52a620 | 2010-09-10 17:40:53 -0700 | [diff] [blame] | 140 | DeclNodes.inc \ |
| 141 | DiagnosticCommonKinds.inc \ |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 142 | DiagnosticDriverKinds.inc \ |
Zonr Chang | cf6af6a | 2010-10-12 12:38:51 +0800 | [diff] [blame] | 143 | DiagnosticFrontendKinds.inc \ |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 144 | DiagnosticSemaKinds.inc \ |
Zonr Chang | 92b344a | 2010-10-05 20:39:03 +0800 | [diff] [blame] | 145 | StmtNodes.inc \ |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 146 | RSCCOptions.inc |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 147 | |
| 148 | LOCAL_SRC_FILES := \ |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 149 | llvm-rs-cc.cpp \ |
Stephen Hines | 8b5c5c6 | 2014-06-06 18:03:18 -0700 | [diff] [blame] | 150 | rs_cc_options.cpp \ |
Yang Ni | fb40ee2 | 2015-10-13 20:34:06 +0000 | [diff] [blame] | 151 | slang_rs_foreach_lowering.cpp \ |
Stephen Hines | 292e00a | 2011-03-18 19:11:30 -0700 | [diff] [blame] | 152 | slang_rs_ast_replace.cpp \ |
Stephen Hines | 11274a7 | 2012-09-26 19:14:20 -0700 | [diff] [blame] | 153 | slang_rs_check_ast.cpp \ |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 154 | slang_rs_context.cpp \ |
| 155 | slang_rs_pragma_handler.cpp \ |
Zonr Chang | 641558f | 2010-10-12 21:07:06 +0800 | [diff] [blame] | 156 | slang_rs_exportable.cpp \ |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 157 | slang_rs_export_type.cpp \ |
| 158 | slang_rs_export_element.cpp \ |
| 159 | slang_rs_export_var.cpp \ |
| 160 | slang_rs_export_func.cpp \ |
Matt Wala | c0c5dd8 | 2015-07-23 17:29:37 -0700 | [diff] [blame] | 161 | slang_rs_export_foreach.cpp \ |
| 162 | slang_rs_export_reduce.cpp \ |
Stephen Hines | 4b32ffd | 2010-11-05 18:47:11 -0700 | [diff] [blame] | 163 | slang_rs_object_ref_count.cpp \ |
Ying Wang | 3f8b44d | 2010-09-04 01:17:01 -0700 | [diff] [blame] | 164 | slang_rs_reflection.cpp \ |
Jason Sams | 1b6a088 | 2012-03-12 15:07:58 -0700 | [diff] [blame] | 165 | slang_rs_reflection_cpp.cpp \ |
Stephen Hines | 552d872 | 2013-12-18 12:21:50 -0800 | [diff] [blame] | 166 | slang_rs_reflect_utils.cpp \ |
Matt Wala | eae0b7a | 2015-06-16 14:06:25 -0700 | [diff] [blame] | 167 | slang_rs_special_func.cpp \ |
Stephen Hines | 552d872 | 2013-12-18 12:21:50 -0800 | [diff] [blame] | 168 | strip_unknown_attributes.cpp |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 169 | |
David Gross | 18c50eb | 2015-01-30 11:39:22 -0800 | [diff] [blame] | 170 | LOCAL_C_INCLUDES += frameworks/compile/libbcc/include |
| 171 | |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 172 | LOCAL_STATIC_LIBRARIES := \ |
Stephen Hines | bfe3e97 | 2013-02-27 13:52:15 -0800 | [diff] [blame] | 173 | libslang \ |
Ying Wang | 000c307 | 2011-01-27 19:06:02 -0800 | [diff] [blame] | 174 | $(static_libraries_needed_by_slang) |
Ying Wang | e2201c0 | 2011-01-11 17:29:32 -0800 | [diff] [blame] | 175 | |
Stephen Hines | bfe3e97 | 2013-02-27 13:52:15 -0800 | [diff] [blame] | 176 | LOCAL_SHARED_LIBRARIES := \ |
| 177 | libclang \ |
| 178 | libLLVM |
| 179 | |
Dan Willemsen | c8b0cda | 2015-08-18 16:49:38 -0700 | [diff] [blame] | 180 | LOCAL_LDLIBS_windows := -limagehlp -lpsapi |
| 181 | LOCAL_LDLIBS_linux := -ldl -lpthread |
| 182 | LOCAL_LDLIBS_darwin := -ldl -lpthread |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 183 | |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 184 | # For build RSCCOptions.inc from RSCCOptions.td |
Ying Wang | d1e54f5 | 2014-05-20 15:53:17 -0700 | [diff] [blame] | 185 | intermediates := $(call local-generated-sources-dir) |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 186 | LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc |
Tim Murray | 0e3f8c7 | 2014-06-04 12:24:50 -0700 | [diff] [blame] | 187 | $(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN) |
Stephen Hines | b7d1269 | 2011-09-02 18:16:19 -0700 | [diff] [blame] | 188 | @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen" |
Stephen Hines | a1f95ee | 2013-08-09 01:26:08 -0700 | [diff] [blame] | 189 | $(call transform-host-td-to-out,opt-parser-defs) |
Shih-wei Liao | b81c6a4 | 2010-10-10 14:15:00 -0700 | [diff] [blame] | 190 | |
Shih-wei Liao | 462aefd | 2010-06-04 15:32:04 -0700 | [diff] [blame] | 191 | include $(CLANG_HOST_BUILD_MK) |
| 192 | include $(CLANG_TBLGEN_RULES_MK) |
| 193 | include $(BUILD_HOST_EXECUTABLE) |
Ying Wang | a20a2fd | 2011-03-30 12:58:06 -0700 | [diff] [blame] | 194 | |
| 195 | endif # TARGET_BUILD_APPS |
Stephen Hines | 4cc499d | 2011-08-24 19:06:17 -0700 | [diff] [blame] | 196 | |
| 197 | #===================================================================== |
| 198 | # Include Subdirectories |
| 199 | #===================================================================== |
| 200 | include $(call all-makefiles-under,$(LOCAL_PATH)) |