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