Android.mk revision 292e00a0259ac28cac1055cb6077cf6fc7c6743c
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#
16LOCAL_PATH := $(call my-dir)
17
18local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
19ifneq ($(TARGET_BUILD_VARIANT),eng)
20local_cflags_for_slang += -D__DISABLE_ASSERTS
21endif
22
23static_libraries_needed_by_slang := \
24	libLLVMLinker   \
25	libLLVMipo	\
26	libLLVMBitWriter	\
27	libLLVMBitReader	\
28	libLLVMARMCodeGen	\
29	libLLVMARMAsmPrinter	\
30	libLLVMARMInfo	\
31	libLLVMX86CodeGen	\
32	libLLVMX86AsmPrinter	\
33	libLLVMX86Info	\
34	libLLVMX86Utils	\
35	libLLVMAsmPrinter	\
36	libLLVMSelectionDAG	\
37	libLLVMCodeGen	\
38	libLLVMScalarOpts	\
39	libLLVMInstCombine	\
40	libLLVMTransformUtils	\
41	libLLVMInstrumentation	\
42	libLLVMipa	\
43	libLLVMAnalysis	\
44	libLLVMTarget	\
45	libLLVMMC	\
46	libLLVMMCParser	\
47	libLLVMCore	\
48	libclangParse	\
49	libclangSema	\
50	libclangAnalysis	\
51	libclangAST	\
52	libclangLex	\
53	libclangFrontend	\
54	libclangCodeGen	\
55	libclangBasic	\
56	libLLVMSupport
57
58# Static library libslang for host
59# ========================================================
60include $(CLEAR_VARS)
61include $(CLEAR_TBLGEN_VARS)
62
63LLVM_ROOT_PATH := external/llvm
64CLANG_ROOT_PATH := external/clang
65
66include $(CLANG_ROOT_PATH)/clang.mk
67
68LOCAL_MODULE := libslang
69LOCAL_MODULE_TAGS := optional
70
71LOCAL_CFLAGS += $(local_cflags_for_slang)
72
73TBLGEN_TABLES :=    \
74	AttrList.inc	\
75	Attrs.inc	\
76	DeclNodes.inc	\
77	DiagnosticCommonKinds.inc	\
78	DiagnosticFrontendKinds.inc	\
79	DiagnosticSemaKinds.inc	\
80	StmtNodes.inc
81
82LOCAL_SRC_FILES :=	\
83	slang.cpp	\
84	slang_utils.cpp	\
85	slang_backend.cpp	\
86	slang_pragma_recorder.cpp	\
87	slang_diagnostic_buffer.cpp
88
89LOCAL_LDLIBS := -ldl -lpthread
90
91include $(CLANG_HOST_BUILD_MK)
92include $(CLANG_TBLGEN_RULES_MK)
93include $(LLVM_GEN_INTRINSICS_MK)
94include $(BUILD_HOST_STATIC_LIBRARY)
95
96# Host static library containing rslib.bc
97# ========================================================
98include $(CLEAR_VARS)
99
100input_data_file := frameworks/compile/slang/rslib.bc
101slangdata_output_var_name := rslib_bc
102
103LOCAL_IS_HOST_MODULE := true
104LOCAL_MODULE := librslib
105LOCAL_MODULE_TAGS := optional
106
107LOCAL_MODULE_CLASS := STATIC_LIBRARIES
108
109include $(LOCAL_PATH)/SlangData.mk
110include $(BUILD_HOST_STATIC_LIBRARY)
111
112# Executable slang-data for host
113# ========================================================
114include $(CLEAR_VARS)
115
116LOCAL_MODULE := slang-data
117LOCAL_MODULE_TAGS := optional
118
119LOCAL_MODULE_CLASS := EXECUTABLES
120
121LOCAL_SRC_FILES := slang-data.c
122
123include $(BUILD_HOST_EXECUTABLE)
124
125# Executable llvm-rs-link for host
126# ========================================================
127include $(CLEAR_VARS)
128include $(CLEAR_TBLGEN_VARS)
129
130include $(LLVM_ROOT_PATH)/llvm.mk
131
132LOCAL_MODULE := llvm-rs-link
133LOCAL_MODULE_TAGS := optional
134
135LOCAL_MODULE_CLASS := EXECUTABLES
136
137LOCAL_SRC_FILES :=	\
138	llvm-rs-link.cpp
139
140LOCAL_STATIC_LIBRARIES :=	\
141	librslib libslang \
142	$(static_libraries_needed_by_slang)
143
144LOCAL_LDLIBS := -ldl -lpthread
145
146include $(LLVM_HOST_BUILD_MK)
147include $(LLVM_GEN_INTRINSICS_MK)
148include $(BUILD_HOST_EXECUTABLE)
149
150# Executable rs-spec-gen for host
151# ========================================================
152include $(CLEAR_VARS)
153
154LOCAL_MODULE := rs-spec-gen
155LOCAL_MODULE_TAGS := optional
156
157LOCAL_MODULE_CLASS := EXECUTABLES
158
159LOCAL_SRC_FILES :=	\
160	slang_rs_spec_table.cpp
161
162include $(BUILD_HOST_EXECUTABLE)
163
164# Executable llvm-rs-cc for host
165# ========================================================
166include $(CLEAR_VARS)
167include $(CLEAR_TBLGEN_VARS)
168
169LOCAL_IS_HOST_MODULE := true
170LOCAL_MODULE := llvm-rs-cc
171LOCAL_MODULE_TAGS := optional
172
173LOCAL_MODULE_CLASS := EXECUTABLES
174
175LOCAL_CFLAGS += $(local_cflags_for_slang)
176
177TBLGEN_TABLES :=    \
178	AttrList.inc    \
179	Attrs.inc    \
180	DeclNodes.inc    \
181	DiagnosticCommonKinds.inc   \
182	DiagnosticDriverKinds.inc	\
183	DiagnosticFrontendKinds.inc	\
184	DiagnosticSemaKinds.inc	\
185	StmtNodes.inc	\
186	RSCCOptions.inc
187
188RS_SPEC_TABLES :=	\
189	RSClangBuiltinEnums.inc	\
190	RSDataTypeEnums.inc	\
191	RSDataElementEnums.inc	\
192	RSDataKindEnums.inc	\
193	RSMatrixTypeEnums.inc	\
194	RSObjectTypeEnums.inc
195
196LOCAL_SRC_FILES :=	\
197	llvm-rs-cc.cpp	\
198	slang_rs.cpp	\
199	slang_rs_ast_replace.cpp	\
200	slang_rs_context.cpp	\
201	slang_rs_pragma_handler.cpp	\
202	slang_rs_backend.cpp	\
203	slang_rs_exportable.cpp	\
204	slang_rs_export_type.cpp	\
205	slang_rs_export_element.cpp	\
206	slang_rs_export_var.cpp	\
207	slang_rs_export_func.cpp	\
208	slang_rs_object_ref_count.cpp	\
209	slang_rs_reflection.cpp \
210	slang_rs_reflect_utils.cpp  \
211	slang_rs_metadata_spec_encoder.cpp
212
213LOCAL_STATIC_LIBRARIES :=	\
214	libclangDriver libslang \
215	$(static_libraries_needed_by_slang)
216
217ifeq ($(HOST_OS),windows)
218  LOCAL_LDLIBS := -limagehlp -lpsapi
219else
220  LOCAL_LDLIBS := -ldl -lpthread
221endif
222
223# For build RSCCOptions.inc from RSCCOptions.td
224intermediates := $(call local-intermediates-dir)
225LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
226$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(TBLGEN)
227	@echo "Building RenderScript compiler (llvm-rs-cc) Option tables with tblgen"
228	$(call transform-host-td-to-out,opt-parser-defs)
229
230include frameworks/compile/slang/RSSpec.mk
231include $(CLANG_HOST_BUILD_MK)
232include $(CLANG_TBLGEN_RULES_MK)
233include $(BUILD_HOST_EXECUTABLE)
234