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 
     17 # The prebuilt tools should be used when we are doing app-only build.
     18 ifeq ($(TARGET_BUILD_APPS),)
     19 
     20 LOCAL_PATH := $(call my-dir)
     21 
     22 local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
     23 ifeq ($(TARGET_BUILD_VARIANT),eng)
     24 local_cflags_for_slang += -O0
     25 else
     26 local_cflags_for_slang += -D__DISABLE_ASSERTS
     27 endif
     28 local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
     29 
     30 ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
     31   RS_VERSION := $(PLATFORM_SDK_VERSION)
     32 else
     33   # Increment by 1 whenever this is not a final release build, since we want to
     34   # be able to see the RS version number change during development.
     35   # See build/core/version_defaults.mk for more information about this.
     36   RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))"
     37 endif
     38 local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION)
     39 
     40 static_libraries_needed_by_slang := \
     41 	libLLVMBitWriter_2_9 \
     42 	libLLVMBitWriter_2_9_func \
     43 	libLLVMBitWriter_3_2
     44 
     45 # Static library libslang for host
     46 # ========================================================
     47 include $(CLEAR_VARS)
     48 include $(CLEAR_TBLGEN_VARS)
     49 
     50 LLVM_ROOT_PATH := external/llvm
     51 CLANG_ROOT_PATH := external/clang
     52 
     53 include $(CLANG_ROOT_PATH)/clang.mk
     54 
     55 LOCAL_MODULE := libslang
     56 LOCAL_MODULE_TAGS := optional
     57 
     58 LOCAL_CFLAGS += $(local_cflags_for_slang)
     59 
     60 TBLGEN_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 
     71 LOCAL_SRC_FILES :=	\
     72 	slang.cpp	\
     73 	slang_utils.cpp	\
     74 	slang_backend.cpp	\
     75 	slang_pragma_recorder.cpp	\
     76 	slang_diagnostic_buffer.cpp
     77 
     78 LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
     79 
     80 LOCAL_LDLIBS := -ldl -lpthread
     81 
     82 include $(CLANG_HOST_BUILD_MK)
     83 include $(CLANG_TBLGEN_RULES_MK)
     84 include $(LLVM_GEN_INTRINSICS_MK)
     85 include $(BUILD_HOST_STATIC_LIBRARY)
     86 
     87 # Host static library containing rslib.bc
     88 # ========================================================
     89 include $(CLEAR_VARS)
     90 
     91 input_data_file := frameworks/compile/slang/rslib.bc
     92 slangdata_output_var_name := rslib_bc
     93 
     94 LOCAL_IS_HOST_MODULE := true
     95 LOCAL_MODULE := librslib
     96 LOCAL_MODULE_TAGS := optional
     97 
     98 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
     99 
    100 include $(LOCAL_PATH)/SlangData.mk
    101 include $(BUILD_HOST_STATIC_LIBRARY)
    102 
    103 # Executable slang-data for host
    104 # ========================================================
    105 include $(CLEAR_VARS)
    106 
    107 LOCAL_MODULE := slang-data
    108 LOCAL_MODULE_TAGS := optional
    109 
    110 LOCAL_MODULE_CLASS := EXECUTABLES
    111 
    112 LOCAL_SRC_FILES := slang-data.c
    113 
    114 include $(BUILD_HOST_EXECUTABLE)
    115 
    116 # Executable rs-spec-gen for host
    117 # ========================================================
    118 include $(CLEAR_VARS)
    119 
    120 LOCAL_MODULE := rs-spec-gen
    121 LOCAL_MODULE_TAGS := optional
    122 
    123 LOCAL_MODULE_CLASS := EXECUTABLES
    124 
    125 LOCAL_SRC_FILES :=	\
    126 	slang_rs_spec_table.cpp
    127 
    128 include $(BUILD_HOST_EXECUTABLE)
    129 
    130 # Executable llvm-rs-cc for host
    131 # ========================================================
    132 include $(CLEAR_VARS)
    133 include $(CLEAR_TBLGEN_VARS)
    134 
    135 LOCAL_IS_HOST_MODULE := true
    136 LOCAL_MODULE := llvm-rs-cc
    137 LOCAL_MODULE_TAGS := optional
    138 
    139 LOCAL_MODULE_CLASS := EXECUTABLES
    140 
    141 LOCAL_CFLAGS += $(local_cflags_for_slang)
    142 
    143 TBLGEN_TABLES :=    \
    144 	AttrList.inc    \
    145 	Attrs.inc    \
    146 	CommentCommandList.inc \
    147 	CommentNodes.inc \
    148 	DeclNodes.inc    \
    149 	DiagnosticCommonKinds.inc   \
    150 	DiagnosticDriverKinds.inc	\
    151 	DiagnosticFrontendKinds.inc	\
    152 	DiagnosticSemaKinds.inc	\
    153 	StmtNodes.inc	\
    154 	RSCCOptions.inc
    155 
    156 RS_SPEC_TABLES :=	\
    157 	RSClangBuiltinEnums.inc	\
    158 	RSDataTypeEnums.inc	\
    159 	RSDataElementEnums.inc	\
    160 	RSMatrixTypeEnums.inc	\
    161 	RSObjectTypeEnums.inc
    162 
    163 LOCAL_SRC_FILES :=	\
    164 	llvm-rs-cc.cpp	\
    165 	slang_rs.cpp	\
    166 	slang_rs_ast_replace.cpp	\
    167 	slang_rs_check_ast.cpp	\
    168 	slang_rs_context.cpp	\
    169 	slang_rs_pragma_handler.cpp	\
    170 	slang_rs_backend.cpp	\
    171 	slang_rs_exportable.cpp	\
    172 	slang_rs_export_type.cpp	\
    173 	slang_rs_export_element.cpp	\
    174 	slang_rs_export_var.cpp	\
    175 	slang_rs_export_func.cpp	\
    176 	slang_rs_export_foreach.cpp \
    177 	slang_rs_object_ref_count.cpp	\
    178 	slang_rs_reflection.cpp \
    179 	slang_rs_reflection_base.cpp \
    180 	slang_rs_reflection_cpp.cpp \
    181 	slang_rs_reflect_utils.cpp
    182 
    183 LOCAL_STATIC_LIBRARIES :=	\
    184 	libslang \
    185 	$(static_libraries_needed_by_slang)
    186 
    187 LOCAL_SHARED_LIBRARIES := \
    188 	libclang \
    189 	libLLVM
    190 
    191 ifeq ($(HOST_OS),windows)
    192   LOCAL_LDLIBS := -limagehlp -lpsapi
    193 else
    194   LOCAL_LDLIBS := -ldl -lpthread
    195 endif
    196 
    197 # For build RSCCOptions.inc from RSCCOptions.td
    198 intermediates := $(call local-intermediates-dir)
    199 LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
    200 $(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
    201 	@echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
    202 	$(call transform-host-clang-td-to-out,opt-parser-defs)
    203 
    204 include frameworks/compile/slang/RSSpec.mk
    205 include $(CLANG_HOST_BUILD_MK)
    206 include $(CLANG_TBLGEN_RULES_MK)
    207 include $(BUILD_HOST_EXECUTABLE)
    208 
    209 endif  # TARGET_BUILD_APPS
    210 
    211 #=====================================================================
    212 # Include Subdirectories
    213 #=====================================================================
    214 include $(call all-makefiles-under,$(LOCAL_PATH))
    215