blob: 748665a195ef551abfab1d63379d698a24055f3f [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
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070022local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
23ifneq ($(TARGET_BUILD_VARIANT),eng)
24local_cflags_for_slang += -D__DISABLE_ASSERTS
25endif
Stephen Hinesba7c6dc2011-09-07 19:57:04 -070026local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070027
Stephen Hines6b201eb2011-07-20 17:08:16 -070028ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
29 RS_VERSION := $(PLATFORM_SDK_VERSION)
30else
31 # Increment by 1 whenever this is not a final release build, since we want to
32 # be able to see the RS version number change during development.
33 # See build/core/version_defaults.mk for more information about this.
34 RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))"
35endif
Stephen Hines2e35b132011-07-22 02:50:19 -070036local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION)
Stephen Hines6b201eb2011-07-20 17:08:16 -070037
Ying Wang000c3072011-01-27 19:06:02 -080038static_libraries_needed_by_slang := \
Stephen Hines376dc032012-08-23 00:22:25 -070039 libclangParse \
40 libclangSema \
41 libclangAnalysis \
42 libclangCodeGen \
43 libclangAST \
44 libclangLex \
45 libclangEdit \
46 libclangFrontend \
47 libclangBasic \
48 libclangSerialization \
Logan Chien9207a2e2011-10-21 15:39:28 +080049 libLLVMLinker \
50 libLLVMipo \
51 libLLVMBitWriter \
52 libLLVMBitWriter_2_9 \
Stephen Hines9b044ec2011-11-23 16:30:16 -080053 libLLVMBitWriter_2_9_func \
Logan Chien9207a2e2011-10-21 15:39:28 +080054 libLLVMBitReader \
55 libLLVMARMCodeGen \
Stephen Hines376dc032012-08-23 00:22:25 -070056 libLLVMARMAsmParser \
Logan Chien9207a2e2011-10-21 15:39:28 +080057 libLLVMARMAsmPrinter \
58 libLLVMARMInfo \
59 libLLVMARMDesc \
60 libLLVMX86CodeGen \
61 libLLVMX86Info \
62 libLLVMX86Desc \
Stephen Hines376dc032012-08-23 00:22:25 -070063 libLLVMX86AsmParser \
Logan Chien9207a2e2011-10-21 15:39:28 +080064 libLLVMX86AsmPrinter \
65 libLLVMX86Utils \
Stephen Hines376dc032012-08-23 00:22:25 -070066 libLLVMMipsCodeGen \
67 libLLVMMipsInfo \
68 libLLVMMipsDesc \
69 libLLVMMipsAsmParser \
70 libLLVMMipsAsmPrinter \
Logan Chien9207a2e2011-10-21 15:39:28 +080071 libLLVMAsmPrinter \
72 libLLVMSelectionDAG \
73 libLLVMCodeGen \
74 libLLVMScalarOpts \
75 libLLVMInstCombine \
Logan Chien9207a2e2011-10-21 15:39:28 +080076 libLLVMInstrumentation \
Shih-wei Liao43730fe2012-08-02 23:06:18 -070077 libLLVMTransformUtils \
Logan Chien9207a2e2011-10-21 15:39:28 +080078 libLLVMipa \
79 libLLVMAnalysis \
80 libLLVMTarget \
81 libLLVMMC \
82 libLLVMMCParser \
83 libLLVMCore \
Stephen Hines376dc032012-08-23 00:22:25 -070084 libLLVMArchive \
85 libLLVMAsmParser \
Stephen Hines0444de02012-03-02 23:19:06 -080086 libLLVMSupport \
87 libLLVMVectorize
Zonr Chang08df36e2010-10-07 18:50:42 +080088
Ying Wang000c3072011-01-27 19:06:02 -080089# Static library libslang for host
90# ========================================================
91include $(CLEAR_VARS)
92include $(CLEAR_TBLGEN_VARS)
93
94LLVM_ROOT_PATH := external/llvm
95CLANG_ROOT_PATH := external/clang
96
97include $(CLANG_ROOT_PATH)/clang.mk
98
99LOCAL_MODULE := libslang
100LOCAL_MODULE_TAGS := optional
101
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700102LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -0800103
104TBLGEN_TABLES := \
105 AttrList.inc \
106 Attrs.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700107 CommentNodes.inc \
Ying Wang000c3072011-01-27 19:06:02 -0800108 DeclNodes.inc \
109 DiagnosticCommonKinds.inc \
110 DiagnosticFrontendKinds.inc \
111 DiagnosticSemaKinds.inc \
112 StmtNodes.inc
113
114LOCAL_SRC_FILES := \
115 slang.cpp \
116 slang_utils.cpp \
117 slang_backend.cpp \
118 slang_pragma_recorder.cpp \
119 slang_diagnostic_buffer.cpp
120
Stephen Hines5e6d0d52011-11-22 19:42:41 -0800121LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
122
Zonr Chang08df36e2010-10-07 18:50:42 +0800123LOCAL_LDLIBS := -ldl -lpthread
124
125include $(CLANG_HOST_BUILD_MK)
126include $(CLANG_TBLGEN_RULES_MK)
127include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -0800128include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +0800129
Zonr Changa02010c2010-10-11 20:54:28 +0800130# Host static library containing rslib.bc
131# ========================================================
132include $(CLEAR_VARS)
133
134input_data_file := frameworks/compile/slang/rslib.bc
135slangdata_output_var_name := rslib_bc
136
137LOCAL_IS_HOST_MODULE := true
138LOCAL_MODULE := librslib
139LOCAL_MODULE_TAGS := optional
140
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800141LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Shih-wei Liao99230212011-01-13 01:09:03 -0800142
Zonr Changa02010c2010-10-11 20:54:28 +0800143include $(LOCAL_PATH)/SlangData.mk
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800144include $(BUILD_HOST_STATIC_LIBRARY)
Shih-wei Liao9901f892011-01-13 00:23:47 -0800145
146# Executable slang-data for host
147# ========================================================
148include $(CLEAR_VARS)
149
150LOCAL_MODULE := slang-data
151LOCAL_MODULE_TAGS := optional
152
153LOCAL_MODULE_CLASS := EXECUTABLES
154
155LOCAL_SRC_FILES := slang-data.c
156
157include $(BUILD_HOST_EXECUTABLE)
Zonr Changa02010c2010-10-11 20:54:28 +0800158
Zonr Chang3c250c52010-10-07 12:19:23 +0800159# Executable llvm-rs-link for host
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700160# ========================================================
161include $(CLEAR_VARS)
162include $(CLEAR_TBLGEN_VARS)
163
Zonr Chang08df36e2010-10-07 18:50:42 +0800164include $(LLVM_ROOT_PATH)/llvm.mk
165
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700166LOCAL_MODULE := llvm-rs-link
Zonr Changa02010c2010-10-11 20:54:28 +0800167LOCAL_MODULE_TAGS := optional
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700168
169LOCAL_MODULE_CLASS := EXECUTABLES
170
171LOCAL_SRC_FILES := \
Zonr Chang92b344a2010-10-05 20:39:03 +0800172 llvm-rs-link.cpp
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700173
Zonr Changa02010c2010-10-11 20:54:28 +0800174LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800175 librslib libslang \
176 $(static_libraries_needed_by_slang)
Zonr Changa02010c2010-10-11 20:54:28 +0800177
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700178LOCAL_LDLIBS := -ldl -lpthread
179
180include $(LLVM_HOST_BUILD_MK)
181include $(LLVM_GEN_INTRINSICS_MK)
182include $(BUILD_HOST_EXECUTABLE)
183
Zonr Changa65ec162010-10-17 01:53:05 +0800184# Executable rs-spec-gen for host
185# ========================================================
186include $(CLEAR_VARS)
187
188LOCAL_MODULE := rs-spec-gen
189LOCAL_MODULE_TAGS := optional
190
191LOCAL_MODULE_CLASS := EXECUTABLES
192
193LOCAL_SRC_FILES := \
194 slang_rs_spec_table.cpp
195
196include $(BUILD_HOST_EXECUTABLE)
197
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700198# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700199# ========================================================
200include $(CLEAR_VARS)
201include $(CLEAR_TBLGEN_VARS)
202
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700203LOCAL_IS_HOST_MODULE := true
204LOCAL_MODULE := llvm-rs-cc
205LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700206
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700207LOCAL_MODULE_CLASS := EXECUTABLES
208
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700209LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700210
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700211TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700212 AttrList.inc \
213 Attrs.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700214 CommentNodes.inc \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700215 DeclNodes.inc \
216 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700217 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800218 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700219 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800220 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700221 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700222
Zonr Changa65ec162010-10-17 01:53:05 +0800223RS_SPEC_TABLES := \
224 RSClangBuiltinEnums.inc \
225 RSDataTypeEnums.inc \
226 RSDataElementEnums.inc \
Zonr Changb1771ef2010-10-22 18:03:46 +0800227 RSMatrixTypeEnums.inc \
Zonr Changa65ec162010-10-17 01:53:05 +0800228 RSObjectTypeEnums.inc
229
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700230LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700231 llvm-rs-cc.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800232 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700233 slang_rs_ast_replace.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700234 slang_rs_context.cpp \
235 slang_rs_pragma_handler.cpp \
236 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800237 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700238 slang_rs_export_type.cpp \
239 slang_rs_export_element.cpp \
240 slang_rs_export_var.cpp \
241 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700242 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700243 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700244 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700245 slang_rs_reflection_base.cpp \
246 slang_rs_reflection_cpp.cpp \
247 slang_rs_reflect_utils.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700248
249LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800250 libclangDriver libslang \
251 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800252
Raphael11e2b932011-01-13 15:13:35 -0800253ifeq ($(HOST_OS),windows)
254 LOCAL_LDLIBS := -limagehlp -lpsapi
255else
256 LOCAL_LDLIBS := -ldl -lpthread
257endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700258
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700259# For build RSCCOptions.inc from RSCCOptions.td
260intermediates := $(call local-intermediates-dir)
261LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Logan Chienf612c7a2011-10-28 08:54:54 +0800262$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700263 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Logan Chien9207a2e2011-10-21 15:39:28 +0800264 $(call transform-host-clang-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700265
Zonr Changa65ec162010-10-17 01:53:05 +0800266include frameworks/compile/slang/RSSpec.mk
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700267include $(CLANG_HOST_BUILD_MK)
268include $(CLANG_TBLGEN_RULES_MK)
269include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700270
271endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700272
273#=====================================================================
274# Include Subdirectories
275#=====================================================================
276include $(call all-makefiles-under,$(LOCAL_PATH))