blob: dd9109a2be61fe77901c5015066647101da3b9ad [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
Tim Murray881abe92012-09-28 14:14:24 -070023ifeq ($(TARGET_BUILD_VARIANT),eng)
24local_cflags_for_slang += -O0
25else
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070026local_cflags_for_slang += -D__DISABLE_ASSERTS
27endif
Stephen Hinesba7c6dc2011-09-07 19:57:04 -070028local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070029
Stephen Hines92219352012-12-12 16:54:43 -080030ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
31 RS_VERSION := $(PLATFORM_SDK_VERSION)
32else
33 # Increment by 1 whenever this is not a final release build, since we want to
34 # be able to see the RS version number change during development.
35 # See build/core/version_defaults.mk for more information about this.
36 RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))"
37endif
Stephen Hines2e35b132011-07-22 02:50:19 -070038local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION)
Stephen Hines6b201eb2011-07-20 17:08:16 -070039
Ying Wang000c3072011-01-27 19:06:02 -080040static_libraries_needed_by_slang := \
Stephen Hines376dc032012-08-23 00:22:25 -070041 libclangParse \
42 libclangSema \
43 libclangAnalysis \
44 libclangCodeGen \
45 libclangAST \
46 libclangLex \
47 libclangEdit \
48 libclangFrontend \
49 libclangBasic \
50 libclangSerialization \
Logan Chien9207a2e2011-10-21 15:39:28 +080051 libLLVMLinker \
52 libLLVMipo \
53 libLLVMBitWriter \
54 libLLVMBitWriter_2_9 \
Stephen Hines9b044ec2011-11-23 16:30:16 -080055 libLLVMBitWriter_2_9_func \
Logan Chien9207a2e2011-10-21 15:39:28 +080056 libLLVMBitReader \
57 libLLVMARMCodeGen \
Stephen Hines376dc032012-08-23 00:22:25 -070058 libLLVMARMAsmParser \
Logan Chien9207a2e2011-10-21 15:39:28 +080059 libLLVMARMAsmPrinter \
60 libLLVMARMInfo \
61 libLLVMARMDesc \
62 libLLVMX86CodeGen \
63 libLLVMX86Info \
64 libLLVMX86Desc \
Stephen Hines376dc032012-08-23 00:22:25 -070065 libLLVMX86AsmParser \
Logan Chien9207a2e2011-10-21 15:39:28 +080066 libLLVMX86AsmPrinter \
67 libLLVMX86Utils \
Stephen Hines376dc032012-08-23 00:22:25 -070068 libLLVMMipsCodeGen \
69 libLLVMMipsInfo \
70 libLLVMMipsDesc \
71 libLLVMMipsAsmParser \
72 libLLVMMipsAsmPrinter \
Logan Chien9207a2e2011-10-21 15:39:28 +080073 libLLVMAsmPrinter \
74 libLLVMSelectionDAG \
75 libLLVMCodeGen \
76 libLLVMScalarOpts \
77 libLLVMInstCombine \
Logan Chien9207a2e2011-10-21 15:39:28 +080078 libLLVMInstrumentation \
Shih-wei Liao43730fe2012-08-02 23:06:18 -070079 libLLVMTransformUtils \
Logan Chien9207a2e2011-10-21 15:39:28 +080080 libLLVMipa \
81 libLLVMAnalysis \
82 libLLVMTarget \
83 libLLVMMC \
84 libLLVMMCParser \
85 libLLVMCore \
Stephen Hines376dc032012-08-23 00:22:25 -070086 libLLVMArchive \
87 libLLVMAsmParser \
Stephen Hines0444de02012-03-02 23:19:06 -080088 libLLVMSupport \
89 libLLVMVectorize
Zonr Chang08df36e2010-10-07 18:50:42 +080090
Ying Wang000c3072011-01-27 19:06:02 -080091# Static library libslang for host
92# ========================================================
93include $(CLEAR_VARS)
94include $(CLEAR_TBLGEN_VARS)
95
96LLVM_ROOT_PATH := external/llvm
97CLANG_ROOT_PATH := external/clang
98
99include $(CLANG_ROOT_PATH)/clang.mk
100
101LOCAL_MODULE := libslang
102LOCAL_MODULE_TAGS := optional
103
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700104LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -0800105
106TBLGEN_TABLES := \
107 AttrList.inc \
108 Attrs.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700109 CommentNodes.inc \
Ying Wang000c3072011-01-27 19:06:02 -0800110 DeclNodes.inc \
111 DiagnosticCommonKinds.inc \
112 DiagnosticFrontendKinds.inc \
113 DiagnosticSemaKinds.inc \
114 StmtNodes.inc
115
116LOCAL_SRC_FILES := \
117 slang.cpp \
118 slang_utils.cpp \
119 slang_backend.cpp \
120 slang_pragma_recorder.cpp \
121 slang_diagnostic_buffer.cpp
122
Stephen Hines5e6d0d52011-11-22 19:42:41 -0800123LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
124
Zonr Chang08df36e2010-10-07 18:50:42 +0800125LOCAL_LDLIBS := -ldl -lpthread
126
127include $(CLANG_HOST_BUILD_MK)
128include $(CLANG_TBLGEN_RULES_MK)
129include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -0800130include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +0800131
Zonr Changa02010c2010-10-11 20:54:28 +0800132# Host static library containing rslib.bc
133# ========================================================
134include $(CLEAR_VARS)
135
136input_data_file := frameworks/compile/slang/rslib.bc
137slangdata_output_var_name := rslib_bc
138
139LOCAL_IS_HOST_MODULE := true
140LOCAL_MODULE := librslib
141LOCAL_MODULE_TAGS := optional
142
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800143LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Shih-wei Liao99230212011-01-13 01:09:03 -0800144
Zonr Changa02010c2010-10-11 20:54:28 +0800145include $(LOCAL_PATH)/SlangData.mk
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800146include $(BUILD_HOST_STATIC_LIBRARY)
Shih-wei Liao9901f892011-01-13 00:23:47 -0800147
148# Executable slang-data for host
149# ========================================================
150include $(CLEAR_VARS)
151
152LOCAL_MODULE := slang-data
153LOCAL_MODULE_TAGS := optional
154
155LOCAL_MODULE_CLASS := EXECUTABLES
156
157LOCAL_SRC_FILES := slang-data.c
158
159include $(BUILD_HOST_EXECUTABLE)
Zonr Changa02010c2010-10-11 20:54:28 +0800160
Zonr Chang3c250c52010-10-07 12:19:23 +0800161# Executable llvm-rs-link for host
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700162# ========================================================
163include $(CLEAR_VARS)
164include $(CLEAR_TBLGEN_VARS)
165
Zonr Chang08df36e2010-10-07 18:50:42 +0800166include $(LLVM_ROOT_PATH)/llvm.mk
167
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700168LOCAL_MODULE := llvm-rs-link
Zonr Changa02010c2010-10-11 20:54:28 +0800169LOCAL_MODULE_TAGS := optional
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700170
171LOCAL_MODULE_CLASS := EXECUTABLES
172
173LOCAL_SRC_FILES := \
Zonr Chang92b344a2010-10-05 20:39:03 +0800174 llvm-rs-link.cpp
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700175
Zonr Changa02010c2010-10-11 20:54:28 +0800176LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800177 librslib libslang \
178 $(static_libraries_needed_by_slang)
Zonr Changa02010c2010-10-11 20:54:28 +0800179
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700180LOCAL_LDLIBS := -ldl -lpthread
181
182include $(LLVM_HOST_BUILD_MK)
183include $(LLVM_GEN_INTRINSICS_MK)
184include $(BUILD_HOST_EXECUTABLE)
185
Zonr Changa65ec162010-10-17 01:53:05 +0800186# Executable rs-spec-gen for host
187# ========================================================
188include $(CLEAR_VARS)
189
190LOCAL_MODULE := rs-spec-gen
191LOCAL_MODULE_TAGS := optional
192
193LOCAL_MODULE_CLASS := EXECUTABLES
194
195LOCAL_SRC_FILES := \
196 slang_rs_spec_table.cpp
197
198include $(BUILD_HOST_EXECUTABLE)
199
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700200# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700201# ========================================================
202include $(CLEAR_VARS)
203include $(CLEAR_TBLGEN_VARS)
204
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700205LOCAL_IS_HOST_MODULE := true
206LOCAL_MODULE := llvm-rs-cc
207LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700208
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700209LOCAL_MODULE_CLASS := EXECUTABLES
210
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700211LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700212
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700213TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700214 AttrList.inc \
215 Attrs.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700216 CommentNodes.inc \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700217 DeclNodes.inc \
218 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700219 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800220 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700221 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800222 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700223 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700224
Zonr Changa65ec162010-10-17 01:53:05 +0800225RS_SPEC_TABLES := \
226 RSClangBuiltinEnums.inc \
227 RSDataTypeEnums.inc \
228 RSDataElementEnums.inc \
Zonr Changb1771ef2010-10-22 18:03:46 +0800229 RSMatrixTypeEnums.inc \
Zonr Changa65ec162010-10-17 01:53:05 +0800230 RSObjectTypeEnums.inc
231
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700232LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700233 llvm-rs-cc.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800234 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700235 slang_rs_ast_replace.cpp \
Stephen Hines11274a72012-09-26 19:14:20 -0700236 slang_rs_check_ast.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700237 slang_rs_context.cpp \
238 slang_rs_pragma_handler.cpp \
239 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800240 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700241 slang_rs_export_type.cpp \
242 slang_rs_export_element.cpp \
243 slang_rs_export_var.cpp \
244 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700245 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700246 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700247 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700248 slang_rs_reflection_base.cpp \
249 slang_rs_reflection_cpp.cpp \
250 slang_rs_reflect_utils.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700251
252LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800253 libclangDriver libslang \
254 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800255
Raphael11e2b932011-01-13 15:13:35 -0800256ifeq ($(HOST_OS),windows)
257 LOCAL_LDLIBS := -limagehlp -lpsapi
258else
259 LOCAL_LDLIBS := -ldl -lpthread
260endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700261
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700262# For build RSCCOptions.inc from RSCCOptions.td
263intermediates := $(call local-intermediates-dir)
264LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Logan Chienf612c7a2011-10-28 08:54:54 +0800265$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700266 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Logan Chien9207a2e2011-10-21 15:39:28 +0800267 $(call transform-host-clang-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700268
Zonr Changa65ec162010-10-17 01:53:05 +0800269include frameworks/compile/slang/RSSpec.mk
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700270include $(CLANG_HOST_BUILD_MK)
271include $(CLANG_TBLGEN_RULES_MK)
272include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700273
274endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700275
276#=====================================================================
277# Include Subdirectories
278#=====================================================================
279include $(call all-makefiles-under,$(LOCAL_PATH))