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 ifneq ($(TARGET_BUILD_VARIANT),eng)
     24 local_cflags_for_slang += -D__DISABLE_ASSERTS
     25 endif
     26 local_cflags_for_slang += -DTARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)
     27 
     28 ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
     29   RS_VERSION := $(PLATFORM_SDK_VERSION)
     30 else
     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))"
     35 endif
     36 local_cflags_for_slang += -DRS_VERSION=$(RS_VERSION)
     37 
     38 static_libraries_needed_by_slang := \
     39 	libLLVMLinker \
     40 	libLLVMipo \
     41 	libLLVMBitWriter \
     42 	libLLVMBitWriter_2_9 \
     43 	libLLVMBitReader \
     44 	libLLVMARMCodeGen \
     45 	libLLVMARMAsmPrinter \
     46 	libLLVMARMInfo \
     47 	libLLVMARMDesc \
     48 	libLLVMX86CodeGen \
     49 	libLLVMX86Info \
     50 	libLLVMX86Desc \
     51 	libLLVMX86AsmPrinter \
     52 	libLLVMX86Utils \
     53 	libLLVMAsmPrinter \
     54 	libLLVMSelectionDAG \
     55 	libLLVMCodeGen \
     56 	libLLVMScalarOpts \
     57 	libLLVMInstCombine \
     58 	libLLVMTransformUtils \
     59 	libLLVMInstrumentation \
     60 	libLLVMipa \
     61 	libLLVMAnalysis \
     62 	libLLVMTarget \
     63 	libLLVMMC \
     64 	libLLVMMCParser \
     65 	libLLVMCore \
     66 	libclangParse \
     67 	libclangSema \
     68 	libclangAnalysis \
     69 	libclangCodeGen \
     70 	libclangAST \
     71 	libclangLex \
     72 	libclangFrontend \
     73 	libclangBasic \
     74 	libLLVMSupport
     75 
     76 # Static library libslang for host
     77 # ========================================================
     78 include $(CLEAR_VARS)
     79 include $(CLEAR_TBLGEN_VARS)
     80 
     81 LLVM_ROOT_PATH := external/llvm
     82 CLANG_ROOT_PATH := external/clang
     83 
     84 include $(CLANG_ROOT_PATH)/clang.mk
     85 
     86 LOCAL_MODULE := libslang
     87 LOCAL_MODULE_TAGS := optional
     88 
     89 LOCAL_CFLAGS += $(local_cflags_for_slang)
     90 
     91 TBLGEN_TABLES :=    \
     92 	AttrList.inc	\
     93 	Attrs.inc	\
     94 	DeclNodes.inc	\
     95 	DiagnosticCommonKinds.inc	\
     96 	DiagnosticFrontendKinds.inc	\
     97 	DiagnosticSemaKinds.inc	\
     98 	StmtNodes.inc
     99 
    100 LOCAL_SRC_FILES :=	\
    101 	slang.cpp	\
    102 	slang_utils.cpp	\
    103 	slang_backend.cpp	\
    104 	slang_pragma_recorder.cpp	\
    105 	slang_diagnostic_buffer.cpp
    106 
    107 LOCAL_C_INCLUDES += frameworks/compile/libbcc/include
    108 
    109 LOCAL_LDLIBS := -ldl -lpthread
    110 
    111 include $(CLANG_HOST_BUILD_MK)
    112 include $(CLANG_TBLGEN_RULES_MK)
    113 include $(LLVM_GEN_INTRINSICS_MK)
    114 include $(BUILD_HOST_STATIC_LIBRARY)
    115 
    116 # Host static library containing rslib.bc
    117 # ========================================================
    118 include $(CLEAR_VARS)
    119 
    120 input_data_file := frameworks/compile/slang/rslib.bc
    121 slangdata_output_var_name := rslib_bc
    122 
    123 LOCAL_IS_HOST_MODULE := true
    124 LOCAL_MODULE := librslib
    125 LOCAL_MODULE_TAGS := optional
    126 
    127 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
    128 
    129 include $(LOCAL_PATH)/SlangData.mk
    130 include $(BUILD_HOST_STATIC_LIBRARY)
    131 
    132 # Executable slang-data for host
    133 # ========================================================
    134 include $(CLEAR_VARS)
    135 
    136 LOCAL_MODULE := slang-data
    137 LOCAL_MODULE_TAGS := optional
    138 
    139 LOCAL_MODULE_CLASS := EXECUTABLES
    140 
    141 LOCAL_SRC_FILES := slang-data.c
    142 
    143 include $(BUILD_HOST_EXECUTABLE)
    144 
    145 # Executable llvm-rs-link for host
    146 # ========================================================
    147 include $(CLEAR_VARS)
    148 include $(CLEAR_TBLGEN_VARS)
    149 
    150 include $(LLVM_ROOT_PATH)/llvm.mk
    151 
    152 LOCAL_MODULE := llvm-rs-link
    153 LOCAL_MODULE_TAGS := optional
    154 
    155 LOCAL_MODULE_CLASS := EXECUTABLES
    156 
    157 LOCAL_SRC_FILES :=	\
    158 	llvm-rs-link.cpp
    159 
    160 LOCAL_STATIC_LIBRARIES :=	\
    161 	librslib libslang \
    162 	$(static_libraries_needed_by_slang)
    163 
    164 LOCAL_LDLIBS := -ldl -lpthread
    165 
    166 include $(LLVM_HOST_BUILD_MK)
    167 include $(LLVM_GEN_INTRINSICS_MK)
    168 include $(BUILD_HOST_EXECUTABLE)
    169 
    170 # Executable rs-spec-gen for host
    171 # ========================================================
    172 include $(CLEAR_VARS)
    173 
    174 LOCAL_MODULE := rs-spec-gen
    175 LOCAL_MODULE_TAGS := optional
    176 
    177 LOCAL_MODULE_CLASS := EXECUTABLES
    178 
    179 LOCAL_SRC_FILES :=	\
    180 	slang_rs_spec_table.cpp
    181 
    182 include $(BUILD_HOST_EXECUTABLE)
    183 
    184 # Executable llvm-rs-cc for host
    185 # ========================================================
    186 include $(CLEAR_VARS)
    187 include $(CLEAR_TBLGEN_VARS)
    188 
    189 LOCAL_IS_HOST_MODULE := true
    190 LOCAL_MODULE := llvm-rs-cc
    191 LOCAL_MODULE_TAGS := optional
    192 
    193 LOCAL_MODULE_CLASS := EXECUTABLES
    194 
    195 LOCAL_CFLAGS += $(local_cflags_for_slang)
    196 
    197 TBLGEN_TABLES :=    \
    198 	AttrList.inc    \
    199 	Attrs.inc    \
    200 	DeclNodes.inc    \
    201 	DiagnosticCommonKinds.inc   \
    202 	DiagnosticDriverKinds.inc	\
    203 	DiagnosticFrontendKinds.inc	\
    204 	DiagnosticSemaKinds.inc	\
    205 	StmtNodes.inc	\
    206 	RSCCOptions.inc
    207 
    208 RS_SPEC_TABLES :=	\
    209 	RSClangBuiltinEnums.inc	\
    210 	RSDataTypeEnums.inc	\
    211 	RSDataElementEnums.inc	\
    212 	RSDataKindEnums.inc	\
    213 	RSMatrixTypeEnums.inc	\
    214 	RSObjectTypeEnums.inc
    215 
    216 LOCAL_SRC_FILES :=	\
    217 	llvm-rs-cc.cpp	\
    218 	slang_rs.cpp	\
    219 	slang_rs_ast_replace.cpp	\
    220 	slang_rs_context.cpp	\
    221 	slang_rs_pragma_handler.cpp	\
    222 	slang_rs_backend.cpp	\
    223 	slang_rs_exportable.cpp	\
    224 	slang_rs_export_type.cpp	\
    225 	slang_rs_export_element.cpp	\
    226 	slang_rs_export_var.cpp	\
    227 	slang_rs_export_func.cpp	\
    228 	slang_rs_export_foreach.cpp \
    229 	slang_rs_object_ref_count.cpp	\
    230 	slang_rs_reflection.cpp \
    231 	slang_rs_reflect_utils.cpp  \
    232 
    233 LOCAL_STATIC_LIBRARIES :=	\
    234 	libclangDriver libslang \
    235 	$(static_libraries_needed_by_slang)
    236 
    237 ifeq ($(HOST_OS),windows)
    238   LOCAL_LDLIBS := -limagehlp -lpsapi
    239 else
    240   LOCAL_LDLIBS := -ldl -lpthread
    241 endif
    242 
    243 # For build RSCCOptions.inc from RSCCOptions.td
    244 intermediates := $(call local-intermediates-dir)
    245 LOCAL_GENERATED_SOURCES += $(intermediates)/RSCCOptions.inc
    246 $(intermediates)/RSCCOptions.inc: $(LOCAL_PATH)/RSCCOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
    247 	@echo "Building Renderscript compiler (llvm-rs-cc) Option tables with tblgen"
    248 	$(call transform-host-clang-td-to-out,opt-parser-defs)
    249 
    250 include frameworks/compile/slang/RSSpec.mk
    251 include $(CLANG_HOST_BUILD_MK)
    252 include $(CLANG_TBLGEN_RULES_MK)
    253 include $(BUILD_HOST_EXECUTABLE)
    254 
    255 endif  # TARGET_BUILD_APPS
    256 
    257 #=====================================================================
    258 # Include Subdirectories
    259 #=====================================================================
    260 include $(call all-makefiles-under,$(LOCAL_PATH))
    261