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