blob: ee0f7a4717a1e75d82ab10eb4b5cec873b63dcd4 [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)
Ying Wanga20a2fd2011-03-30 12:58:06 -070017
18# The prebuilt tools should be used when we are doing app-only build.
19ifeq ($(TARGET_BUILD_APPS),)
20
Shih-wei Liao462aefd2010-06-04 15:32:04 -070021
Narayan Kamath4fda8582014-03-26 11:00:53 +000022local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Wno-return-type -Werror
Tim Murray881abe92012-09-28 14:14:24 -070023ifeq ($(TARGET_BUILD_VARIANT),eng)
24local_cflags_for_slang += -O0
25else
Jean-Luc Brouillet43243942014-05-23 10:17:22 -070026ifeq ($(TARGET_BUILD_VARIANT),userdebug)
27else
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070028local_cflags_for_slang += -D__DISABLE_ASSERTS
29endif
Jean-Luc Brouillet43243942014-05-23 10:17:22 -070030endif
Stephen Hinesba7c6dc2011-09-07 19:57:04 -070031local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070032
Stephen Hines483f47c2014-05-13 17:28:57 -070033include $(LOCAL_PATH)/rs_version.mk
34local_cflags_for_slang += $(RS_VERSION_DEFINE)
Stephen Hines6b201eb2011-07-20 17:08:16 -070035
Ying Wang000c3072011-01-27 19:06:02 -080036static_libraries_needed_by_slang := \
Logan Chien9207a2e2011-10-21 15:39:28 +080037 libLLVMBitWriter_2_9 \
Stephen Hines9b044ec2011-11-23 16:30:16 -080038 libLLVMBitWriter_2_9_func \
Stephen Hinesbfe3e972013-02-27 13:52:15 -080039 libLLVMBitWriter_3_2
Zonr Chang08df36e2010-10-07 18:50:42 +080040
Ying Wang000c3072011-01-27 19:06:02 -080041# 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
Logan Chien231f5782014-05-26 23:03:25 +080053ifneq ($(HOST_OS),windows)
Andrew Hsieh19bb5f52014-05-08 21:44:57 +080054LOCAL_CLANG := true
Logan Chien231f5782014-05-26 23:03:25 +080055endif
Ying Wang000c3072011-01-27 19:06:02 -080056
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070057LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080058
59TBLGEN_TABLES := \
60 AttrList.inc \
61 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -080062 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -070063 CommentNodes.inc \
Ying Wang000c3072011-01-27 19:06:02 -080064 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
Stephen Hines5e6d0d52011-11-22 19:42:41 -080077LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
78
Logan Chien231f5782014-05-26 23:03:25 +080079LOCAL_LDLIBS := -ldl -lpthread
80ifneq ($(HOST_OS),windows)
81LOCAL_LDLIBS += -lc++
82endif
Zonr Chang08df36e2010-10-07 18:50:42 +080083
84include $(CLANG_HOST_BUILD_MK)
85include $(CLANG_TBLGEN_RULES_MK)
86include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -080087include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +080088
Tobias Grosserc908b902013-06-21 11:28:49 -070089# ========================================================
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
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700110# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700111# ========================================================
112include $(CLEAR_VARS)
113include $(CLEAR_TBLGEN_VARS)
114
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700115LOCAL_IS_HOST_MODULE := true
116LOCAL_MODULE := llvm-rs-cc
Logan Chien231f5782014-05-26 23:03:25 +0800117ifneq ($(HOST_OS),windows)
Andrew Hsieh19bb5f52014-05-08 21:44:57 +0800118LOCAL_CLANG := true
Logan Chien231f5782014-05-26 23:03:25 +0800119endif
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700120LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700121
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700122LOCAL_MODULE_CLASS := EXECUTABLES
123
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700124LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700125
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700126TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700127 AttrList.inc \
128 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -0800129 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700130 CommentNodes.inc \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700131 DeclNodes.inc \
132 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700133 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800134 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700135 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800136 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700137 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700138
139LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700140 llvm-rs-cc.cpp \
Stephen Hines8b5c5c62014-06-06 18:03:18 -0700141 rs_cc_options.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800142 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700143 slang_rs_ast_replace.cpp \
Stephen Hines11274a72012-09-26 19:14:20 -0700144 slang_rs_check_ast.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700145 slang_rs_context.cpp \
146 slang_rs_pragma_handler.cpp \
147 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800148 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700149 slang_rs_export_type.cpp \
150 slang_rs_export_element.cpp \
151 slang_rs_export_var.cpp \
152 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700153 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700154 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700155 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700156 slang_rs_reflection_cpp.cpp \
Stephen Hines552d8722013-12-18 12:21:50 -0800157 slang_rs_reflect_utils.cpp \
158 strip_unknown_attributes.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700159
160LOCAL_STATIC_LIBRARIES := \
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800161 libslang \
Ying Wang000c3072011-01-27 19:06:02 -0800162 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800163
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800164LOCAL_SHARED_LIBRARIES := \
165 libclang \
166 libLLVM
167
Raphael11e2b932011-01-13 15:13:35 -0800168ifeq ($(HOST_OS),windows)
169 LOCAL_LDLIBS := -limagehlp -lpsapi
170else
171 LOCAL_LDLIBS := -ldl -lpthread
172endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700173
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700174# For build RSCCOptions.inc from RSCCOptions.td
Ying Wangd1e54f52014-05-20 15:53:17 -0700175intermediates := $(call local-generated-sources-dir)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700176LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Tim Murray0e3f8c72014-06-04 12:24:50 -0700177$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700178 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Stephen Hinesa1f95ee2013-08-09 01:26:08 -0700179 $(call transform-host-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700180
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700181include $(CLANG_HOST_BUILD_MK)
182include $(CLANG_TBLGEN_RULES_MK)
183include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700184
185endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700186
187#=====================================================================
188# Include Subdirectories
189#=====================================================================
190include $(call all-makefiles-under,$(LOCAL_PATH))