Android.mk revision 5abbe0e9ca2508260b627ffef2bf01e2554e8357
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 \
23                          -Wno-return-type -Werror -std=c++11
24ifeq ($(TARGET_BUILD_VARIANT),eng)
25local_cflags_for_slang += -O0
26else
27ifeq ($(TARGET_BUILD_VARIANT),userdebug)
28else
29local_cflags_for_slang += -D__DISABLE_ASSERTS
30endif
31endif
32local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
33
34include $(LOCAL_PATH)/rs_version.mk
35local_cflags_for_slang += $(RS_VERSION_DEFINE)
36
37static_libraries_needed_by_slang := \
38	libLLVMBitWriter_2_9 \
39	libLLVMBitWriter_2_9_func \
40	libLLVMBitWriter_3_2
41
42# Static library libslang for host
43# ========================================================
44include $(CLEAR_VARS)
45include $(CLEAR_TBLGEN_VARS)
46
47LLVM_ROOT_PATH := external/llvm
48CLANG_ROOT_PATH := external/clang
49
50include $(CLANG_ROOT_PATH)/clang.mk
51
52LOCAL_MODULE := libslang
53LOCAL_MODULE_TAGS := optional
54ifneq ($(HOST_OS),windows)
55LOCAL_CLANG := true
56endif
57
58LOCAL_CFLAGS += $(local_cflags_for_slang)
59
60TBLGEN_TABLES :=    \
61	AttrList.inc	\
62	Attrs.inc	\
63	CommentCommandList.inc \
64	CommentNodes.inc \
65	DeclNodes.inc	\
66	DiagnosticCommonKinds.inc	\
67	DiagnosticFrontendKinds.inc	\
68	DiagnosticSemaKinds.inc	\
69	StmtNodes.inc
70
71LOCAL_SRC_FILES :=	\
72	slang.cpp	\
73	slang_utils.cpp	\
74	slang_backend.cpp	\
75	slang_pragma_recorder.cpp	\
76	slang_diagnostic_buffer.cpp
77
78LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
79
80LOCAL_LDLIBS := -ldl -lpthread
81ifneq ($(HOST_OS),windows)
82LOCAL_LDLIBS += -lc++
83endif
84
85include $(CLANG_HOST_BUILD_MK)
86include $(CLANG_TBLGEN_RULES_MK)
87include $(LLVM_GEN_INTRINSICS_MK)
88include $(BUILD_HOST_STATIC_LIBRARY)
89
90# ========================================================
91include $(CLEAR_VARS)
92
93LOCAL_MODULE := llvm-rs-as
94LOCAL_MODULE_TAGS := optional
95
96LOCAL_MODULE_CLASS := EXECUTABLES
97
98LOCAL_SRC_FILES :=	\
99	llvm-rs-as.cpp
100
101LOCAL_CFLAGS += $(local_cflags_for_slang)
102LOCAL_STATIC_LIBRARIES :=	\
103	libslang \
104	$(static_libraries_needed_by_slang)
105LOCAL_SHARED_LIBRARIES := \
106	libLLVM
107
108include $(CLANG_HOST_BUILD_MK)
109include $(BUILD_HOST_EXECUTABLE)
110
111# Executable llvm-rs-cc for host
112# ========================================================
113include $(CLEAR_VARS)
114include $(CLEAR_TBLGEN_VARS)
115
116LOCAL_IS_HOST_MODULE := true
117LOCAL_MODULE := llvm-rs-cc
118ifneq ($(HOST_OS),windows)
119LOCAL_CLANG := true
120endif
121LOCAL_MODULE_TAGS := optional
122
123LOCAL_MODULE_CLASS := EXECUTABLES
124
125LOCAL_CFLAGS += $(local_cflags_for_slang)
126
127TBLGEN_TABLES :=    \
128	AttrList.inc    \
129	Attrs.inc    \
130	CommentCommandList.inc \
131	CommentNodes.inc \
132	DeclNodes.inc    \
133	DiagnosticCommonKinds.inc   \
134	DiagnosticDriverKinds.inc	\
135	DiagnosticFrontendKinds.inc	\
136	DiagnosticSemaKinds.inc	\
137	StmtNodes.inc	\
138	RSCCOptions.inc
139
140LOCAL_SRC_FILES :=	\
141	llvm-rs-cc.cpp	\
142	rs_cc_options.cpp \
143	slang_rs.cpp	\
144	slang_rs_ast_replace.cpp	\
145	slang_rs_check_ast.cpp	\
146	slang_rs_context.cpp	\
147	slang_rs_pragma_handler.cpp	\
148	slang_rs_backend.cpp	\
149	slang_rs_exportable.cpp	\
150	slang_rs_export_type.cpp	\
151	slang_rs_export_element.cpp	\
152	slang_rs_export_var.cpp	\
153	slang_rs_export_func.cpp	\
154	slang_rs_export_foreach.cpp \
155	slang_rs_object_ref_count.cpp	\
156	slang_rs_reflection.cpp \
157	slang_rs_reflection_cpp.cpp \
158	slang_rs_reflect_utils.cpp \
159	strip_unknown_attributes.cpp
160
161LOCAL_STATIC_LIBRARIES :=	\
162	libslang \
163	$(static_libraries_needed_by_slang)
164
165LOCAL_SHARED_LIBRARIES := \
166	libclang \
167	libLLVM
168
169ifeq ($(HOST_OS),windows)
170  LOCAL_LDLIBS := -limagehlp -lpsapi
171else
172  LOCAL_LDLIBS := -ldl -lpthread
173endif
174
175# For build RSCCOptions.inc from RSCCOptions.td
176intermediates := $(call local-generated-sources-dir)
177LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
178$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN)
179	@echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
180	$(call transform-host-td-to-out,opt-parser-defs)
181
182include $(CLANG_HOST_BUILD_MK)
183include $(CLANG_TBLGEN_RULES_MK)
184include $(BUILD_HOST_EXECUTABLE)
185
186endif  # TARGET_BUILD_APPS
187
188#=====================================================================
189# Include Subdirectories
190#=====================================================================
191include $(call all-makefiles-under,$(LOCAL_PATH))
192