blob: 4a453e244173cf18cca457e7ea5bd2ba6c365077 [file] [log] [blame]
Zonr Change86245a2010-10-12 21:42:13 +08001#
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 Wang94ca2042014-08-01 14:20:35 -070016LOCAL_PATH := $(call my-dir)
David Grossa0ea1142015-06-12 14:29:16 -070017
18FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false
19# Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false".
20ifneq "$(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)
22endif
23
24FORCE_BUILD_LLVM_DEBUG ?= false
25# Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false".
26ifneq "$(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)
28endif
Ying Wanga20a2fd2011-03-30 12:58:06 -070029
30# The prebuilt tools should be used when we are doing app-only build.
31ifeq ($(TARGET_BUILD_APPS),)
32
Shih-wei Liao462aefd2010-06-04 15:32:04 -070033
Stephen Hines383f0b82015-06-10 17:08:16 -070034local_cflags_for_slang := -Wall -Werror -std=c++11
Tim Murray881abe92012-09-28 14:14:24 -070035ifeq ($(TARGET_BUILD_VARIANT),eng)
David Gross2770d0e2015-08-03 14:58:59 -070036local_cflags_for_slang += -O0 -D__ENABLE_INTERNAL_OPTIONS
Tim Murray881abe92012-09-28 14:14:24 -070037else
Jean-Luc Brouillet43243942014-05-23 10:17:22 -070038ifeq ($(TARGET_BUILD_VARIANT),userdebug)
39else
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070040local_cflags_for_slang += -D__DISABLE_ASSERTS
41endif
Jean-Luc Brouillet43243942014-05-23 10:17:22 -070042endif
Stephen Hinesba7c6dc2011-09-07 19:57:04 -070043local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070044
Stephen Hines483f47c2014-05-13 17:28:57 -070045include $(LOCAL_PATH)/rs_version.mk
46local_cflags_for_slang += $(RS_VERSION_DEFINE)
Stephen Hines6b201eb2011-07-20 17:08:16 -070047
Ying Wang000c3072011-01-27 19:06:02 -080048static_libraries_needed_by_slang := \
Logan Chien9207a2e2011-10-21 15:39:28 +080049 libLLVMBitWriter_2_9 \
Stephen Hines9b044ec2011-11-23 16:30:16 -080050 libLLVMBitWriter_2_9_func \
Stephen Hinesbfe3e972013-02-27 13:52:15 -080051 libLLVMBitWriter_3_2
Zonr Chang08df36e2010-10-07 18:50:42 +080052
Ying Wang000c3072011-01-27 19:06:02 -080053# Static library libslang for host
54# ========================================================
55include $(CLEAR_VARS)
56include $(CLEAR_TBLGEN_VARS)
57
58LLVM_ROOT_PATH := external/llvm
59CLANG_ROOT_PATH := external/clang
60
61include $(CLANG_ROOT_PATH)/clang.mk
62
63LOCAL_MODULE := libslang
64LOCAL_MODULE_TAGS := optional
65
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070066LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080067
Stephen Hines505e9bd2015-08-14 20:40:07 -070068ifeq ($(HOST_OS),windows)
69# Skip missing-field-initializer warnings for mingw.
70LOCAL_CFLAGS += -Wno-error=missing-field-initializers
71else
72LOCAL_CLANG := true
73endif
74
Ying Wang000c3072011-01-27 19:06:02 -080075TBLGEN_TABLES := \
76 AttrList.inc \
77 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -080078 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -070079 CommentNodes.inc \
Ying Wang000c3072011-01-27 19:06:02 -080080 DeclNodes.inc \
81 DiagnosticCommonKinds.inc \
82 DiagnosticFrontendKinds.inc \
83 DiagnosticSemaKinds.inc \
84 StmtNodes.inc
85
86LOCAL_SRC_FILES := \
87 slang.cpp \
Matt Waladabd2462015-07-15 18:39:41 -070088 slang_bitcode_gen.cpp \
Ying Wang000c3072011-01-27 19:06:02 -080089 slang_backend.cpp \
90 slang_pragma_recorder.cpp \
91 slang_diagnostic_buffer.cpp
92
Stephen Hines5e6d0d52011-11-22 19:42:41 -080093LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
94
Logan Chien231f5782014-05-26 23:03:25 +080095LOCAL_LDLIBS := -ldl -lpthread
96ifneq ($(HOST_OS),windows)
Stephen Hinese1c25bd2014-10-06 12:33:18 -070097LOCAL_CXX_STL := libc++
Logan Chien231f5782014-05-26 23:03:25 +080098endif
Zonr Chang08df36e2010-10-07 18:50:42 +080099
100include $(CLANG_HOST_BUILD_MK)
101include $(CLANG_TBLGEN_RULES_MK)
102include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -0800103include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +0800104
Tobias Grosserc908b902013-06-21 11:28:49 -0700105# ========================================================
106include $(CLEAR_VARS)
107
108LOCAL_MODULE := llvm-rs-as
109LOCAL_MODULE_TAGS := optional
110
111LOCAL_MODULE_CLASS := EXECUTABLES
112
113LOCAL_SRC_FILES := \
114 llvm-rs-as.cpp
115
116LOCAL_CFLAGS += $(local_cflags_for_slang)
117LOCAL_STATIC_LIBRARIES := \
118 libslang \
119 $(static_libraries_needed_by_slang)
120LOCAL_SHARED_LIBRARIES := \
121 libLLVM
122
123include $(CLANG_HOST_BUILD_MK)
124include $(BUILD_HOST_EXECUTABLE)
125
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700126# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700127# ========================================================
128include $(CLEAR_VARS)
129include $(CLEAR_TBLGEN_VARS)
130
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700131LOCAL_IS_HOST_MODULE := true
132LOCAL_MODULE := llvm-rs-cc
Stephen Hines505e9bd2015-08-14 20:40:07 -0700133
134LOCAL_CFLAGS += $(local_cflags_for_slang)
135
136ifeq ($(HOST_OS),windows)
137# Skip missing-field-initializer warnings for mingw.
138LOCAL_CFLAGS += -Wno-error=missing-field-initializers
139else
Andrew Hsieh19bb5f52014-05-08 21:44:57 +0800140LOCAL_CLANG := true
Logan Chien231f5782014-05-26 23:03:25 +0800141endif
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700142LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700143
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700144LOCAL_MODULE_CLASS := EXECUTABLES
145
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700146TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700147 AttrList.inc \
148 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -0800149 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700150 CommentNodes.inc \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700151 DeclNodes.inc \
152 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700153 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800154 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700155 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800156 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700157 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700158
159LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700160 llvm-rs-cc.cpp \
Stephen Hines8b5c5c62014-06-06 18:03:18 -0700161 rs_cc_options.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700162 slang_rs_ast_replace.cpp \
Stephen Hines11274a72012-09-26 19:14:20 -0700163 slang_rs_check_ast.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700164 slang_rs_context.cpp \
165 slang_rs_pragma_handler.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800166 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700167 slang_rs_export_type.cpp \
168 slang_rs_export_element.cpp \
169 slang_rs_export_var.cpp \
170 slang_rs_export_func.cpp \
Matt Walac0c5dd82015-07-23 17:29:37 -0700171 slang_rs_export_foreach.cpp \
172 slang_rs_export_reduce.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700173 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700174 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700175 slang_rs_reflection_cpp.cpp \
Stephen Hines552d8722013-12-18 12:21:50 -0800176 slang_rs_reflect_utils.cpp \
Matt Walaeae0b7a2015-06-16 14:06:25 -0700177 slang_rs_special_func.cpp \
Stephen Hines552d8722013-12-18 12:21:50 -0800178 strip_unknown_attributes.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700179
David Gross18c50eb2015-01-30 11:39:22 -0800180LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
181
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700182LOCAL_STATIC_LIBRARIES := \
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800183 libslang \
Ying Wang000c3072011-01-27 19:06:02 -0800184 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800185
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800186LOCAL_SHARED_LIBRARIES := \
187 libclang \
188 libLLVM
189
Raphael11e2b932011-01-13 15:13:35 -0800190ifeq ($(HOST_OS),windows)
191 LOCAL_LDLIBS := -limagehlp -lpsapi
192else
193 LOCAL_LDLIBS := -ldl -lpthread
194endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700195
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700196# For build RSCCOptions.inc from RSCCOptions.td
Ying Wangd1e54f52014-05-20 15:53:17 -0700197intermediates := $(call local-generated-sources-dir)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700198LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Tim Murray0e3f8c72014-06-04 12:24:50 -0700199$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700200 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Stephen Hinesa1f95ee2013-08-09 01:26:08 -0700201 $(call transform-host-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700202
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700203include $(CLANG_HOST_BUILD_MK)
204include $(CLANG_TBLGEN_RULES_MK)
205include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700206
207endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700208
209#=====================================================================
210# Include Subdirectories
211#=====================================================================
212include $(call all-makefiles-under,$(LOCAL_PATH))