blob: 80ad8c65015da4c104321661d2abc01b64a5de2b [file] [log] [blame]
Zonr Change86245a2010-10-12 21:42:13 +08001#
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#
Ying Wang94ca2042014-08-01 14:20:35 -070016LOCAL_PATH := $(call my-dir)
David Grossa0ea1142015-06-12 14:29:16 -070017
18FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false
19# Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false".
20ifneq "$(words $(FORCE_BUILD_LLVM_DISABLE_NDEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DISABLE_NDEBUG)))" "10"
21 $(error FORCE_BUILD_LLVM_DISABLE_NDEBUG may only be true, false, or unset)
22endif
23
24FORCE_BUILD_LLVM_DEBUG ?= false
25# Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false".
26ifneq "$(words $(FORCE_BUILD_LLVM_DEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DEBUG)))" "10"
27 $(error FORCE_BUILD_LLVM_DEBUG may only be true, false, or unset)
28endif
Ying Wanga20a2fd2011-03-30 12:58:06 -070029
30# The prebuilt tools should be used when we are doing app-only build.
31ifeq ($(TARGET_BUILD_APPS),)
32
Shih-wei Liao462aefd2010-06-04 15:32:04 -070033
Stephen Hines383f0b82015-06-10 17:08:16 -070034local_cflags_for_slang := -Wall -Werror -std=c++11
Tim Murray881abe92012-09-28 14:14:24 -070035ifeq ($(TARGET_BUILD_VARIANT),eng)
David Gross2770d0e2015-08-03 14:58:59 -070036local_cflags_for_slang += -O0 -D__ENABLE_INTERNAL_OPTIONS
Stephen Hines81dcc9f2015-10-20 23:30:51 -070037
38# Bug: 25132399
39ifneq (,$(filter mips mips64,$(TARGET_ARCH)))
40local_cflags_for_slang += -O1
41endif
42
Tim Murray881abe92012-09-28 14:14:24 -070043else
Jean-Luc Brouillet43243942014-05-23 10:17:22 -070044ifeq ($(TARGET_BUILD_VARIANT),userdebug)
45else
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070046local_cflags_for_slang += -D__DISABLE_ASSERTS
47endif
Jean-Luc Brouillet43243942014-05-23 10:17:22 -070048endif
Stephen Hinesba7c6dc2011-09-07 19:57:04 -070049local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070050
Stephen Hines483f47c2014-05-13 17:28:57 -070051include $(LOCAL_PATH)/rs_version.mk
52local_cflags_for_slang += $(RS_VERSION_DEFINE)
Stephen Hines6b201eb2011-07-20 17:08:16 -070053
Ying Wang000c3072011-01-27 19:06:02 -080054static_libraries_needed_by_slang := \
Logan Chien9207a2e2011-10-21 15:39:28 +080055 libLLVMBitWriter_2_9 \
Stephen Hines9b044ec2011-11-23 16:30:16 -080056 libLLVMBitWriter_2_9_func \
Stephen Hinesbfe3e972013-02-27 13:52:15 -080057 libLLVMBitWriter_3_2
Zonr Chang08df36e2010-10-07 18:50:42 +080058
Ying Wang000c3072011-01-27 19:06:02 -080059# Static library libslang for host
60# ========================================================
61include $(CLEAR_VARS)
62include $(CLEAR_TBLGEN_VARS)
63
64LLVM_ROOT_PATH := external/llvm
65CLANG_ROOT_PATH := external/clang
66
67include $(CLANG_ROOT_PATH)/clang.mk
68
69LOCAL_MODULE := libslang
70LOCAL_MODULE_TAGS := optional
71
Alex Sakhartchouk9be93602011-03-17 17:03:36 -070072LOCAL_CFLAGS += $(local_cflags_for_slang)
Ying Wang000c3072011-01-27 19:06:02 -080073
Stephen Hines505e9bd2015-08-14 20:40:07 -070074# Skip missing-field-initializer warnings for mingw.
Dan Willemsenc8b0cda2015-08-18 16:49:38 -070075LOCAL_CFLAGS_windows += -Wno-error=missing-field-initializers
Stephen Hines505e9bd2015-08-14 20:40:07 -070076
Ying Wang000c3072011-01-27 19:06:02 -080077TBLGEN_TABLES := \
78 AttrList.inc \
79 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -080080 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -070081 CommentNodes.inc \
Ying Wang000c3072011-01-27 19:06:02 -080082 DeclNodes.inc \
83 DiagnosticCommonKinds.inc \
84 DiagnosticFrontendKinds.inc \
85 DiagnosticSemaKinds.inc \
86 StmtNodes.inc
87
88LOCAL_SRC_FILES := \
89 slang.cpp \
Matt Waladabd2462015-07-15 18:39:41 -070090 slang_bitcode_gen.cpp \
Ying Wang000c3072011-01-27 19:06:02 -080091 slang_backend.cpp \
92 slang_pragma_recorder.cpp \
93 slang_diagnostic_buffer.cpp
94
Stephen Hines5e6d0d52011-11-22 19:42:41 -080095LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
96
Logan Chien231f5782014-05-26 23:03:25 +080097LOCAL_LDLIBS := -ldl -lpthread
Zonr Chang08df36e2010-10-07 18:50:42 +080098
99include $(CLANG_HOST_BUILD_MK)
100include $(CLANG_TBLGEN_RULES_MK)
101include $(LLVM_GEN_INTRINSICS_MK)
Ying Wange2201c02011-01-11 17:29:32 -0800102include $(BUILD_HOST_STATIC_LIBRARY)
Zonr Chang08df36e2010-10-07 18:50:42 +0800103
Tobias Grosserc908b902013-06-21 11:28:49 -0700104# ========================================================
105include $(CLEAR_VARS)
106
107LOCAL_MODULE := llvm-rs-as
108LOCAL_MODULE_TAGS := optional
109
110LOCAL_MODULE_CLASS := EXECUTABLES
111
112LOCAL_SRC_FILES := \
113 llvm-rs-as.cpp
114
115LOCAL_CFLAGS += $(local_cflags_for_slang)
116LOCAL_STATIC_LIBRARIES := \
117 libslang \
118 $(static_libraries_needed_by_slang)
119LOCAL_SHARED_LIBRARIES := \
120 libLLVM
121
122include $(CLANG_HOST_BUILD_MK)
123include $(BUILD_HOST_EXECUTABLE)
124
Shih-wei Liaoffa58bb2010-10-10 14:15:13 -0700125# Executable llvm-rs-cc for host
Shih-wei Liao835a7b72010-08-06 02:29:11 -0700126# ========================================================
127include $(CLEAR_VARS)
128include $(CLEAR_TBLGEN_VARS)
129
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700130LOCAL_IS_HOST_MODULE := true
131LOCAL_MODULE := llvm-rs-cc
Stephen Hines505e9bd2015-08-14 20:40:07 -0700132
133LOCAL_CFLAGS += $(local_cflags_for_slang)
134
Stephen Hines505e9bd2015-08-14 20:40:07 -0700135# Skip missing-field-initializer warnings for mingw.
136LOCAL_CFLAGS += -Wno-error=missing-field-initializers
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700137LOCAL_MODULE_TAGS := optional
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700138
Shih-wei Liaobdd78882010-06-06 05:55:36 -0700139LOCAL_MODULE_CLASS := EXECUTABLES
140
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700141TBLGEN_TABLES := \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700142 AttrList.inc \
143 Attrs.inc \
Stephen Hines0da7f6c2013-03-05 15:19:02 -0800144 CommentCommandList.inc \
Shih-wei Liao43730fe2012-08-02 23:06:18 -0700145 CommentNodes.inc \
Shih-wei Liaof52a6202010-09-10 17:40:53 -0700146 DeclNodes.inc \
147 DiagnosticCommonKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700148 DiagnosticDriverKinds.inc \
Zonr Changcf6af6a2010-10-12 12:38:51 +0800149 DiagnosticFrontendKinds.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700150 DiagnosticSemaKinds.inc \
Zonr Chang92b344a2010-10-05 20:39:03 +0800151 StmtNodes.inc \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700152 RSCCOptions.inc
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700153
154LOCAL_SRC_FILES := \
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700155 llvm-rs-cc.cpp \
Stephen Hines8b5c5c62014-06-06 18:03:18 -0700156 rs_cc_options.cpp \
Yang Nifb40ee22015-10-13 20:34:06 +0000157 slang_rs_foreach_lowering.cpp \
Stephen Hines292e00a2011-03-18 19:11:30 -0700158 slang_rs_ast_replace.cpp \
Stephen Hines11274a72012-09-26 19:14:20 -0700159 slang_rs_check_ast.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700160 slang_rs_context.cpp \
161 slang_rs_pragma_handler.cpp \
Zonr Chang641558f2010-10-12 21:07:06 +0800162 slang_rs_exportable.cpp \
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700163 slang_rs_export_type.cpp \
164 slang_rs_export_element.cpp \
165 slang_rs_export_var.cpp \
166 slang_rs_export_func.cpp \
Matt Walac0c5dd82015-07-23 17:29:37 -0700167 slang_rs_export_foreach.cpp \
168 slang_rs_export_reduce.cpp \
Stephen Hines4b32ffd2010-11-05 18:47:11 -0700169 slang_rs_object_ref_count.cpp \
Ying Wang3f8b44d2010-09-04 01:17:01 -0700170 slang_rs_reflection.cpp \
Jason Sams1b6a0882012-03-12 15:07:58 -0700171 slang_rs_reflection_cpp.cpp \
Stephen Hines552d8722013-12-18 12:21:50 -0800172 slang_rs_reflect_utils.cpp \
Matt Walaeae0b7a2015-06-16 14:06:25 -0700173 slang_rs_special_func.cpp \
Stephen Hines552d8722013-12-18 12:21:50 -0800174 strip_unknown_attributes.cpp
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700175
David Gross18c50eb2015-01-30 11:39:22 -0800176LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
177
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700178LOCAL_STATIC_LIBRARIES := \
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800179 libslang \
Ying Wang000c3072011-01-27 19:06:02 -0800180 $(static_libraries_needed_by_slang)
Ying Wange2201c02011-01-11 17:29:32 -0800181
Stephen Hinesbfe3e972013-02-27 13:52:15 -0800182LOCAL_SHARED_LIBRARIES := \
183 libclang \
184 libLLVM
185
Dan Willemsenc8b0cda2015-08-18 16:49:38 -0700186LOCAL_LDLIBS_windows := -limagehlp -lpsapi
187LOCAL_LDLIBS_linux := -ldl -lpthread
188LOCAL_LDLIBS_darwin := -ldl -lpthread
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700189
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700190# For build RSCCOptions.inc from RSCCOptions.td
Ying Wangd1e54f52014-05-20 15:53:17 -0700191intermediates := $(call local-generated-sources-dir)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700192LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
Tim Murray0e3f8c72014-06-04 12:24:50 -0700193$(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN)
Stephen Hinesb7d12692011-09-02 18:16:19 -0700194 @echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
Stephen Hinesa1f95ee2013-08-09 01:26:08 -0700195 $(call transform-host-td-to-out,opt-parser-defs)
Shih-wei Liaob81c6a42010-10-10 14:15:00 -0700196
Shih-wei Liao462aefd2010-06-04 15:32:04 -0700197include $(CLANG_HOST_BUILD_MK)
198include $(CLANG_TBLGEN_RULES_MK)
199include $(BUILD_HOST_EXECUTABLE)
Ying Wanga20a2fd2011-03-30 12:58:06 -0700200
201endif # TARGET_BUILD_APPS
Stephen Hines4cc499d2011-08-24 19:06:17 -0700202
203#=====================================================================
204# Include Subdirectories
205#=====================================================================
206include $(call all-makefiles-under,$(LOCAL_PATH))