blob: 4fdc388b1df3bba3b27b65b5efa64211546689ed [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 Wanga20a2fd2011-03-30 12:58:06 -070016
17# The prebuilt tools should be used when we are doing app-only build.
18ifeq ($(TARGET_BUILD_APPS),)
19
Shih-wei Liao462aefd2010-06-04 15:32:04 -070020LOCAL_PATH := $(call my-dir)
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
Andrew Hsieh19bb5f52014-05-08 21:44:57 +080053LOCAL_CLANG := true
Ying Wang000c3072011-01-27 19:06:02 -080054
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070055LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080056
57TBLGEN_TABLES := \
58 AttrList.inc \
59 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -080060 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -070061 CommentNodes.inc \
Ying Wang000c3072011-01-27 19:06:02 -080062 DeclNodes.inc \
63 DiagnosticCommonKinds.inc \
64 DiagnosticFrontendKinds.inc \
65 DiagnosticSemaKinds.inc \
66 StmtNodes.inc
67
68LOCAL_SRC_FILES := \
69 slang.cpp \
70 slang_utils.cpp \
71 slang_backend.cpp \
72 slang_pragma_recorder.cpp \
73 slang_diagnostic_buffer.cpp
74
Stephen Hines5e6d0d52011-11-22 19:42:41 -080075LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
76
Tim Murrayee4016d2014-04-10 15:49:08 -070077LOCAL_LDLIBS := -ldl -lpthread -lc++
Zonr Chang08df36e2010-10-07 18:50:42 +080078
79include $(CLANG_HOST_BUILD_MK)
80include $(CLANG_TBLGEN_RULES_MK)
81include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -080082include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +080083
Tobias Grosserc908b902013-06-21 11:28:49 -070084# ========================================================
85include $(CLEAR_VARS)
86
87LOCAL_MODULE := llvm-rs-as
88LOCAL_MODULE_TAGS := optional
89
90LOCAL_MODULE_CLASS := EXECUTABLES
91
92LOCAL_SRC_FILES := \
93 llvm-rs-as.cpp
94
95LOCAL_CFLAGS += $(local_cflags_for_slang)
96LOCAL_STATIC_LIBRARIES := \
97 libslang \
98 $(static_libraries_needed_by_slang)
99LOCAL_SHARED_LIBRARIES := \
100 libLLVM
101
102include $(CLANG_HOST_BUILD_MK)
103include $(BUILD_HOST_EXECUTABLE)
104
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700105# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700106# ========================================================
107include $(CLEAR_VARS)
108include $(CLEAR_TBLGEN_VARS)
109
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700110LOCAL_IS_HOST_MODULE := true
111LOCAL_MODULE := llvm-rs-cc
Andrew Hsieh19bb5f52014-05-08 21:44:57 +0800112LOCAL_CLANG := true
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700113LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700114
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700115LOCAL_MODULE_CLASS := EXECUTABLES
116
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700117LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700118
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700119TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700120 AttrList.inc \
121 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -0800122 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700123 CommentNodes.inc \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700124 DeclNodes.inc \
125 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700126 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800127 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700128 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800129 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700130 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700131
132LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700133 llvm-rs-cc.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800134 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700135 slang_rs_ast_replace.cpp \
Stephen Hines11274a72012-09-26 19:14:20 -0700136 slang_rs_check_ast.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700137 slang_rs_context.cpp \
138 slang_rs_pragma_handler.cpp \
139 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800140 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700141 slang_rs_export_type.cpp \
142 slang_rs_export_element.cpp \
143 slang_rs_export_var.cpp \
144 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700145 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700146 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700147 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700148 slang_rs_reflection_cpp.cpp \
Stephen Hines552d8722013-12-18 12:21:50 -0800149 slang_rs_reflect_utils.cpp \
150 strip_unknown_attributes.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700151
152LOCAL_STATIC_LIBRARIES := \
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800153 libslang \
Ying Wang000c3072011-01-27 19:06:02 -0800154 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800155
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800156LOCAL_SHARED_LIBRARIES := \
157 libclang \
158 libLLVM
159
Raphael11e2b932011-01-13 15:13:35 -0800160ifeq ($(HOST_OS),windows)
161 LOCAL_LDLIBS := -limagehlp -lpsapi
162else
163 LOCAL_LDLIBS := -ldl -lpthread
164endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700165
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700166# For build RSCCOptions.inc from RSCCOptions.td
Ying Wangd1e54f52014-05-20 15:53:17 -0700167intermediates := $(call local-generated-sources-dir)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700168LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Tim Murray0e3f8c72014-06-04 12:24:50 -0700169$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700170 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Stephen Hinesa1f95ee2013-08-09 01:26:08 -0700171 $(call transform-host-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700172
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700173include $(CLANG_HOST_BUILD_MK)
174include $(CLANG_TBLGEN_RULES_MK)
175include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700176
177endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700178
179#=====================================================================
180# Include Subdirectories
181#=====================================================================
182include $(call all-makefiles-under,$(LOCAL_PATH))