Android.mk revision d711dec946b6408791ca59eb98e363ef04bbd4aa
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
23ifeq ($(TARGET_BUILD_VARIANT),eng)
24local_cflags_for_slang += -O0
25else
26local_cflags_for_slang += -D__DISABLE_ASSERTS
27endif
28local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
29
30ifeq "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
38local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION)
39
40static_libraries_needed_by_slang := \
41	libclangParse \
42	libclangSema \
43	libclangAnalysis \
44	libclangCodeGen \
45	libclangAST \
46	libclangLex \
47	libclangEdit \
48	libclangFrontend \
49	libclangBasic \
50	libclangSerialization \
51	libLLVMLinker \
52	libLLVMipo \
53	libLLVMBitWriter \
54	libLLVMBitWriter_2_9 \
55	libLLVMBitWriter_2_9_func \
56	libLLVMBitWriter_3_2 \
57	libLLVMBitReader \
58	libLLVMARMCodeGen \
59	libLLVMARMAsmParser \
60	libLLVMARMAsmPrinter \
61	libLLVMARMInfo \
62	libLLVMARMDesc \
63	libLLVMX86CodeGen \
64	libLLVMX86Info \
65	libLLVMX86Desc \
66	libLLVMX86AsmParser \
67	libLLVMX86AsmPrinter \
68	libLLVMX86Utils \
69	libLLVMMipsCodeGen \
70	libLLVMMipsInfo \
71	libLLVMMipsDesc \
72	libLLVMMipsAsmParser \
73	libLLVMMipsAsmPrinter \
74	libLLVMAsmPrinter \
75	libLLVMSelectionDAG \
76	libLLVMCodeGen \
77	libLLVMScalarOpts \
78	libLLVMInstCombine \
79	libLLVMInstrumentation \
80	libLLVMTransformUtils \
81	libLLVMipa \
82	libLLVMAnalysis \
83	libLLVMTarget \
84	libLLVMMC \
85	libLLVMMCParser \
86	libLLVMCore \
87	libLLVMArchive \
88	libLLVMAsmParser \
89	libLLVMSupport \
90	libLLVMVectorize
91
92# Static library libslang for host
93# ========================================================
94include $(CLEAR_VARS)
95include $(CLEAR_TBLGEN_VARS)
96
97LLVM_ROOT_PATH := external/llvm
98CLANG_ROOT_PATH := external/clang
99
100include $(CLANG_ROOT_PATH)/clang.mk
101
102LOCAL_MODULE := libslang
103LOCAL_MODULE_TAGS := optional
104
105LOCAL_CFLAGS += $(local_cflags_for_slang)
106
107TBLGEN_TABLES :=    \
108	AttrList.inc	\
109	Attrs.inc	\
110	CommentNodes.inc \
111	DeclNodes.inc	\
112	DiagnosticCommonKinds.inc	\
113	DiagnosticFrontendKinds.inc	\
114	DiagnosticSemaKinds.inc	\
115	StmtNodes.inc
116
117LOCAL_SRC_FILES :=	\
118	slang.cpp	\
119	slang_utils.cpp	\
120	slang_backend.cpp	\
121	slang_pragma_recorder.cpp	\
122	slang_diagnostic_buffer.cpp
123
124LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
125
126LOCAL_LDLIBS := -ldl -lpthread
127
128include $(CLANG_HOST_BUILD_MK)
129include $(CLANG_TBLGEN_RULES_MK)
130include $(LLVM_GEN_INTRINSICS_MK)
131include $(BUILD_HOST_STATIC_LIBRARY)
132
133# Host static library containing rslib.bc
134# ========================================================
135include $(CLEAR_VARS)
136
137input_data_file := frameworks/compile/slang/rslib.bc
138slangdata_output_var_name := rslib_bc
139
140LOCAL_IS_HOST_MODULE := true
141LOCAL_MODULE := librslib
142LOCAL_MODULE_TAGS := optional
143
144LOCAL_MODULE_CLASS := STATIC_LIBRARIES
145
146include $(LOCAL_PATH)/SlangData.mk
147include $(BUILD_HOST_STATIC_LIBRARY)
148
149# Executable slang-data for host
150# ========================================================
151include $(CLEAR_VARS)
152
153LOCAL_MODULE := slang-data
154LOCAL_MODULE_TAGS := optional
155
156LOCAL_MODULE_CLASS := EXECUTABLES
157
158LOCAL_SRC_FILES := slang-data.c
159
160include $(BUILD_HOST_EXECUTABLE)
161
162# Executable llvm-rs-link for host
163# ========================================================
164include $(CLEAR_VARS)
165include $(CLEAR_TBLGEN_VARS)
166
167include $(LLVM_ROOT_PATH)/llvm.mk
168
169LOCAL_MODULE := llvm-rs-link
170LOCAL_MODULE_TAGS := optional
171
172LOCAL_MODULE_CLASS := EXECUTABLES
173
174LOCAL_SRC_FILES :=	\
175	llvm-rs-link.cpp
176
177LOCAL_STATIC_LIBRARIES :=	\
178	librslib libslang \
179	$(static_libraries_needed_by_slang)
180
181LOCAL_LDLIBS := -ldl -lpthread
182
183include $(LLVM_HOST_BUILD_MK)
184include $(LLVM_GEN_INTRINSICS_MK)
185include $(BUILD_HOST_EXECUTABLE)
186
187# Executable rs-spec-gen for host
188# ========================================================
189include $(CLEAR_VARS)
190
191LOCAL_MODULE := rs-spec-gen
192LOCAL_MODULE_TAGS := optional
193
194LOCAL_MODULE_CLASS := EXECUTABLES
195
196LOCAL_SRC_FILES :=	\
197	slang_rs_spec_table.cpp
198
199include $(BUILD_HOST_EXECUTABLE)
200
201# Executable llvm-rs-cc for host
202# ========================================================
203include $(CLEAR_VARS)
204include $(CLEAR_TBLGEN_VARS)
205
206LOCAL_IS_HOST_MODULE := true
207LOCAL_MODULE := llvm-rs-cc
208LOCAL_MODULE_TAGS := optional
209
210LOCAL_MODULE_CLASS := EXECUTABLES
211
212LOCAL_CFLAGS += $(local_cflags_for_slang)
213
214TBLGEN_TABLES :=    \
215	AttrList.inc    \
216	Attrs.inc    \
217	CommentNodes.inc \
218	DeclNodes.inc    \
219	DiagnosticCommonKinds.inc   \
220	DiagnosticDriverKinds.inc	\
221	DiagnosticFrontendKinds.inc	\
222	DiagnosticSemaKinds.inc	\
223	StmtNodes.inc	\
224	RSCCOptions.inc
225
226RS_SPEC_TABLES :=	\
227	RSClangBuiltinEnums.inc	\
228	RSDataTypeEnums.inc	\
229	RSDataElementEnums.inc	\
230	RSMatrixTypeEnums.inc	\
231	RSObjectTypeEnums.inc
232
233LOCAL_SRC_FILES :=	\
234	llvm-rs-cc.cpp	\
235	slang_rs.cpp	\
236	slang_rs_ast_replace.cpp	\
237	slang_rs_check_ast.cpp	\
238	slang_rs_context.cpp	\
239	slang_rs_pragma_handler.cpp	\
240	slang_rs_backend.cpp	\
241	slang_rs_exportable.cpp	\
242	slang_rs_export_type.cpp	\
243	slang_rs_export_element.cpp	\
244	slang_rs_export_var.cpp	\
245	slang_rs_export_func.cpp	\
246	slang_rs_export_foreach.cpp \
247	slang_rs_object_ref_count.cpp	\
248	slang_rs_reflection.cpp \
249	slang_rs_reflection_base.cpp \
250	slang_rs_reflection_cpp.cpp \
251	slang_rs_reflect_utils.cpp
252
253LOCAL_STATIC_LIBRARIES :=	\
254	libclangDriver libslang \
255	$(static_libraries_needed_by_slang)
256
257ifeq ($(HOST_OS),windows)
258  LOCAL_LDLIBS := -limagehlp -lpsapi
259else
260  LOCAL_LDLIBS := -ldl -lpthread
261endif
262
263# For build RSCCOptions.inc from RSCCOptions.td
264intermediates := $(call local-intermediates-dir)
265LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
266$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
267	@echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
268	$(call transform-host-clang-td-to-out,opt-parser-defs)
269
270include frameworks/compile/slang/RSSpec.mk
271include $(CLANG_HOST_BUILD_MK)
272include $(CLANG_TBLGEN_RULES_MK)
273include $(BUILD_HOST_EXECUTABLE)
274
275endif  # TARGET_BUILD_APPS
276
277#=====================================================================
278# Include Subdirectories
279#=====================================================================
280include $(call all-makefiles-under,$(LOCAL_PATH))
281