1LOCAL_PATH:= $(call my-dir)
2
3llvm_pre_static_libraries := \
4  libLLVMLinker \
5  libLLVMipo \
6  libLLVMDebugInfoDWARF \
7  libLLVMDebugInfoPDB \
8  libLLVMSymbolize \
9  libLLVMIRReader \
10  libLLVMBitWriter \
11  libLLVMBitReader
12
13llvm_arm_static_libraries := \
14  libLLVMARMCodeGen \
15  libLLVMARMAsmParser \
16  libLLVMARMAsmPrinter \
17  libLLVMARMInfo \
18  libLLVMARMDesc \
19  libLLVMARMDisassembler
20
21llvm_x86_static_libraries := \
22  libLLVMX86CodeGen \
23  libLLVMX86Info \
24  libLLVMX86Desc \
25  libLLVMX86AsmParser \
26  libLLVMX86AsmPrinter \
27  libLLVMX86Utils \
28  libLLVMX86Disassembler
29
30llvm_mips_static_libraries := \
31  libLLVMMipsCodeGen \
32  libLLVMMipsInfo \
33  libLLVMMipsDesc \
34  libLLVMMipsAsmParser \
35  libLLVMMipsAsmPrinter \
36  libLLVMMipsDisassembler
37
38llvm_aarch64_static_libraries := \
39  libLLVMAArch64CodeGen \
40  libLLVMAArch64Info \
41  libLLVMAArch64Desc \
42  libLLVMAArch64AsmParser \
43  libLLVMAArch64AsmPrinter \
44  libLLVMAArch64Utils \
45  libLLVMAArch64Disassembler
46
47llvm_post_static_libraries := \
48  libLLVMAsmPrinter \
49  libLLVMSelectionDAG \
50  libLLVMCodeGen \
51  libLLVMObject \
52  libLLVMScalarOpts \
53  libLLVMInstCombine \
54  libLLVMInstrumentation \
55  libLLVMTransformObjCARC \
56  libLLVMTransformUtils \
57  libLLVMAnalysis \
58  libLLVMTarget \
59  libLLVMMCDisassembler \
60  libLLVMMC \
61  libLLVMMCParser \
62  libLLVMCore \
63  libLLVMAsmParser \
64  libLLVMOption \
65  libLLVMSupport \
66  libLLVMVectorize \
67  libLLVMProfileData \
68  libLLVMLibDriver
69
70llvm_host_static_libraries := \
71  libLLVMExecutionEngine \
72  libLLVMRuntimeDyld \
73  libLLVMMCJIT \
74  libLLVMOrcJIT
75
76# HOST LLVM shared library build
77include $(CLEAR_VARS)
78LOCAL_IS_HOST_MODULE := true
79
80LOCAL_MODULE:= libLLVM
81
82LOCAL_MODULE_TAGS := optional
83
84# Host build pulls in all ARM, Mips, X86 components.
85LOCAL_WHOLE_STATIC_LIBRARIES := \
86  $(llvm_pre_static_libraries) \
87  $(llvm_arm_static_libraries) \
88  $(llvm_x86_static_libraries) \
89  $(llvm_mips_static_libraries) \
90  $(llvm_aarch64_static_libraries) \
91  $(llvm_host_static_libraries) \
92  $(llvm_post_static_libraries)
93
94LOCAL_LDLIBS_windows := -limagehlp -lpsapi -lole32
95LOCAL_LDLIBS_darwin := -ldl -lpthread
96LOCAL_LDLIBS_linux := -ldl -lpthread
97
98# Use prebuilts for linux and darwin unless
99# FORCE_BUILD_LLVM_COMPONENTS is true
100ifneq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
101LOCAL_MODULE_HOST_OS := windows
102else
103LOCAL_MODULE_HOST_OS := darwin linux windows
104endif
105
106include $(LLVM_HOST_BUILD_MK)
107include $(BUILD_HOST_SHARED_LIBRARY)
108
109ifeq (,$(filter $(TARGET_ARCH),$(LLVM_SUPPORTED_ARCH)))
110$(warning TODO $(TARGET_ARCH): Enable llvm build)
111endif
112
113ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
114# DEVICE LLVM shared library build
115include $(CLEAR_VARS)
116
117LOCAL_MODULE:= libLLVM
118
119LOCAL_MODULE_TAGS := optional
120
121# Device build selectively pulls in ARM, Mips, X86 components.
122LOCAL_WHOLE_STATIC_LIBRARIES := \
123  $(llvm_pre_static_libraries)
124
125LOCAL_WHOLE_STATIC_LIBRARIES_arm += $(llvm_arm_static_libraries)
126LOCAL_WHOLE_STATIC_LIBRARIES_x86 += $(llvm_x86_static_libraries)
127LOCAL_WHOLE_STATIC_LIBRARIES_x86_64 += $(llvm_x86_static_libraries)
128LOCAL_WHOLE_STATIC_LIBRARIES_mips += $(llvm_mips_static_libraries)
129LOCAL_WHOLE_STATIC_LIBRARIES_mips64 += $(llvm_mips_static_libraries)
130LOCAL_WHOLE_STATIC_LIBRARIES_arm64 += $(llvm_aarch64_static_libraries)
131LOCAL_WHOLE_STATIC_LIBRARIES_arm64 += $(llvm_arm_static_libraries)
132
133ifeq ($(BUILD_ARM_FOR_X86),true)
134LOCAL_WHOLE_STATIC_LIBRARIES_x86 += $(llvm_arm_static_libraries)
135LOCAL_WHOLE_STATIC_LIBRARIES_x86 += $(llvm_aarch64_static_libraries)
136LOCAL_WHOLE_STATIC_LIBRARIES_x86_64 += $(llvm_arm_static_libraries)
137LOCAL_WHOLE_STATIC_LIBRARIES_x86_64 += $(llvm_aarch64_static_libraries)
138endif
139
140LOCAL_WHOLE_STATIC_LIBRARIES += $(llvm_post_static_libraries)
141
142include $(LLVM_DEVICE_BUILD_MK)
143include $(BUILD_SHARED_LIBRARY)
144
145endif
146