blob: 6574d184a7c89cbfea15552e9cf987538036a591 [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 := \
Logan Chien9207a2e2011-10-21 15:39:28 +080041 libLLVMBitWriter_2_9 \
Stephen Hines9b044ec2011-11-23 16:30:16 -080042 libLLVMBitWriter_2_9_func \
Stephen Hinesbfe3e972013-02-27 13:52:15 -080043 libLLVMBitWriter_3_2
Zonr Chang08df36e2010-10-07 18:50:42 +080044
Ying Wang000c3072011-01-27 19:06:02 -080045# Static library libslang for host
46# ========================================================
47include $(CLEAR_VARS)
48include $(CLEAR_TBLGEN_VARS)
49
50LLVM_ROOT_PATH := external/llvm
51CLANG_ROOT_PATH := external/clang
52
53include $(CLANG_ROOT_PATH)/clang.mk
54
55LOCAL_MODULE := libslang
56LOCAL_MODULE_TAGS := optional
57
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070058LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080059
60TBLGEN_TABLES := \
61 AttrList.inc \
62 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -080063 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -070064 CommentNodes.inc \
Ying Wang000c3072011-01-27 19:06:02 -080065 DeclNodes.inc \
66 DiagnosticCommonKinds.inc \
67 DiagnosticFrontendKinds.inc \
68 DiagnosticSemaKinds.inc \
69 StmtNodes.inc
70
71LOCAL_SRC_FILES := \
72 slang.cpp \
73 slang_utils.cpp \
74 slang_backend.cpp \
75 slang_pragma_recorder.cpp \
76 slang_diagnostic_buffer.cpp
77
Stephen Hines5e6d0d52011-11-22 19:42:41 -080078LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
79
Zonr Chang08df36e2010-10-07 18:50:42 +080080LOCAL_LDLIBS := -ldl -lpthread
81
82include $(CLANG_HOST_BUILD_MK)
83include $(CLANG_TBLGEN_RULES_MK)
84include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -080085include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +080086
Zonr Changa02010c2010-10-11 20:54:28 +080087# Host static library containing rslib.bc
88# ========================================================
89include $(CLEAR_VARS)
90
91input_data_file := frameworks/compile/slang/rslib.bc
92slangdata_output_var_name := rslib_bc
93
94LOCAL_IS_HOST_MODULE := true
95LOCAL_MODULE := librslib
96LOCAL_MODULE_TAGS := optional
97
Shih-wei Liao5dee9562011-01-13 02:16:00 -080098LOCAL_MODULE_CLASS := STATIC_LIBRARIES
Shih-wei Liao99230212011-01-13 01:09:03 -080099
Zonr Changa02010c2010-10-11 20:54:28 +0800100include $(LOCAL_PATH)/SlangData.mk
Shih-wei Liao5dee9562011-01-13 02:16:00 -0800101include $(BUILD_HOST_STATIC_LIBRARY)
Shih-wei Liao9901f892011-01-13 00:23:47 -0800102
103# Executable slang-data for host
104# ========================================================
105include $(CLEAR_VARS)
106
107LOCAL_MODULE := slang-data
108LOCAL_MODULE_TAGS := optional
109
110LOCAL_MODULE_CLASS := EXECUTABLES
111
112LOCAL_SRC_FILES := slang-data.c
113
114include $(BUILD_HOST_EXECUTABLE)
Zonr Changa02010c2010-10-11 20:54:28 +0800115
Zonr Changa65ec162010-10-17 01:53:05 +0800116# Executable rs-spec-gen for host
117# ========================================================
118include $(CLEAR_VARS)
119
120LOCAL_MODULE := rs-spec-gen
121LOCAL_MODULE_TAGS := optional
122
123LOCAL_MODULE_CLASS := EXECUTABLES
124
125LOCAL_SRC_FILES := \
126 slang_rs_spec_table.cpp
127
128include $(BUILD_HOST_EXECUTABLE)
129
Tobias Grosserc908b902013-06-21 11:28:49 -0700130# ========================================================
131include $(CLEAR_VARS)
132
133LOCAL_MODULE := llvm-rs-as
134LOCAL_MODULE_TAGS := optional
135
136LOCAL_MODULE_CLASS := EXECUTABLES
137
138LOCAL_SRC_FILES := \
139 llvm-rs-as.cpp
140
141LOCAL_CFLAGS += $(local_cflags_for_slang)
142LOCAL_STATIC_LIBRARIES := \
143 libslang \
144 $(static_libraries_needed_by_slang)
145LOCAL_SHARED_LIBRARIES := \
146 libLLVM
147
148include $(CLANG_HOST_BUILD_MK)
149include $(BUILD_HOST_EXECUTABLE)
150
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700151# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700152# ========================================================
153include $(CLEAR_VARS)
154include $(CLEAR_TBLGEN_VARS)
155
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700156LOCAL_IS_HOST_MODULE := true
157LOCAL_MODULE := llvm-rs-cc
158LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700159
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700160LOCAL_MODULE_CLASS := EXECUTABLES
161
Alex Sakhartchouk9be93602011-03-17 17:03:36 -0700162LOCAL_CFLAGS += $(local_cflags_for_slang)
Shih-wei Liaocecd11d2010-09-21 08:07:58 -0700163
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700164TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700165 AttrList.inc \
166 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -0800167 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700168 CommentNodes.inc \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700169 DeclNodes.inc \
170 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700171 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800172 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700173 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800174 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700175 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700176
Zonr Changa65ec162010-10-17 01:53:05 +0800177RS_SPEC_TABLES := \
178 RSClangBuiltinEnums.inc \
179 RSDataTypeEnums.inc \
180 RSDataElementEnums.inc \
Zonr Changb1771ef2010-10-22 18:03:46 +0800181 RSMatrixTypeEnums.inc \
Zonr Changa65ec162010-10-17 01:53:05 +0800182 RSObjectTypeEnums.inc
183
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700184LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700185 llvm-rs-cc.cpp \
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800186 slang_rs.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700187 slang_rs_ast_replace.cpp \
Stephen Hines11274a72012-09-26 19:14:20 -0700188 slang_rs_check_ast.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700189 slang_rs_context.cpp \
190 slang_rs_pragma_handler.cpp \
191 slang_rs_backend.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800192 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700193 slang_rs_export_type.cpp \
194 slang_rs_export_element.cpp \
195 slang_rs_export_var.cpp \
196 slang_rs_export_func.cpp \
Stephen Hines593a8942011-05-10 15:29:50 -0700197 slang_rs_export_foreach.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700198 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700199 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700200 slang_rs_reflection_base.cpp \
201 slang_rs_reflection_cpp.cpp \
202 slang_rs_reflect_utils.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700203
204LOCAL_STATIC_LIBRARIES := \
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800205 libslang \
Ying Wang000c3072011-01-27 19:06:02 -0800206 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800207
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800208LOCAL_SHARED_LIBRARIES := \
209 libclang \
210 libLLVM
211
Raphael11e2b932011-01-13 15:13:35 -0800212ifeq ($(HOST_OS),windows)
213 LOCAL_LDLIBS := -limagehlp -lpsapi
214else
215 LOCAL_LDLIBS := -ldl -lpthread
216endif
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700217
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700218# For build RSCCOptions.inc from RSCCOptions.td
219intermediates := $(call local-intermediates-dir)
220LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Logan Chienf612c7a2011-10-28 08:54:54 +0800221$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700222 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Logan Chien9207a2e2011-10-21 15:39:28 +0800223 $(call transform-host-clang-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700224
Zonr Changa65ec162010-10-17 01:53:05 +0800225include frameworks/compile/slang/RSSpec.mk
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700226include $(CLANG_HOST_BUILD_MK)
227include $(CLANG_TBLGEN_RULES_MK)
228include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700229
230endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700231
232#=====================================================================
233# Include Subdirectories
234#=====================================================================
235include $(call all-makefiles-under,$(LOCAL_PATH))