blob: a783ba9c0622ac82189cb2bfbebfe0733c62445e [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 \
43 libLLVMBitReader \
44 libLLVMARMCodeGen \
45 libLLVMARMAsmPrinter \
46 libLLVMARMInfo \
47 libLLVMARMDesc \
48 libLLVMX86CodeGen \
49 libLLVMX86Info \
50 libLLVMX86Desc \
51 libLLVMX86AsmPrinter \
52 libLLVMX86Utils \
53 libLLVMAsmPrinter \
54 libLLVMSelectionDAG \
55 libLLVMCodeGen \
56 libLLVMScalarOpts \
57 libLLVMInstCombine \
58 libLLVMTransformUtils \
59 libLLVMInstrumentation \
60 libLLVMipa \
61 libLLVMAnalysis \
62 libLLVMTarget \
63 libLLVMMC \
64 libLLVMMCParser \
65 libLLVMCore \
66 libclangParse \
67 libclangSema \
68 libclangAnalysis \
69 libclangCodeGen \
70 libclangAST \
71 libclangLex \
72 libclangFrontend \
73 libclangBasic \
Loganbe274822011-02-16 22:02:54 +080074 libLLVMSupport
Zonr Chang08df36e2010-10-07 18:50:42 +080075
Ying Wang000c3072011-01-27 19:06:02 -080076# Static library libslang for host
77# ========================================================
78include $(CLEAR_VARS)
79include $(CLEAR_TBLGEN_VARS)
80
81LLVM_ROOT_PATH := external/llvm
82CLANG_ROOT_PATH := external/clang
83
84include $(CLANG_ROOT_PATH)/clang.mk
85
86LOCAL_MODULE := libslang
87LOCAL_MODULE_TAGS := optional
88
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070089LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080090
91TBLGEN_TABLES := \
92 AttrList.inc \
93 Attrs.inc \
94 DeclNodes.inc \
95 DiagnosticCommonKinds.inc \
96 DiagnosticFrontendKinds.inc \
97 DiagnosticSemaKinds.inc \
98 StmtNodes.inc
99
100LOCAL_SRC_FILES := \
101 slang.cpp \
102 slang_utils.cpp \
103 slang_backend.cpp \
104 slang_pragma_recorder.cpp \
105 slang_diagnostic_buffer.cpp
106
Stephen Hines5e6d0d52011-11-22 19:42:41 -0800107LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
108
Zonr Chang08df36e2010-10-07 18:50:42 +0800109LOCAL_LDLIBS := -ldl -lpthread
110
111include $(CLANG_HOST_BUILD_MK)
112include $(CLANG_TBLGEN_RULES_MK)
113include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -0800114include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +0800115
Zonr Changa02010c2010-10-11 20:54:28 +0800116# Host static library containing rslib.bc
117# ========================================================
118include $(CLEAR_VARS)
119
120input_data_file := frameworks/compile/slang/rslib.bc
121slangdata_output_var_name := rslib_bc
122
123LOCAL_IS_HOST_MODULE := true
124LOCAL_MODULE := librslib
125LOCAL_MODULE_TAGS := optional
126
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800127LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Shih-wei Liao99230212011-01-13 01:09:03 -0800128
Zonr Changa02010c2010-10-11 20:54:28 +0800129include $(LOCAL_PATH)/SlangData.mk
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800130include $(BUILD_HOST_STATIC_LIBRARY)
Shih-wei Liao9901f892011-01-13 00:23:47 -0800131
132# Executable slang-data for host
133# ========================================================
134include $(CLEAR_VARS)
135
136LOCAL_MODULE := slang-data
137LOCAL_MODULE_TAGS := optional
138
139LOCAL_MODULE_CLASS := EXECUTABLES
140
141LOCAL_SRC_FILES := slang-data.c
142
143include $(BUILD_HOST_EXECUTABLE)
Zonr Changa02010c2010-10-11 20:54:28 +0800144
Zonr Chang3c250c52010-10-07 12:19:23 +0800145# Executable llvm-rs-link for host
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700146# ========================================================
147include $(CLEAR_VARS)
148include $(CLEAR_TBLGEN_VARS)
149
Zonr Chang08df36e2010-10-07 18:50:42 +0800150include $(LLVM_ROOT_PATH)/llvm.mk
151
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700152LOCAL_MODULE := llvm-rs-link
Zonr Changa02010c2010-10-11 20:54:28 +0800153LOCAL_MODULE_TAGS := optional
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700154
155LOCAL_MODULE_CLASS := EXECUTABLES
156
157LOCAL_SRC_FILES := \
Zonr Chang92b344a2010-10-05 20:39:03 +0800158 llvm-rs-link.cpp
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700159
Zonr Changa02010c2010-10-11 20:54:28 +0800160LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800161 librslib libslang \
162 $(static_libraries_needed_by_slang)
Zonr Changa02010c2010-10-11 20:54:28 +0800163
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700164LOCAL_LDLIBS := -ldl -lpthread
165
166include $(LLVM_HOST_BUILD_MK)
167include $(LLVM_GEN_INTRINSICS_MK)
168include $(BUILD_HOST_EXECUTABLE)
169
Zonr Changa65ec162010-10-17 01:53:05 +0800170# Executable rs-spec-gen for host
171# ========================================================
172include $(CLEAR_VARS)
173
174LOCAL_MODULE := rs-spec-gen
175LOCAL_MODULE_TAGS := optional
176
177LOCAL_MODULE_CLASS := EXECUTABLES
178
179LOCAL_SRC_FILES := \
180 slang_rs_spec_table.cpp
181
182include $(BUILD_HOST_EXECUTABLE)
183
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700184# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700185# ========================================================
186include $(CLEAR_VARS)
187include $(CLEAR_TBLGEN_VARS)
188
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700189LOCAL_IS_HOST_MODULE := true
190LOCAL_MODULE := llvm-rs-cc
191LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700192
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700193LOCAL_MODULE_CLASS := EXECUTABLES
194
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700195LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700196
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700197TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700198 AttrList.inc \
199 Attrs.inc \
200 DeclNodes.inc \
201 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700202 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800203 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700204 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800205 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700206 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700207
Zonr Changa65ec162010-10-17 01:53:05 +0800208RS_SPEC_TABLES := \
209 RSClangBuiltinEnums.inc \
210 RSDataTypeEnums.inc \
211 RSDataElementEnums.inc \
212 RSDataKindEnums.inc \
Zonr Changb1771ef2010-10-22 18:03:46 +0800213 RSMatrixTypeEnums.inc \
Zonr Changa65ec162010-10-17 01:53:05 +0800214 RSObjectTypeEnums.inc
215
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700216LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700217 llvm-rs-cc.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800218 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700219 slang_rs_ast_replace.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700220 slang_rs_context.cpp \
221 slang_rs_pragma_handler.cpp \
222 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800223 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700224 slang_rs_export_type.cpp \
225 slang_rs_export_element.cpp \
226 slang_rs_export_var.cpp \
227 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700228 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700229 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700230 slang_rs_reflection.cpp \
Zonr Chang66a1a5a2010-10-22 11:00:11 +0800231 slang_rs_reflect_utils.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700232
233LOCAL_STATIC_LIBRARIES := \
Ying Wang000c3072011-01-27 19:06:02 -0800234 libclangDriver libslang \
235 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800236
Raphael11e2b932011-01-13 15:13:35 -0800237ifeq ($(HOST_OS),windows)
238 LOCAL_LDLIBS := -limagehlp -lpsapi
239else
240 LOCAL_LDLIBS := -ldl -lpthread
241endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700242
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700243# For build RSCCOptions.inc from RSCCOptions.td
244intermediates := $(call local-intermediates-dir)
245LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Logan Chienf612c7a2011-10-28 08:54:54 +0800246$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700247 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Logan Chien9207a2e2011-10-21 15:39:28 +0800248 $(call transform-host-clang-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700249
Zonr Changa65ec162010-10-17 01:53:05 +0800250include frameworks/compile/slang/RSSpec.mk
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700251include $(CLANG_HOST_BUILD_MK)
252include $(CLANG_TBLGEN_RULES_MK)
253include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700254
255endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700256
257#=====================================================================
258# Include Subdirectories
259#=====================================================================
260include $(call all-makefiles-under,$(LOCAL_PATH))