blob: 7d1f240edd9e223d13367e3fbbb998ff85ff37ee [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
26
Stephen Hines6b201eb2011-07-20 17:08:16 -070027ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
28 RS_VERSION := $(PLATFORM_SDK_VERSION)
29else
30 # Increment by 1 whenever this is not a final release build, since we want to
31 # be able to see the RS version number change during development.
32 # See build/core/version_defaults.mk for more information about this.
33 RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))"
34endif
35local_cflags_for_slang += -DRS_VERSION=\"$(RS_VERSION)\"
36
Ying Wang000c3072011-01-27 19:06:02 -080037static_libraries_needed_by_slang := \
Zonr Chang08df36e2010-10-07 18:50:42 +080038 libLLVMLinker \
39 libLLVMipo \
40 libLLVMBitWriter \
41 libLLVMBitReader \
Zonr Chang08df36e2010-10-07 18:50:42 +080042 libLLVMARMCodeGen \
Loganbe274822011-02-16 22:02:54 +080043 libLLVMARMAsmPrinter \
Zonr Chang08df36e2010-10-07 18:50:42 +080044 libLLVMARMInfo \
Shih-wei Liao7c67e572011-07-19 05:54:53 -070045 libLLVMARMDesc \
Zonr Chang08df36e2010-10-07 18:50:42 +080046 libLLVMX86CodeGen \
Loganbe274822011-02-16 22:02:54 +080047 libLLVMX86AsmPrinter \
Zonr Chang08df36e2010-10-07 18:50:42 +080048 libLLVMX86Info \
Shih-wei Liao7c67e572011-07-19 05:54:53 -070049 libLLVMX86Desc \
Loganbe274822011-02-16 22:02:54 +080050 libLLVMX86Utils \
51 libLLVMAsmPrinter \
Zonr Chang08df36e2010-10-07 18:50:42 +080052 libLLVMSelectionDAG \
53 libLLVMCodeGen \
54 libLLVMScalarOpts \
55 libLLVMInstCombine \
56 libLLVMTransformUtils \
57 libLLVMInstrumentation \
58 libLLVMipa \
59 libLLVMAnalysis \
60 libLLVMTarget \
61 libLLVMMC \
Loganbe274822011-02-16 22:02:54 +080062 libLLVMMCParser \
Zonr Chang08df36e2010-10-07 18:50:42 +080063 libLLVMCore \
64 libclangParse \
65 libclangSema \
66 libclangAnalysis \
67 libclangAST \
68 libclangLex \
69 libclangFrontend \
70 libclangCodeGen \
71 libclangBasic \
Loganbe274822011-02-16 22:02:54 +080072 libLLVMSupport
Zonr Chang08df36e2010-10-07 18:50:42 +080073
Ying Wang000c3072011-01-27 19:06:02 -080074# Static library libslang for host
75# ========================================================
76include $(CLEAR_VARS)
77include $(CLEAR_TBLGEN_VARS)
78
79LLVM_ROOT_PATH := external/llvm
80CLANG_ROOT_PATH := external/clang
81
82include $(CLANG_ROOT_PATH)/clang.mk
83
84LOCAL_MODULE := libslang
85LOCAL_MODULE_TAGS := optional
86
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070087LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080088
89TBLGEN_TABLES := \
90 AttrList.inc \
91 Attrs.inc \
92 DeclNodes.inc \
93 DiagnosticCommonKinds.inc \
94 DiagnosticFrontendKinds.inc \
95 DiagnosticSemaKinds.inc \
96 StmtNodes.inc
97
98LOCAL_SRC_FILES := \
99 slang.cpp \
100 slang_utils.cpp \
101 slang_backend.cpp \
102 slang_pragma_recorder.cpp \
103 slang_diagnostic_buffer.cpp
104
Zonr Chang08df36e2010-10-07 18:50:42 +0800105LOCAL_LDLIBS := -ldl -lpthread
106
107include $(CLANG_HOST_BUILD_MK)
108include $(CLANG_TBLGEN_RULES_MK)
109include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -0800110include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +0800111
Zonr Changa02010c2010-10-11 20:54:28 +0800112# Host static library containing rslib.bc
113# ========================================================
114include $(CLEAR_VARS)
115
116input_data_file := frameworks/compile/slang/rslib.bc
117slangdata_output_var_name := rslib_bc
118
119LOCAL_IS_HOST_MODULE := true
120LOCAL_MODULE := librslib
121LOCAL_MODULE_TAGS := optional
122
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800123LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Shih-wei Liao99230212011-01-13 01:09:03 -0800124
Zonr Changa02010c2010-10-11 20:54:28 +0800125include $(LOCAL_PATH)/SlangData.mk
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800126include $(BUILD_HOST_STATIC_LIBRARY)
Shih-wei Liao9901f892011-01-13 00:23:47 -0800127
128# Executable slang-data for host
129# ========================================================
130include $(CLEAR_VARS)
131
132LOCAL_MODULE := slang-data
133LOCAL_MODULE_TAGS := optional
134
135LOCAL_MODULE_CLASS := EXECUTABLES
136
137LOCAL_SRC_FILES := slang-data.c
138
139include $(BUILD_HOST_EXECUTABLE)
Zonr Changa02010c2010-10-11 20:54:28 +0800140
Zonr Chang3c250c52010-10-07 12:19:23 +0800141# Executable llvm-rs-link for host
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700142# ========================================================
143include $(CLEAR_VARS)
144include $(CLEAR_TBLGEN_VARS)
145
Zonr Chang08df36e2010-10-07 18:50:42 +0800146include $(LLVM_ROOT_PATH)/llvm.mk
147
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700148LOCAL_MODULE := llvm-rs-link
Zonr Changa02010c2010-10-11 20:54:28 +0800149LOCAL_MODULE_TAGS := optional
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700150
151LOCAL_MODULE_CLASS := EXECUTABLES
152
153LOCAL_SRC_FILES := \
Zonr Chang92b344a2010-10-05 20:39:03 +0800154 llvm-rs-link.cpp
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700155
Zonr Changa02010c2010-10-11 20:54:28 +0800156LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800157 librslib libslang \
158 $(static_libraries_needed_by_slang)
Zonr Changa02010c2010-10-11 20:54:28 +0800159
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700160LOCAL_LDLIBS := -ldl -lpthread
161
162include $(LLVM_HOST_BUILD_MK)
163include $(LLVM_GEN_INTRINSICS_MK)
164include $(BUILD_HOST_EXECUTABLE)
165
Zonr Changa65ec162010-10-17 01:53:05 +0800166# Executable rs-spec-gen for host
167# ========================================================
168include $(CLEAR_VARS)
169
170LOCAL_MODULE := rs-spec-gen
171LOCAL_MODULE_TAGS := optional
172
173LOCAL_MODULE_CLASS := EXECUTABLES
174
175LOCAL_SRC_FILES := \
176 slang_rs_spec_table.cpp
177
178include $(BUILD_HOST_EXECUTABLE)
179
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700180# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700181# ========================================================
182include $(CLEAR_VARS)
183include $(CLEAR_TBLGEN_VARS)
184
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700185LOCAL_IS_HOST_MODULE := true
186LOCAL_MODULE := llvm-rs-cc
187LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700188
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700189LOCAL_MODULE_CLASS := EXECUTABLES
190
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700191LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700192
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700193TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700194 AttrList.inc \
195 Attrs.inc \
196 DeclNodes.inc \
197 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700198 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800199 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700200 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800201 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700202 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700203
Zonr Changa65ec162010-10-17 01:53:05 +0800204RS_SPEC_TABLES := \
205 RSClangBuiltinEnums.inc \
206 RSDataTypeEnums.inc \
207 RSDataElementEnums.inc \
208 RSDataKindEnums.inc \
Zonr Changb1771ef2010-10-22 18:03:46 +0800209 RSMatrixTypeEnums.inc \
Zonr Changa65ec162010-10-17 01:53:05 +0800210 RSObjectTypeEnums.inc
211
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700212LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700213 llvm-rs-cc.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800214 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700215 slang_rs_ast_replace.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700216 slang_rs_context.cpp \
217 slang_rs_pragma_handler.cpp \
218 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800219 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700220 slang_rs_export_type.cpp \
221 slang_rs_export_element.cpp \
222 slang_rs_export_var.cpp \
223 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700224 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700225 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700226 slang_rs_reflection.cpp \
Zonr Chang66a1a5a2010-10-22 11:00:11 +0800227 slang_rs_reflect_utils.cpp \
228 slang_rs_metadata_spec_encoder.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700229
230LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800231 libclangDriver libslang \
232 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800233
Raphael11e2b932011-01-13 15:13:35 -0800234ifeq ($(HOST_OS),windows)
235 LOCAL_LDLIBS := -limagehlp -lpsapi
236else
237 LOCAL_LDLIBS := -ldl -lpthread
238endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700239
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700240# For build RSCCOptions.inc from RSCCOptions.td
241intermediates := $(call local-intermediates-dir)
242LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
243$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(TBLGEN)
244 @echo "Building RenderScript compiler (llvm-rs-cc) Option tables with tblgen"
245 $(call transform-host-td-to-out,opt-parser-defs)
246
Zonr Changa65ec162010-10-17 01:53:05 +0800247include frameworks/compile/slang/RSSpec.mk
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700248include $(CLANG_HOST_BUILD_MK)
249include $(CLANG_TBLGEN_RULES_MK)
250include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700251
252endif # TARGET_BUILD_APPS