OSDN Git Service

am 63edeb5f: (-s ours) am 613b4a60: Merge "The windows build now needs to link libole...
[android-x86/external-llvm.git] / llvm-host-build.mk
1 # Windows can't use Clang to build yet
2 ifneq ($(HOST_OS),windows)
3 LOCAL_CLANG := true
4 endif
5
6 ifeq ($(FORCE_BUILD_LLVM_DEBUG),true)
7 local_optflags = -O0 -g
8 else
9 local_optflags = -O2
10 endif
11
12 LOCAL_CFLAGS += \
13         -D_GNU_SOURCE   \
14         -D__STDC_LIMIT_MACROS   \
15         $(local_optflags)       \
16         -fomit-frame-pointer    \
17         -Wall   \
18         -W      \
19         -Wno-unused-parameter   \
20         -Wwrite-strings \
21         -Dsprintf=sprintf \
22         $(LOCAL_CFLAGS)
23
24 ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true)
25 LOCAL_CFLAGS := \
26         $(LOCAL_CFLAGS) \
27         -D_DEBUG        \
28         -UNDEBUG
29 endif
30
31 ifneq ($(REQUIRES_EH),1)
32 LOCAL_CFLAGS += -fno-exceptions
33 else
34 REQUIRES_EH := 0
35 LOCAL_CFLAGS += -fexceptions
36 endif
37
38 ifneq ($(REQUIRES_RTTI),1)
39 LOCAL_CPPFLAGS += -fno-rtti
40 else
41 REQUIRES_RTTI := 0
42 endif
43
44 LOCAL_CPPFLAGS :=       \
45         $(LOCAL_CPPFLAGS)       \
46         -Woverloaded-virtual    \
47         -Wno-sign-promo         \
48         -std=c++11
49
50 # Make sure bionic is first so we can include system headers.
51 LOCAL_C_INCLUDES :=     \
52         $(LLVM_ROOT_PATH)       \
53         $(LLVM_ROOT_PATH)/include       \
54         $(LLVM_ROOT_PATH)/host/include  \
55         $(LOCAL_C_INCLUDES)
56
57 # Add on ncurses to have support for terminfo
58 ifneq ($(HOST_OS),windows)
59 LOCAL_LDLIBS += -lncurses
60 ifneq ($(HOST_OS),darwin)
61 LOCAL_LDLIBS += -lgcc_s
62 endif
63 endif
64
65 LOCAL_IS_HOST_MODULE := true
66
67 ifeq ($(HOST_PREFER_32_BIT),true)
68 LOCAL_MULTILIB := 32
69 else
70 LOCAL_MULTILIB := first
71 endif
72
73 ###########################################################
74 ## Commands for running tblgen to compile a td file
75 ###########################################################
76 define transform-host-td-to-out
77 @mkdir -p $(dir $@)
78 @echo "Host TableGen: $(TBLGEN_LOCAL_MODULE) (gen-$(1)) <= $<"
79 $(hide) $(LLVM_TBLGEN) \
80         -I $(dir $<)    \
81         -I $(LLVM_ROOT_PATH)/include    \
82         -I $(LLVM_ROOT_PATH)/host/include       \
83         -I $(LLVM_ROOT_PATH)/lib/Target \
84         $(if $(strip $(CLANG_ROOT_PATH)),-I $(CLANG_ROOT_PATH)/include,)        \
85         -gen-$(strip $(1))      \
86         -o $@ $<
87 endef