Android.mk revision 43730fe3c839af391efe6bdf56b0479860121924
1#
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#
16
17# The prebuilt tools should be used when we are doing app-only build.
18ifeq ($(TARGET_BUILD_APPS),)
19
20LOCAL_PATH := $(call my-dir)
21
22local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
23ifneq ($(TARGET_BUILD_VARIANT),eng)
24local_cflags_for_slang += -D__DISABLE_ASSERTS
25endif
26local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
27
28ifeq "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
36local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION)
37
38static_libraries_needed_by_slang := \
39	libLLVMLinker \
40	libLLVMipo \
41	libLLVMBitWriter \
42	libLLVMBitWriter_2_9 \
43	libLLVMBitWriter_2_9_func \
44	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	libLLVMInstrumentation \
60	libLLVMTransformUtils \
61	libLLVMipa \
62	libLLVMAnalysis \
63	libLLVMTarget \
64	libLLVMMC \
65	libLLVMMCParser \
66	libLLVMCore \
67	libclangParse \
68	libclangSema \
69	libclangAnalysis \
70	libclangCodeGen \
71	libclangAST \
72	libclangLex \
73	libclangEdit \
74	libclangFrontend \
75	libclangBasic \
76	libLLVMSupport \
77	libLLVMVectorize
78
79# 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
92LOCAL_CFLAGS += $(local_cflags_for_slang)
93
94TBLGEN_TABLES :=    \
95	AttrList.inc	\
96	Attrs.inc	\
97	CommentNodes.inc \
98	DeclNodes.inc	\
99	DiagnosticCommonKinds.inc	\
100	DiagnosticFrontendKinds.inc	\
101	DiagnosticSemaKinds.inc	\
102	StmtNodes.inc
103
104LOCAL_SRC_FILES :=	\
105	slang.cpp	\
106	slang_utils.cpp	\
107	slang_backend.cpp	\
108	slang_pragma_recorder.cpp	\
109	slang_diagnostic_buffer.cpp
110
111LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
112
113LOCAL_LDLIBS := -ldl -lpthread
114
115include $(CLANG_HOST_BUILD_MK)
116include $(CLANG_TBLGEN_RULES_MK)
117include $(LLVM_GEN_INTRINSICS_MK)
118include $(BUILD_HOST_STATIC_LIBRARY)
119
120# Host static library containing rslib.bc
121# ========================================================
122include $(CLEAR_VARS)
123
124input_data_file := frameworks/compile/slang/rslib.bc
125slangdata_output_var_name := rslib_bc
126
127LOCAL_IS_HOST_MODULE := true
128LOCAL_MODULE := librslib
129LOCAL_MODULE_TAGS := optional
130
131LOCAL_MODULE_CLASS := STATIC_LIBRARIES
132
133include $(LOCAL_PATH)/SlangData.mk
134include $(BUILD_HOST_STATIC_LIBRARY)
135
136# Executable slang-data for host
137# ========================================================
138include $(CLEAR_VARS)
139
140LOCAL_MODULE := slang-data
141LOCAL_MODULE_TAGS := optional
142
143LOCAL_MODULE_CLASS := EXECUTABLES
144
145LOCAL_SRC_FILES := slang-data.c
146
147include $(BUILD_HOST_EXECUTABLE)
148
149# Executable llvm-rs-link for host
150# ========================================================
151include $(CLEAR_VARS)
152include $(CLEAR_TBLGEN_VARS)
153
154include $(LLVM_ROOT_PATH)/llvm.mk
155
156LOCAL_MODULE := llvm-rs-link
157LOCAL_MODULE_TAGS := optional
158
159LOCAL_MODULE_CLASS := EXECUTABLES
160
161LOCAL_SRC_FILES :=	\
162	llvm-rs-link.cpp
163
164LOCAL_STATIC_LIBRARIES :=	\
165	librslib libslang \
166	$(static_libraries_needed_by_slang)
167
168LOCAL_LDLIBS := -ldl -lpthread
169
170include $(LLVM_HOST_BUILD_MK)
171include $(LLVM_GEN_INTRINSICS_MK)
172include $(BUILD_HOST_EXECUTABLE)
173
174# Executable rs-spec-gen for host
175# ========================================================
176include $(CLEAR_VARS)
177
178LOCAL_MODULE := rs-spec-gen
179LOCAL_MODULE_TAGS := optional
180
181LOCAL_MODULE_CLASS := EXECUTABLES
182
183LOCAL_SRC_FILES :=	\
184	slang_rs_spec_table.cpp
185
186include $(BUILD_HOST_EXECUTABLE)
187
188# Executable llvm-rs-cc for host
189# ========================================================
190include $(CLEAR_VARS)
191include $(CLEAR_TBLGEN_VARS)
192
193LOCAL_IS_HOST_MODULE := true
194LOCAL_MODULE := llvm-rs-cc
195LOCAL_MODULE_TAGS := optional
196
197LOCAL_MODULE_CLASS := EXECUTABLES
198
199LOCAL_CFLAGS += $(local_cflags_for_slang)
200
201TBLGEN_TABLES :=    \
202	AttrList.inc    \
203	Attrs.inc    \
204	CommentNodes.inc \
205	DeclNodes.inc    \
206	DiagnosticCommonKinds.inc   \
207	DiagnosticDriverKinds.inc	\
208	DiagnosticFrontendKinds.inc	\
209	DiagnosticSemaKinds.inc	\
210	StmtNodes.inc	\
211	RSCCOptions.inc
212
213RS_SPEC_TABLES :=	\
214	RSClangBuiltinEnums.inc	\
215	RSDataTypeEnums.inc	\
216	RSDataElementEnums.inc	\
217	RSMatrixTypeEnums.inc	\
218	RSObjectTypeEnums.inc
219
220LOCAL_SRC_FILES :=	\
221	llvm-rs-cc.cpp	\
222	slang_rs.cpp	\
223	slang_rs_ast_replace.cpp	\
224	slang_rs_context.cpp	\
225	slang_rs_pragma_handler.cpp	\
226	slang_rs_backend.cpp	\
227	slang_rs_exportable.cpp	\
228	slang_rs_export_type.cpp	\
229	slang_rs_export_element.cpp	\
230	slang_rs_export_var.cpp	\
231	slang_rs_export_func.cpp	\
232	slang_rs_export_foreach.cpp \
233	slang_rs_object_ref_count.cpp	\
234	slang_rs_reflection.cpp \
235	slang_rs_reflection_base.cpp \
236	slang_rs_reflection_cpp.cpp \
237	slang_rs_reflect_utils.cpp
238
239LOCAL_STATIC_LIBRARIES :=	\
240	libclangDriver libslang \
241	$(static_libraries_needed_by_slang)
242
243ifeq ($(HOST_OS),windows)
244  LOCAL_LDLIBS := -limagehlp -lpsapi
245else
246  LOCAL_LDLIBS := -ldl -lpthread
247endif
248
249# For build RSCCOptions.inc from RSCCOptions.td
250intermediates := $(call local-intermediates-dir)
251LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
252$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
253	@echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
254	$(call transform-host-clang-td-to-out,opt-parser-defs)
255
256include frameworks/compile/slang/RSSpec.mk
257include $(CLANG_HOST_BUILD_MK)
258include $(CLANG_TBLGEN_RULES_MK)
259include $(BUILD_HOST_EXECUTABLE)
260
261endif  # TARGET_BUILD_APPS
262
263#=====================================================================
264# Include Subdirectories
265#=====================================================================
266include $(call all-makefiles-under,$(LOCAL_PATH))
267