Home | History | Annotate | Download | only in slang
      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 LOCAL_PATH := $(call my-dir)
     17 
     18 FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false
     19 # Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false".
     20 ifneq "$(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)
     22 endif
     23 
     24 FORCE_BUILD_LLVM_DEBUG ?= false
     25 # Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false".
     26 ifneq "$(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)
     28 endif
     29 
     30 # The prebuilt tools should be used when we are doing app-only build.
     31 ifeq ($(TARGET_BUILD_APPS),)
     32 
     33 
     34 local_cflags_for_slang := -Wall -Werror -std=c++11
     35 ifeq ($(TARGET_BUILD_VARIANT),eng)
     36 local_cflags_for_slang += -O0 -D__ENABLE_INTERNAL_OPTIONS
     37 else
     38 ifeq ($(TARGET_BUILD_VARIANT),userdebug)
     39 else
     40 local_cflags_for_slang += -D__DISABLE_ASSERTS
     41 endif
     42 endif
     43 local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
     44 
     45 include $(LOCAL_PATH)/rs_version.mk
     46 local_cflags_for_slang += $(RS_VERSION_DEFINE)
     47 
     48 static_libraries_needed_by_slang := \
     49 	libLLVMBitWriter_2_9 \
     50 	libLLVMBitWriter_2_9_func \
     51 	libLLVMBitWriter_3_2
     52 
     53 # Static library libslang for host
     54 # ========================================================
     55 include $(CLEAR_VARS)
     56 include $(CLEAR_TBLGEN_VARS)
     57 
     58 LLVM_ROOT_PATH := external/llvm
     59 CLANG_ROOT_PATH := external/clang
     60 
     61 include $(CLANG_ROOT_PATH)/clang.mk
     62 
     63 LOCAL_MODULE := libslang
     64 LOCAL_MODULE_TAGS := optional
     65 
     66 LOCAL_CFLAGS += $(local_cflags_for_slang)
     67 
     68 # Skip missing-field-initializer warnings for mingw.
     69 LOCAL_CFLAGS_windows += -Wno-error=missing-field-initializers
     70 
     71 TBLGEN_TABLES :=    \
     72 	AttrList.inc	\
     73 	Attrs.inc	\
     74 	CommentCommandList.inc \
     75 	CommentNodes.inc \
     76 	DeclNodes.inc	\
     77 	DiagnosticCommonKinds.inc	\
     78 	DiagnosticFrontendKinds.inc	\
     79 	DiagnosticSemaKinds.inc	\
     80 	StmtNodes.inc
     81 
     82 LOCAL_SRC_FILES :=	\
     83 	slang.cpp	\
     84 	slang_bitcode_gen.cpp	\
     85 	slang_backend.cpp	\
     86 	slang_diagnostic_buffer.cpp
     87 
     88 LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
     89 
     90 LOCAL_LDLIBS := -ldl -lpthread
     91 
     92 include $(CLANG_HOST_BUILD_MK)
     93 include $(CLANG_TBLGEN_RULES_MK)
     94 include $(LLVM_GEN_INTRINSICS_MK)
     95 include $(LLVM_GEN_ATTRIBUTES_MK)
     96 include $(BUILD_HOST_STATIC_LIBRARY)
     97 
     98 # ========================================================
     99 include $(CLEAR_VARS)
    100 
    101 LLVM_ROOT_PATH := external/llvm
    102 
    103 LOCAL_MODULE := llvm-rs-as
    104 LOCAL_MODULE_TAGS := optional
    105 
    106 LOCAL_MODULE_CLASS := EXECUTABLES
    107 
    108 LOCAL_SRC_FILES :=	\
    109 	llvm-rs-as.cpp
    110 
    111 LOCAL_CFLAGS += $(local_cflags_for_slang)
    112 LOCAL_STATIC_LIBRARIES :=	\
    113 	libslang \
    114 	$(static_libraries_needed_by_slang)
    115 LOCAL_SHARED_LIBRARIES := \
    116 	libLLVM
    117 
    118 include $(CLANG_HOST_BUILD_MK)
    119 include $(LLVM_HOST_BUILD_MK)
    120 include $(LLVM_GEN_ATTRIBUTES_MK)
    121 include $(BUILD_HOST_EXECUTABLE)
    122 
    123 # Executable llvm-rs-cc for host
    124 # ========================================================
    125 include $(CLEAR_VARS)
    126 include $(CLEAR_TBLGEN_VARS)
    127 
    128 LOCAL_IS_HOST_MODULE := true
    129 LOCAL_MODULE := llvm-rs-cc
    130 
    131 LOCAL_CFLAGS += $(local_cflags_for_slang)
    132 
    133 # Skip missing-field-initializer warnings for mingw.
    134 LOCAL_CFLAGS += -Wno-error=missing-field-initializers
    135 LOCAL_MODULE_TAGS := optional
    136 
    137 LOCAL_MODULE_CLASS := EXECUTABLES
    138 
    139 TBLGEN_TABLES :=    \
    140 	AttrList.inc    \
    141 	Attrs.inc    \
    142 	CommentCommandList.inc \
    143 	CommentNodes.inc \
    144 	DeclNodes.inc    \
    145 	DiagnosticCommonKinds.inc   \
    146 	DiagnosticDriverKinds.inc	\
    147 	DiagnosticFrontendKinds.inc	\
    148 	DiagnosticSemaKinds.inc	\
    149 	StmtNodes.inc	\
    150 	RSCCOptions.inc
    151 
    152 LOCAL_SRC_FILES :=	\
    153 	llvm-rs-cc.cpp	\
    154 	rs_cc_options.cpp \
    155 	slang_rs_foreach_lowering.cpp \
    156 	slang_rs_ast_replace.cpp	\
    157 	slang_rs_check_ast.cpp	\
    158 	slang_rs_context.cpp	\
    159 	slang_rs_pragma_handler.cpp	\
    160 	slang_rs_exportable.cpp	\
    161 	slang_rs_export_type.cpp	\
    162 	slang_rs_export_element.cpp	\
    163 	slang_rs_export_var.cpp	\
    164 	slang_rs_export_func.cpp	\
    165 	slang_rs_export_foreach.cpp	\
    166 	slang_rs_export_reduce.cpp	\
    167 	slang_rs_object_ref_count.cpp	\
    168 	slang_rs_reflection.cpp \
    169 	slang_rs_reflection_cpp.cpp \
    170 	slang_rs_reflect_utils.cpp \
    171 	slang_rs_special_func.cpp	\
    172 	slang_rs_special_kernel_param.cpp \
    173 	strip_unknown_attributes.cpp
    174 
    175 LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
    176 
    177 LOCAL_STATIC_LIBRARIES :=	\
    178 	libslang \
    179 	$(static_libraries_needed_by_slang)
    180 
    181 LOCAL_SHARED_LIBRARIES := \
    182 	libclang \
    183 	libLLVM
    184 
    185 LOCAL_LDLIBS_windows := -limagehlp -lpsapi
    186 LOCAL_LDLIBS_linux := -ldl -lpthread
    187 LOCAL_LDLIBS_darwin := -ldl -lpthread
    188 
    189 # For build RSCCOptions.inc from RSCCOptions.td
    190 intermediates := $(call local-generated-sources-dir)
    191 LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
    192 $(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(LLVM_ROOT_PATH)/include/llvm/Option/OptParser.td $(LLVM_TBLGEN)
    193 	@echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
    194 	$(call transform-host-td-to-out,opt-parser-defs)
    195 
    196 include $(CLANG_HOST_BUILD_MK)
    197 include $(CLANG_TBLGEN_RULES_MK)
    198 include $(LLVM_GEN_ATTRIBUTES_MK)
    199 include $(BUILD_HOST_EXECUTABLE)
    200 
    201 endif  # TARGET_BUILD_APPS
    202 
    203 #=====================================================================
    204 # Include Subdirectories
    205 #=====================================================================
    206 include $(call all-makefiles-under,$(LOCAL_PATH))
    207