blob: 4339e5e632cec48d446a5d3f9e3463b2aefb5f36 [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 := \
Logan Chien9207a2e2011-10-21 15:39:28 +080039 libLLVMLinker \
40 libLLVMipo \
41 libLLVMBitWriter \
42 libLLVMBitWriter_2_9 \
Stephen Hines9b044ec2011-11-23 16:30:16 -080043 libLLVMBitWriter_2_9_func \
Logan Chien9207a2e2011-10-21 15:39:28 +080044 libLLVMBitReader \
45 libLLVMARMCodeGen \
46 libLLVMARMAsmPrinter \
47 libLLVMARMInfo \
48 libLLVMARMDesc \
49 libLLVMX86CodeGen \
50 libLLVMX86Info \
51 libLLVMX86Desc \
52 libLLVMX86AsmPrinter \
53 libLLVMX86Utils \
54 libLLVMAsmPrinter \
55 libLLVMSelectionDAG \
56 libLLVMCodeGen \
57 libLLVMScalarOpts \
58 libLLVMInstCombine \
59 libLLVMTransformUtils \
60 libLLVMInstrumentation \
61 libLLVMipa \
62 libLLVMAnalysis \
63 libLLVMTarget \
64 libLLVMMC \
65 libLLVMMCParser \
66 libLLVMCore \
67 libclangParse \
68 libclangSema \
69 libclangAnalysis \
70 libclangCodeGen \
71 libclangAST \
72 libclangLex \
Shih-wei Liaoe2597ac2012-03-24 02:44:33 -070073 libclangEdit \
Logan Chien9207a2e2011-10-21 15:39:28 +080074 libclangFrontend \
75 libclangBasic \
Stephen Hines0444de02012-03-02 23:19:06 -080076 libLLVMSupport \
77 libLLVMVectorize
Zonr Chang08df36e2010-10-07 18:50:42 +080078
Ying Wang000c3072011-01-27 19:06:02 -080079# Static library libslang for host
80# ========================================================
81include $(CLEAR_VARS)
82include $(CLEAR_TBLGEN_VARS)
83
84LLVM_ROOT_PATH := external/llvm
85CLANG_ROOT_PATH := external/clang
86
87include $(CLANG_ROOT_PATH)/clang.mk
88
89LOCAL_MODULE := libslang
90LOCAL_MODULE_TAGS := optional
91
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070092LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080093
94TBLGEN_TABLES := \
95 AttrList.inc \
96 Attrs.inc \
97 DeclNodes.inc \
98 DiagnosticCommonKinds.inc \
99 DiagnosticFrontendKinds.inc \
100 DiagnosticSemaKinds.inc \
101 StmtNodes.inc
102
103LOCAL_SRC_FILES := \
104 slang.cpp \
105 slang_utils.cpp \
106 slang_backend.cpp \
107 slang_pragma_recorder.cpp \
108 slang_diagnostic_buffer.cpp
109
Stephen Hines5e6d0d52011-11-22 19:42:41 -0800110LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
111
Zonr Chang08df36e2010-10-07 18:50:42 +0800112LOCAL_LDLIBS := -ldl -lpthread
113
114include $(CLANG_HOST_BUILD_MK)
115include $(CLANG_TBLGEN_RULES_MK)
116include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -0800117include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +0800118
Zonr Changa02010c2010-10-11 20:54:28 +0800119# Host static library containing rslib.bc
120# ========================================================
121include $(CLEAR_VARS)
122
123input_data_file := frameworks/compile/slang/rslib.bc
124slangdata_output_var_name := rslib_bc
125
126LOCAL_IS_HOST_MODULE := true
127LOCAL_MODULE := librslib
128LOCAL_MODULE_TAGS := optional
129
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800130LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Shih-wei Liao99230212011-01-13 01:09:03 -0800131
Zonr Changa02010c2010-10-11 20:54:28 +0800132include $(LOCAL_PATH)/SlangData.mk
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800133include $(BUILD_HOST_STATIC_LIBRARY)
Shih-wei Liao9901f892011-01-13 00:23:47 -0800134
135# Executable slang-data for host
136# ========================================================
137include $(CLEAR_VARS)
138
139LOCAL_MODULE := slang-data
140LOCAL_MODULE_TAGS := optional
141
142LOCAL_MODULE_CLASS := EXECUTABLES
143
144LOCAL_SRC_FILES := slang-data.c
145
146include $(BUILD_HOST_EXECUTABLE)
Zonr Changa02010c2010-10-11 20:54:28 +0800147
Zonr Chang3c250c52010-10-07 12:19:23 +0800148# Executable llvm-rs-link for host
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700149# ========================================================
150include $(CLEAR_VARS)
151include $(CLEAR_TBLGEN_VARS)
152
Zonr Chang08df36e2010-10-07 18:50:42 +0800153include $(LLVM_ROOT_PATH)/llvm.mk
154
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700155LOCAL_MODULE := llvm-rs-link
Zonr Changa02010c2010-10-11 20:54:28 +0800156LOCAL_MODULE_TAGS := optional
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700157
158LOCAL_MODULE_CLASS := EXECUTABLES
159
160LOCAL_SRC_FILES := \
Zonr Chang92b344a2010-10-05 20:39:03 +0800161 llvm-rs-link.cpp
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700162
Zonr Changa02010c2010-10-11 20:54:28 +0800163LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800164 librslib libslang \
165 $(static_libraries_needed_by_slang)
Zonr Changa02010c2010-10-11 20:54:28 +0800166
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700167LOCAL_LDLIBS := -ldl -lpthread
168
169include $(LLVM_HOST_BUILD_MK)
170include $(LLVM_GEN_INTRINSICS_MK)
171include $(BUILD_HOST_EXECUTABLE)
172
Zonr Changa65ec162010-10-17 01:53:05 +0800173# Executable rs-spec-gen for host
174# ========================================================
175include $(CLEAR_VARS)
176
177LOCAL_MODULE := rs-spec-gen
178LOCAL_MODULE_TAGS := optional
179
180LOCAL_MODULE_CLASS := EXECUTABLES
181
182LOCAL_SRC_FILES := \
183 slang_rs_spec_table.cpp
184
185include $(BUILD_HOST_EXECUTABLE)
186
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700187# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700188# ========================================================
189include $(CLEAR_VARS)
190include $(CLEAR_TBLGEN_VARS)
191
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700192LOCAL_IS_HOST_MODULE := true
193LOCAL_MODULE := llvm-rs-cc
194LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700195
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700196LOCAL_MODULE_CLASS := EXECUTABLES
197
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700198LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700199
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700200TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700201 AttrList.inc \
202 Attrs.inc \
203 DeclNodes.inc \
204 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700205 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800206 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700207 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800208 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700209 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700210
Zonr Changa65ec162010-10-17 01:53:05 +0800211RS_SPEC_TABLES := \
212 RSClangBuiltinEnums.inc \
213 RSDataTypeEnums.inc \
214 RSDataElementEnums.inc \
Zonr Changb1771ef2010-10-22 18:03:46 +0800215 RSMatrixTypeEnums.inc \
Zonr Changa65ec162010-10-17 01:53:05 +0800216 RSObjectTypeEnums.inc
217
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700218LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700219 llvm-rs-cc.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800220 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700221 slang_rs_ast_replace.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700222 slang_rs_context.cpp \
223 slang_rs_pragma_handler.cpp \
224 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800225 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700226 slang_rs_export_type.cpp \
227 slang_rs_export_element.cpp \
228 slang_rs_export_var.cpp \
229 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700230 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700231 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700232 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700233 slang_rs_reflection_base.cpp \
234 slang_rs_reflection_cpp.cpp \
235 slang_rs_reflect_utils.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700236
237LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800238 libclangDriver libslang \
239 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800240
Raphael11e2b932011-01-13 15:13:35 -0800241ifeq ($(HOST_OS),windows)
242 LOCAL_LDLIBS := -limagehlp -lpsapi
243else
244 LOCAL_LDLIBS := -ldl -lpthread
245endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700246
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700247# For build RSCCOptions.inc from RSCCOptions.td
248intermediates := $(call local-intermediates-dir)
249LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Logan Chienf612c7a2011-10-28 08:54:54 +0800250$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700251 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Logan Chien9207a2e2011-10-21 15:39:28 +0800252 $(call transform-host-clang-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700253
Zonr Changa65ec162010-10-17 01:53:05 +0800254include frameworks/compile/slang/RSSpec.mk
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700255include $(CLANG_HOST_BUILD_MK)
256include $(CLANG_TBLGEN_RULES_MK)
257include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700258
259endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700260
261#=====================================================================
262# Include Subdirectories
263#=====================================================================
264include $(call all-makefiles-under,$(LOCAL_PATH))